Skip to content

Commit

Permalink
Fixed bug with non pre-loaded estimated timeseries
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnAnnFryingPan committed Jul 2, 2022
1 parent 195d662 commit 4a731d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mine_the_gap/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,10 +731,12 @@ function get_csv(url, filename='data.csv', jsonParams={}){


function getTimestampValue(data, timestamp) {
//alert(JSON.stringify(data) + '; ' + timestamp)
for (var i=0; i<data.length; i++){
if(data[i]['timestamp'].trim() == timestamp.trim()){
if(data[i]['timestamp'].trim() == timestamp.toString().trim()){
//alert('timestamp: ' + timestamp + '; dataItem: ' + data[i]['timestamp']);
return data[i]['score'];
//alert(JSON.stringify(data[i]));
return data[i]['value'];
}
}
return null;
Expand Down Expand Up @@ -992,10 +994,12 @@ function getEstimatedTimeseries(measurement, method, regionId, ignoreSiteId, lis
timeout: 300000,
async: true,
success: function (data) {
//alert(JSON.stringify(data));
var estValues = [];
for (var timestampIdx=0; timestampIdx<timestampList.length; timestampIdx++){
estValues.push(getTimestampValue(data, timestampList[timestampIdx]));
};
//alert(JSON.stringify(estValues));
listChart.data.datasets.push(
{
label: 'Estimated values',
Expand Down
1 change: 1 addition & 0 deletions mine_the_gap/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ def estimates(request, method_name, measurement, timestamp_val=None, region_id=N
'value': value,
'percent_score': percentage_score,
'z_score': z_score,
'value': value,
'min': min_val,
'max': max_val,
'mean': mean_val,
Expand Down

0 comments on commit 4a731d6

Please sign in to comment.