<commit_before>{% extends "core/base.html" %}
{% load compress %}
{% load leaflet_tags %}
{% load geoq_leaflet_tags %}
{% load django_select2_tags %}
{% block title %}GeoQ: Workcell {{ object.id }}{% endblock %}
{% block static_libraries %}

    {% leaflet_js plugins="draw, esri, esriCluster, MakiMarkers" %}
    {% import_django_select2_js %}
    <script src="{{ STATIC_URL }}core/js/jquery-migrate-1.2.1.min.js"></script>
    <script src="{{ STATIC_URL }}core/js/leaflet_helper.js"></script>
    <script src="{{ STATIC_URL }}core/js/leaflet_helper.parsers.js"></script>
    <script src="{{ STATIC_URL }}core/js/KML.js"></script>
    <script src="{{ STATIC_URL }}core/js/aoi_feature_edit.js"></script>
    <script src="{{ STATIC_URL }}core/js/Math.uuid.js"></script>
    <script src="{{ STATIC_URL }}core/js/dndsupport.js"></script>
    <script src="{{ STATIC_URL }}core/js/leafletcontrols/leaflet.simple_button.js"></script>
    <script src="{{ STATIC_URL }}leaflet/L.Control.Button.js"></script>
	<script src="{{ STATIC_URL }}core/js/leaflet.OSMGeocoder/Control.OSMGeocoder.js"></script>
	<script src="{{ STATIC_URL }}core/js/leafletcontrols/leaflet.layer_tree.js"></script>
    <script src="{{ STATIC_URL }}core/js/leafletcontrols/leaflet.filter_bar.js"></script>
    <script src="{{ STATIC_URL }}core/js/leafletcontrols/leaflet.feature_manager.js"></script>
    <script src="{{ STATIC_URL }}core/js/fancytree/jquery.fancytree.js" type="text/javascript"></script>
    <script src="{{ STATIC_URL }}core/js/fancytree/jquery.fancytree.dnd.js" type="text/javascript"></script>
    <script src="{{ STATIC_URL }}core/js/jquery.jeditable.js" type="text/javascript"></script>
    <script src="{{ STATIC_URL }}core/js/moment.min.js" type="text/javascript"></script>

	<script src="{{ STATIC_URL }}core/js/geojson-js-utils/geojson-utils.js"></script>
	<script src="{{ STATIC_URL }}core/js/jsmaptools/jsmaptools.js"></script>
	<script src="{{ STATIC_URL }}core/js/jsmaptools/jsmaptools_polygons.js"></script>
	<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-dialog.js"></script>
	<script src="{{ STATIC_URL }}core/js/store.min.js"></script>
    <script src="{{ STATIC_URL }}core/js/jquery.tancolor.js"></script>
    <script src="{{ STATIC_URL }}core/js/maths.js"></script>

    <script src="{{ STATIC_URL }}leaflet/leaflet-plugins/leaflet.shapefile-gh-pages/leaflet.shpfile.js"></script>
    <script src="{{ STATIC_URL }}leaflet/leaflet-plugins/leaflet.shapefile-gh-pages/shp.js"></script>
    <script src="{{ STATIC_URL }}leaflet/leaflet-plugins/layer/tile/Bing.js"></script>
	<script src="{{ STATIC_URL }}leaflet/leaflet-plugins/layer/tile/Google.js"></script>
    <script src="{{ STATIC_URL }}leaflet/leaflet-plugins/layer/tile/leaflet-tilelayer-wmts.js"></script>

    <script src="{{ STATIC_URL }}core/js/bootstrap_slider/bootstrap-slider.js" type="text/javascript"></script>

    {% for layer in object.job.map.layers %}{% if layer.layer.type == 'Google Maps' %}
    <script src="{{ layer.layer.url }}maps/api/js?v=3&sensor=false"></script>
    {%  endif %}{% endfor %}

    <script type="text/javascript">

        leaflet_helper.proxy_path = "{% url 'proxy' %}" + "/"; //TODO: Standardize expression of proxy locations
        leaflet_helper.home_url = "{% url 'home' %}";

        aoi_feature_edit.feature_types = [];
        {% for feature_type in feature_types %}
            aoi_feature_edit.feature_types[{{ feature_type.id }}] = {{ feature_type.to_json|safe }};
        {% endfor %}

        aoi_feature_edit.feature_types_all = [];
        {% for feature_type in feature_types_all %}
            aoi_feature_edit.feature_types_all[{{ feature_type.id }}] = {{ feature_type.to_json|safe }};
        {% endfor %}

        var inreview_status_url = "{% url 'aoi-update-status' object.id 'In review' %}";
        aoi_feature_edit.awaitingreview_status_url = "{% url 'aoi-update-status' object.id 'Awaiting review' %}";
        aoi_feature_edit.unassigned_status_url = "{% url 'aoi-update-status' object.id 'Unassigned' %}";
        aoi_feature_edit.completed_status_url = "{% url 'aoi-update-status' object.id 'Completed' %}";

        leaflet_layer_control.finish_options.push('awaitingreview');
        {% if request.user in reviewers %}
            leaflet_layer_control.finish_options.push('unassigned');
            leaflet_layer_control.finish_options.push('completed');
        {% endif %}

        aoi_feature_edit.job_absolute_url = "{{ object.job.get_absolute_url }}";
        aoi_feature_edit.job_name = "{{ object.job.name }}";
        aoi_feature_edit.aoi_id = "{{ object.id }}";
        aoi_feature_edit.tags = "{{ object.job.tags }}";
        aoi_feature_edit.analyst_name = "{{ request.user.username }}";

        aoi_feature_edit.aoi_map_json = {{ layers_on_map|safe|default:"{}" }}; //This lists all the custom layers for the map
        aoi_feature_edit.aoi_extents_geojson = {{ object.polygon.json|safe }};
        aoi_feature_edit.aoi_properties = {{ object.properties_json|safe }};
        aoi_feature_edit.priority = {{ object.priority|default:5 }}

        aoi_feature_edit.api_url_job_kml = "{% url 'kml-job' object.job.id %}";
        aoi_feature_edit.api_url_job_kml_networked = "{% url 'kml-networked-job' object.job.id %}";
        aoi_feature_edit.api_url_job_georss = "{% url 'json-job' object.job.id %}";
        aoi_feature_edit.api_url_aoi_georss = "{% url 'json-workcell' object.id %}";
        aoi_feature_edit.api_url_log = "{% url 'workcell_log' object.id %}";

        aoi_feature_edit.csrf = '{{ csrf_token }}';

        aoi_feature_edit.job_features_geojson = {{ object.job.features_geoJSON|safe }};
        aoi_feature_edit.create_feature_url = "{% url 'feature-create' %}";
        aoi_feature_edit.edit_feature_url = "{% url 'feature-edit' %}";
        aoi_feature_edit.next_aoi_url = "{% url 'job-next-aoi' object.job.id %}";

        aoi_feature_edit.percent_complete = {% widthratio object.job.complete.count 100 100%};
        aoi_feature_edit.description = "{{ object.description|escapejs}}";
        aoi_feature_edit.static_root = "{{ STATIC_URL }}";
        aoi_feature_edit.help_url = "{% url 'help_page' %}";

        {% if 'user_accepted_terms' in request.base_perms %}aoi_feature_edit.user_accepted_tems = true;{% endif %}
        aoi_feature_edit.terms_acceptance_url = "{% url 'accept_terms_link' %}";

        {% if 'permissions_granted' in request.base_perms %}aoi_feature_edit.permissions_granted = true;{% endif %}
        {% if request.user in reviewers %}aoi_feature_edit.permissions_review = true;{% endif %}


        aoi_feature_edit.init();

    </script>
