Skip to content
Snippets Groups Projects
Commit dfe24496 authored by Bhabesh Bhabani Mukhopadhyay's avatar Bhabesh Bhabani Mukhopadhyay
Browse files

List of special weather stations as constant

Special weather stations maintained in global JSON Objects so that data redundancy can reduce
parent 5761189d
No related branches found
No related tags found
No related merge requests found
......@@ -61,12 +61,35 @@
var dateYesterday = getAdjustDate(dateToday,1);
var strEndDate = JSON.stringify(dateToday).substring(1,11);
var CON_idSpecial = {
"Helgøy" : "536"
, "Skiftun" : "537"
}
/* Page onload function */
$(function(){
/* Calendar will not accept future dates including today */
document.getElementById('idTxtDateInput').setAttribute("max", JSON.stringify(dateYesterday).substring(1,11));
$('#idTxtDateInput').removeClass('hasDatepicker');
});
/* Function for check whether the choosed weather station is within special category (e.g. devis) */
function isSpecialWeatherStation(paramStationId)
{
var result = false;
$.each( CON_idSpecial, function( key, value ) {
if (paramStationId === value)
{
result = true;
return false; // exit the each loop
}
});
return result;
}
/* Function works on date picker onClose event */
function funDtPickerHeatSum()
{
......@@ -92,10 +115,7 @@
var startDate = new Date($('#idTxtDateInput').val());
if(
varWeatherId === '536' ||
varWeatherId === '537'
)
if(isSpecialWeatherStation(varWeatherId))
{
strStartDate = JSON.stringify(getAdjustDate(startDate, 2 )).substring(1,11);
jsonParamUrlData = getWeatherDataUrlParam(varWeatherId, strStartDate, strEndDate, varElementMeasurementTypes, varLogInIntervalHourly, CONST_TIMEZONE);
......@@ -161,10 +181,7 @@
var dateStartDate = getAdjustDate(dateToday,radioDaysValue);
var strStartDate = JSON.stringify(dateStartDate).substring(1,11);
if(
varWeatherId === '536' ||
varWeatherId === '537'
)
if(isSpecialWeatherStation(varWeatherId))
{
var dateStartDate02 = getAdjustDate(dateToday, (parseInt(radioDaysValue) + 1));
strStartDate = JSON.stringify(dateStartDate02).substring(1,11);
......@@ -188,10 +205,7 @@
var jsonParamUrlDataHourly = '';
if(
varWeatherId === '536' ||
varWeatherId === '537'
)
if(isSpecialWeatherStation(varWeatherId))
{
jsonParamUrlDataHourly = {
logInterval : paramLogInInterval,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment