Skip to content

Commit

Permalink
dynamic updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rzats committed May 22, 2024
1 parent 7dbe224 commit 4bfff8a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/modes/indicator/IndicatorAbout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@
currentMode.set(modeByID.export);
}
function buildExportURL() {
let exportURL = '';
let exportURL = '';
$: {
exportURL = '';
if (sensor && sensor.key.split('-').length >= 2) {
// account for dashes in the sensor
let [first, ...rest] = sensor.key.split('-');
rest = rest.join('-');
exportURL += `data_source=${first}&signal=${rest}`;
let [last, ...rest] = sensor.key.split('-').reverse();
rest = rest.reverse().join('-');
exportURL += `data_source=${rest}&signal=${last}`;
}
if (region) {
exportURL += `&geo_type=${region.level}&geo_value=${region.propertyId}`;
}
if (date) {
exportURL += `&start_day=${formatDateISO(date.value)}&end_day=${formatDateISO(date.value)}`;
}
return exportURL;
}
</script>

Expand All @@ -58,7 +58,7 @@
</li>
{/each}
<li>
<a href={`../export/?${buildExportURL()}`} on:click={setExportMode}>Export Data</a>
<a href={`../export/?${exportURL}`} on:click={setExportMode}>Export Data</a>
</li>
</ul>
{/if}
Expand Down

0 comments on commit 4bfff8a

Please sign in to comment.