Skip to content

Commit

Permalink
fix bug in data query due to foreast to hindcast
Browse files Browse the repository at this point in the history
  • Loading branch information
chiaweh2 committed Dec 23, 2024
1 parent 8dd59ac commit c574233
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions data_access.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,27 @@ $(document).ready(function(){
$('#expTypeDataQuery').empty();
data_access_all_clear();
createDataAccessAll(regionSubdomain);

});
});


// function to reset the hidden or show dropdown options
function resetOptionVisibility(expType) {
// turn on/off forecast/projection related options
if (experiment_type.includes('forecast')) {
// creating the initialDate options needed!!!!!
$('.forecastOpt').removeClass('hidden');
$('.projectOpt').addClass('hidden');
} else if (experiment_type.includes('projection')) {
$('.projectOpt').removeClass('hidden');
$('.forecastOpt').addClass('hidden');
} else {
$('.projectOpt').addClass('hidden');
$('.forecastOpt').addClass('hidden');
};
}

// Async function that depends on createDataAccessExpType
// !!!!!!add elseif when radio region and subdomain increase!!!!!!
async function createDataAccessAll(regSubdom) {
Expand All @@ -57,6 +74,9 @@ async function createDataAccessAll(regSubdom) {
await createDataAccessExpType(region,subdomain);
experiment_type = $('#expTypeDataQuery').val();

// turn on/off forecast/projection related options
resetOptionVisibility(experiment_type)

// create options below experiement type and above variables
await createDataAccessOthers(region,subdomain,experiment_type);
}
Expand Down Expand Up @@ -205,18 +225,7 @@ $('#expTypeDataQuery').on('change', function() {
createDataAccessOthers(region,subdomain,$(this).val());

// turn on/off forecast/projection related options
if (experiment_type.includes('forecast')) {
// creating the initialDate options needed!!!!!
$('.forecastOpt').removeClass('hidden');
$('.projectOpt').addClass('hidden');
} else if (experiment_type.includes('projection')) {
$('.projectOpt').removeClass('hidden');
$('.forecastOpt').addClass('hidden');
} else {
$('.projectOpt').addClass('hidden');
$('.forecastOpt').addClass('hidden');
};

resetOptionVisibility(experiment_type)

});

Expand Down

0 comments on commit c574233

Please sign in to comment.