Skip to content

Commit 176bd87

Browse files
authored
Merge pull request #124 from cmu-delphi/OKRS24-204
OKRS24-204
2 parents 2403047 + 11ede81 commit 176bd87

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

src/fixtures/nation.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[
2+
{
3+
"model": "signals.geographyunit",
4+
"pk": 3985,
5+
"fields": {
6+
"created": "2024-05-27T13:52:04.705Z",
7+
"modified": "2024-05-27T13:52:04.705Z",
8+
"geo_id": "US",
9+
"name": "United States",
10+
"display_name": "United States",
11+
"level": 5,
12+
"geography": 5
13+
}
14+
}
15+
]

src/templates/signals/epivis_export_data_block.html

+9-6
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ <h5>Plot / Export data</h5>
106106
<script>
107107
var geoValues = [];
108108
var currentMode = 'epivis';
109-
109+
110110
function getFilteredGeographicValues(geographicType) {
111111
var data = geoValues.reduce((data, geoValue) => {
112112
if (geoValue.geoType === geographicType) {
@@ -130,7 +130,7 @@ <h5>Plot / Export data</h5>
130130
} else {
131131
data = [];
132132
}
133-
133+
134134

135135
$('#geographic_value').select2({
136136
data: data,
@@ -146,7 +146,7 @@ <h5>Plot / Export data</h5>
146146

147147
function handleModeChange(mode) {
148148
document.getElementById("epivis-form").reset();
149-
149+
150150
var choose_dates = document.getElementsByName('choose_date');
151151
if (mode === 'epivis') {
152152
currentMode = 'epivis';
@@ -179,7 +179,7 @@ <h5>Plot / Export data</h5>
179179
$(document).ready(function () {
180180
{% for geography in signal.available_geography.all %}
181181
{% for unit in geography.geography_units.all %}
182-
geoValues.push({'id': '{{ unit.geo_id }}', 'geoType': '{{ unit.geography }}', 'text': '{{ unit.display_name }}'});
182+
geoValues.push({'id': '{{ unit.geo_id }}', 'geoType': '{{ unit.geography }}', 'text': '{{ unit.display_name }}'});
183183
{% endfor %}
184184
{% endfor %}
185185

@@ -201,11 +201,14 @@ <h5>Plot / Export data</h5>
201201

202202
function submitMode(event) {
203203
event.preventDefault();
204-
204+
205205
var dataSource = document.getElementById('source').value;
206206
var dataSignal = document.getElementById('signal').value;
207207
var geographicType = document.getElementById('geographic_type').value;
208-
var geographicValue = $('#geographic_value').select2('data').map((el) => el.id).join(',');
208+
// geographicValue is a comma separated string of geographic values. type can be string or integer
209+
// in case of string, it should be converted to lowercase
210+
// else it will be treated as integer
211+
var geographicValue = $('#geographic_value').select2('data').map((el) => (typeof el.id === 'string') ? el.id.toLowerCase() : el.id).join(',');
209212

210213
if (geographicType === 'Choose...' || geographicValue === '') {
211214
showWarningAlert("Geographic Type or Geographic Value is not selected.");

0 commit comments

Comments
 (0)