<commit_msg>Fix percentage complete on job work page<commit_after>{% extends "core/base.html" %}
{% load compress %}
{% load leaflet_tags %}
{% load geoq_leaflet_tags %}
{% load django_select2_tags %}
{% block title %}GeoQ: Workcell {{ object.id }}{% endblock %}
{% block static_libraries %}

    {% leaflet_js plugins="draw, esri, esriCluster, MakiMarkers" %}
    {% import_django_select2_js %}
    <script src="{{ STATIC_URL }}core/js/jquery-migrate-1.2.1.min.js"></script>
    <script src="{{ STATIC_URL }}core/js/leaflet_helper.js"></script>
    <script src="{{ STATIC_URL }}core/js/leaflet_helper.parsers.js"></script>
    <script src="{{ STATIC_URL }}core/js/KML.js"></script>
    <script src="{{ STATIC_URL }}core/js/aoi_feature_edit.js"></script>
    <script src="{{ STATIC_URL }}core/js/Math.uuid.js"></script>
    <script src="{{ STATIC_URL }}core/js/dndsupport.js"></script>
    <script src="{{ STATIC_URL }}core/js/leafletcontrols/leaflet.simple_button.js"></script>
    <script src="{{ STATIC_URL }}leaflet/L.Control.Button.js"></script>
	<script src="{{ STATIC_URL }}core/js/leaflet.OSMGeocoder/Control.OSMGeocoder.js"></script>
	<script src="{{ STATIC_URL }}core/js/leafletcontrols/leaflet.layer_tree.js"></script>
    <script src="{{ STATIC_URL }}core/js/leafletcontrols/leaflet.filter_bar.js"></script>
    <script src="{{ STATIC_URL }}core/js/leafletcontrols/leaflet.feature_manager.js"></script>
    <script src="{{ STATIC_URL }}core/js/fancytree/jquery.fancytree.js" type="text/javascript"></script>
    <script src="{{ STATIC_URL }}core/js/fancytree/jquery.fancytree.dnd.js" type="text/javascript"></script>
    <script src="{{ STATIC_URL }}core/js/jquery.jeditable.js" type="text/javascript"></script>
    <script src="{{ STATIC_URL }}core/js/moment.min.js" type="text/javascript"></script>

	<script src="{{ STATIC_URL }}core/js/geojson-js-utils/geojson-utils.js"></script>
	<script src="{{ STATIC_URL }}core/js/jsmaptools/jsmaptools.js"></script>
	<script src="{{ STATIC_URL }}core/js/jsmaptools/jsmaptools_polygons.js"></script>
	<script src="{{ STATIC_URL }}bootstrap/js/bootstrap-dialog.js"></script>
	<script src="{{ STATIC_URL }}core/js/store.min.js"></script>
    <script src="{{ STATIC_URL }}core/js/jquery.tancolor.js"></script>
    <script src="{{ STATIC_URL }}core/js/maths.js"></script>

    <script src="{{ STATIC_URL }}leaflet/leaflet-plugins/leaflet.shapefile-gh-pages/leaflet.shpfile.js"></script>
    <script src="{{ STATIC_URL }}leaflet/leaflet-plugins/leaflet.shapefile-gh-pages/shp.js"></script>
    <script src="{{ STATIC_URL }}leaflet/leaflet-plugins/layer/tile/Bing.js"></script>
	<script src="{{ STATIC_URL }}leaflet/leaflet-plugins/layer/tile/Google.js"></script>
    <script src="{{ STATIC_URL }}leaflet/leaflet-plugins/layer/tile/leaflet-tilelayer-wmts.js"></script>

    <script src="{{ STATIC_URL }}core/js/bootstrap_slider/bootstrap-slider.js" type="text/javascript"></script>

    {% for layer in object.job.map.layers %}{% if layer.layer.type == 'Google Maps' %}
    <script src="{{ layer.layer.url }}maps/api/js?v=3&sensor=false"></script>
    {%  endif %}{% endfor %}

    <script type="text/javascript">

        leaflet_helper.proxy_path = "{% url 'proxy' %}" + "/"; //TODO: Standardize expression of proxy locations
        leaflet_helper.home_url = "{% url 'home' %}";

        aoi_feature_edit.feature_types = [];
        {% for feature_type in feature_types %}
            aoi_feature_edit.feature_types[{{ feature_type.id }}] = {{ feature_type.to_json|safe }};
        {% endfor %}

        aoi_feature_edit.feature_types_all = [];
        {% for feature_type in feature_types_all %}
            aoi_feature_edit.feature_types_all[{{ feature_type.id }}] = {{ feature_type.to_json|safe }};
        {% endfor %}

        var inreview_status_url = "{% url 'aoi-update-status' object.id 'In review' %}";
        aoi_feature_edit.awaitingreview_status_url = "{% url 'aoi-update-status' object.id 'Awaiting review' %}";
        aoi_feature_edit.unassigned_status_url = "{% url 'aoi-update-status' object.id 'Unassigned' %}";
        aoi_feature_edit.completed_status_url = "{% url 'aoi-update-status' object.id 'Completed' %}";

        leaflet_layer_control.finish_options.push('awaitingreview');
        {% if request.user in reviewers %}
            leaflet_layer_control.finish_options.push('unassigned');
            leaflet_layer_control.finish_options.push('completed');
        {% endif %}

        aoi_feature_edit.job_absolute_url = "{{ object.job.get_absolute_url }}";
        aoi_feature_edit.job_name = "{{ object.job.name }}";
        aoi_feature_edit.aoi_id = "{{ object.id }}";
        aoi_feature_edit.tags = "{{ object.job.tags }}";
        aoi_feature_edit.analyst_name = "{{ request.user.username }}";

        aoi_feature_edit.aoi_map_json = {{ layers_on_map|safe|default:"{}" }}; //This lists all the custom layers for the map
        aoi_feature_edit.aoi_extents_geojson = {{ object.polygon.json|safe }};
        aoi_feature_edit.aoi_properties = {{ object.properties_json|safe }};
        aoi_feature_edit.priority = {{ object.priority|default:5 }}

        aoi_feature_edit.api_url_job_kml = "{% url 'kml-job' object.job.id %}";
        aoi_feature_edit.api_url_job_kml_networked = "{% url 'kml-networked-job' object.job.id %}";
        aoi_feature_edit.api_url_job_georss = "{% url 'json-job' object.job.id %}";
        aoi_feature_edit.api_url_aoi_georss = "{% url 'json-workcell' object.id %}";
        aoi_feature_edit.api_url_log = "{% url 'workcell_log' object.id %}";

        aoi_feature_edit.csrf = '{{ csrf_token }}';

        aoi_feature_edit.job_features_geojson = {{ object.job.features_geoJSON|safe }};
        aoi_feature_edit.create_feature_url = "{% url 'feature-create' %}";
        aoi_feature_edit.edit_feature_url = "{% url 'feature-edit' %}";
        aoi_feature_edit.next_aoi_url = "{% url 'job-next-aoi' object.job.id %}";

        aoi_feature_edit.percent_complete = {{ object.job.complete_percent }};
        aoi_feature_edit.description = "{{ object.description|escapejs}}";
        aoi_feature_edit.static_root = "{{ STATIC_URL }}";
        aoi_feature_edit.help_url = "{% url 'help_page' %}";

        {% if 'user_accepted_terms' in request.base_perms %}aoi_feature_edit.user_accepted_tems = true;{% endif %}
        aoi_feature_edit.terms_acceptance_url = "{% url 'accept_terms_link' %}";

        {% if 'permissions_granted' in request.base_perms %}aoi_feature_edit.permissions_granted = true;{% endif %}
        {% if request.user in reviewers %}aoi_feature_edit.permissions_review = true;{% endif %}


        aoi_feature_edit.init();

    </script>

{'fraction_non_alphanumeric': 0.1716928630518162, 'fraction_numerical': 0.001504098668872678, 'mean_word_length': 4.0333080999243, 'pattern_counts': {'":': 0, '<': 131, '<?xml version=': 0, '>': 131, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6593627', 'n_tokens_mistral': 4706, 'n_tokens_neox': 4506, 'n_words': 655}