diff --git a/src/dataloaderinterface/templates/dataloaderinterface/browse-sites.html b/src/dataloaderinterface/templates/dataloaderinterface/browse-sites.html index 04fde3fb..ba96d1f9 100644 --- a/src/dataloaderinterface/templates/dataloaderinterface/browse-sites.html +++ b/src/dataloaderinterface/templates/dataloaderinterface/browse-sites.html @@ -71,7 +71,7 @@ "detail_link": "{% url 'site_detail' site.sampling_feature_code %}", "dataType": "{% if site.latest_measurement%}EnviroDIY,{% endif %}{% if site.leafpack_count > 0 %}Leaf Pack,{% endif %}{% if site.streamwatch_count > 0 %}StreamWatch Schools,{% endif %}", "status": "{{ site.ownership_status }}", - "dataAge":"{{ site.latest_measurement|data_age }}" + "dataAge":"{{ site.latest_measurement_utc|data_age }}" }{% if not forloop.last %},{% endif %} {% endfor %} ] diff --git a/src/dataloaderinterface/views.py b/src/dataloaderinterface/views.py index 46f9e8a5..816ad878 100644 --- a/src/dataloaderinterface/views.py +++ b/src/dataloaderinterface/views.py @@ -185,9 +185,9 @@ def get_site_data(self): WITH last_measurement AS ( SELECT ss."RegistrationID" - ,MAX(sm.value_datetime + sm.value_datetime_utc_offset) AS latestmeasure - ,MAX(sm.value_datetime) AS latestmeasure_utc - ,MAX(sm.value_datetime_utc_offset) AS latestmeasure_utc_offset + ,MAX(sm.value_datetime + sm.value_datetime_utc_offset) AS latestmeasurement + ,MAX(sm.value_datetime) AS latestmeasurement_utc + ,MAX(sm.value_datetime_utc_offset) AS latestmeasurement_utc_offset FROM dataloaderinterface_sensormeasurement AS sm JOIN dataloaderinterface_sitesensor AS ss ON sm.sensor_id = ss.id @@ -215,9 +215,9 @@ def get_site_data(self): ,sr."Latitude" AS latitude ,sr."Longitude" AS longitude ,sr."Elevation" AS elevation - ,lm.latestmeasure_utc AS latest_measurement_utc - ,lm.latestmeasure_utc_offset AS latest_measurement_utcoffset - ,lm.latestmeasure AS latest_measurement + ,lm.latestmeasurement_utc AS latest_measurement_utc + ,lm.latestmeasurement_utc_offset AS latest_measurement_utcoffset + ,lm.latestmeasurement AS latest_measurement ,lp.leafpack_count AS leafpack_count ,sr.streamwatch_assessments AS streamwatch_count