Skip to content

OKRS24-204 #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/fixtures/nation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"model": "signals.geographyunit",
"pk": 3985,
"fields": {
"created": "2024-05-27T13:52:04.705Z",
"modified": "2024-05-27T13:52:04.705Z",
"geo_id": "US",
"name": "United States",
"display_name": "United States",
"level": 5,
"geography": 5
}
}
]
15 changes: 9 additions & 6 deletions src/templates/signals/epivis_export_data_block.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h5>Plot / Export data</h5>
<script>
var geoValues = [];
var currentMode = 'epivis';

function getFilteredGeographicValues(geographicType) {
var data = geoValues.reduce((data, geoValue) => {
if (geoValue.geoType === geographicType) {
Expand All @@ -130,7 +130,7 @@ <h5>Plot / Export data</h5>
} else {
data = [];
}


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

function handleModeChange(mode) {
document.getElementById("epivis-form").reset();

var choose_dates = document.getElementsByName('choose_date');
if (mode === 'epivis') {
currentMode = 'epivis';
Expand Down Expand Up @@ -179,7 +179,7 @@ <h5>Plot / Export data</h5>
$(document).ready(function () {
{% for geography in signal.available_geography.all %}
{% for unit in geography.geography_units.all %}
geoValues.push({'id': '{{ unit.geo_id }}', 'geoType': '{{ unit.geography }}', 'text': '{{ unit.display_name }}'});
geoValues.push({'id': '{{ unit.geo_id }}', 'geoType': '{{ unit.geography }}', 'text': '{{ unit.display_name }}'});
{% endfor %}
{% endfor %}

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

function submitMode(event) {
event.preventDefault();

var dataSource = document.getElementById('source').value;
var dataSignal = document.getElementById('signal').value;
var geographicType = document.getElementById('geographic_type').value;
var geographicValue = $('#geographic_value').select2('data').map((el) => el.id).join(',');
// geographicValue is a comma separated string of geographic values. type can be string or integer
// in case of string, it should be converted to lowercase
// else it will be treated as integer
var geographicValue = $('#geographic_value').select2('data').map((el) => (typeof el.id === 'string') ? el.id.toLowerCase() : el.id).join(',');

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