updated column names on exported CSV

This commit is contained in:
Luis Aleixo 2022-08-25 16:36:14 +01:00
parent 09cfa57e36
commit 7867d8a52d
2 changed files with 19 additions and 19 deletions

View file

@ -898,7 +898,7 @@ function export_csv() {
if (e.id == "Alternative Scenarios") {
Object.entries(alternative_scenarios).map((scenario) => {
if (scenario[0] != 'Current scenario') {
checked_names.push(`Alternative scenario concentrations - ${scenario[0]} (virions m⁻³)`);
checked_names.push(`Alternative scenario concentration - ${scenario[0]} \u2028(virions m⁻³)`);
has_alternative_scenario = true;
};
});
@ -907,21 +907,21 @@ function export_csv() {
var has_rename = document.getElementById(`${e.id}__rename`).value;
var column_name = has_rename != '' ? has_rename : e.id;
if (short_range_expirations.length > 0) {
checked_names.push(`Long-Range ${column_name} (infectious virus)`);
checked_names.push(`Long-Range ${column_name} \u2028(infectious virus)`);
checked_items.push('Long-Range Dose');
// When we have short range interactions, we want the column for the cumulative dose to have the "Total" word before the column name
checked_names.push(`Total ${column_name} (infectious virus)`);
checked_names.push(`Total ${column_name} \u2028(infectious virus)`);
}
else {
checked_names.push(`${column_name} (infectious virus)`);
checked_names.push(`${column_name} \u2028(infectious virus)`);
}
checked_items.push(e.id);
}
else {
var has_rename = document.getElementById(`${e.id}__rename`).value;
var column_name = has_rename != '' ? has_rename : e.id;
if (e.id == "Times") checked_names.push(`${column_name} (h)`);
else if (e.id == "Concentrations") checked_names.push(`${column_name} (virions m⁻³)`);
if (e.id == "Time") checked_names.push(`${column_name} \u2028(h)`);
else if (e.id == "Concentration") checked_names.push(`${column_name} \u2028(virions m⁻³)`);
checked_items.push(e.id);
}
}
@ -931,8 +931,8 @@ function export_csv() {
// Add data for each column.
times.forEach((e, i) => {
let this_row = [];
checked_items.includes("Times") && this_row.push(times[i].toFixed(2));
checked_items.includes("Concentrations") && this_row.push(concentrations[i]);
checked_items.includes("Time") && this_row.push(times[i].toFixed(2));
checked_items.includes("Concentration") && this_row.push(concentrations[i]);
checked_items.includes("Cumulative Dose") && this_row.push(cumulative_doses[i]);
checked_items.includes("Long-Range Dose") && this_row.push(long_range_cumulative_doses[i]);
if (has_alternative_scenario) {

View file

@ -239,11 +239,11 @@
<div class="modal-body">
<b>Select the data to export:</b>
<div class="form-check mt-3">
<input type="checkbox" class="form-check-input" name="checkedItems" id="Times" onclick="display_rename_column(this.checked, 'times-rename-div')" checked disabled>
<label class="form-check-label" for="Times">Times of day</label>
<div id="times-rename-div" class="d-flex align-items-center">
<label class="col-form-label" for="times-rename-div">Column name:</label>
<input type="text" class="form-control form-control-sm col-sm-4 ml-2" id="Times__rename" placeholder="Times" value="Times">
<input type="checkbox" class="form-check-input" name="checkedItems" id="Time" onclick="display_rename_column(this.checked, 'time-rename-div')" checked disabled>
<label class="form-check-label" for="Time">Time of day</label>
<div id="time-rename-div" class="d-flex align-items-center">
<label class="col-form-label" for="time-rename-div">Column name:</label>
<input type="text" class="form-control form-control-sm col-sm-4 ml-2" id="Time__rename" placeholder="Time" value="Time">
</div>
</div>
{# If short-range interactions are set, we don't display Alternative Scenarios, and there is no need to arrange items in a list #}
@ -253,11 +253,11 @@
Current Scenario
{% endif %}
<div class="form-check">
<input type="checkbox" class="form-check-input" name="checkedItems" id="Concentrations" onclick="display_rename_column(this.checked, 'concentrations-rename-div')">
<label class="form-check-label" for="Concentrations">Concentrations</label>
<div id="concentrations-rename-div" class="align-items-center" style="display:none">
<label class="col-form-label" for="concentrations-rename-div">Column name:</label>
<input type="text" class="form-control form-control-sm col-sm-4 ml-2" id="Concentrations__rename" placeholder="Concentrations" value="Concentrations">
<input type="checkbox" class="form-check-input" name="checkedItems" id="Concentration" onclick="display_rename_column(this.checked, 'concentration-rename-div')">
<label class="form-check-label" for="Concentration">Concentration</label>
<div id="concentration-rename-div" class="align-items-center" style="display:none">
<label class="col-form-label" for="concentration-rename-div">Column name:</label>
<input type="text" class="form-control form-control-sm col-sm-4 ml-2" id="Concentration__rename" placeholder="Concentration" value="Concentration">
</div>
</div>
<div class="form-check">
@ -274,7 +274,7 @@
Alternative Scenarios
<div class="form-check">
<input type="checkbox" class="form-check-input" name="checkedItems" id="Alternative Scenarios" onclick="check_download_button(); display_column_name_warning(this.checked);">
<label class="form-check-label" for="Alternative Scenarios">Concentrations</label>
<label class="form-check-label" for="Alternative Scenarios">Concentration</label>
<p id="alternative_scenario_warning" class="text-warning" style="display: none">The column name will be the scenario name.</p>
</div>
</li>