Skip to content

Commit

Permalink
check hourly dates are valid
Browse files Browse the repository at this point in the history
  • Loading branch information
lauracosta committed Feb 8, 2024
1 parent 389d365 commit 533c8be
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions pointStatisticsWidget/pointStatisticsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,14 @@ Crit3DPointStatisticsWidget::Crit3DPointStatisticsWidget(bool isGrid, Crit3DMete
if (this->meteoPoints[n].id == jointStationsMyMp[j].toStdString())
{
jointStationsSelected.addItem(QString::fromStdString(this->meteoPoints[n].id)+" "+QString::fromStdString(this->meteoPoints[n].name));
meteoPointsDbHandler->loadDailyData(getCrit3DDate(firstDaily), getCrit3DDate(lastDaily), &(this->meteoPoints[n]));
meteoPointsDbHandler->loadHourlyData(getCrit3DDate(firstHourly.date()), getCrit3DDate(lastHourly.date()), &(this->meteoPoints[n]));
if (firstDaily.isValid() && lastDaily.isValid())
{
meteoPointsDbHandler->loadDailyData(getCrit3DDate(firstDaily), getCrit3DDate(lastDaily), &(this->meteoPoints[n]));
}
if (firstHourly.isValid() && lastHourly.isValid())
{
meteoPointsDbHandler->loadHourlyData(getCrit3DDate(firstHourly.date()), getCrit3DDate(lastHourly.date()), &(this->meteoPoints[n]));
}
break;
}
}
Expand Down Expand Up @@ -1810,8 +1816,14 @@ void Crit3DPointStatisticsWidget::addStationClicked()

QDateTime firstHourly = meteoPointsDbHandler->getFirstDate(hourly, newId);
QDateTime lastHourly = meteoPointsDbHandler->getLastDate(hourly, newId);
meteoPointsDbHandler->loadDailyData(getCrit3DDate(firstDaily), getCrit3DDate(lastDaily), &meteoPoints[indexMp]);
meteoPointsDbHandler->loadHourlyData(getCrit3DDate(firstHourly.date()), getCrit3DDate(lastHourly.date()), &meteoPoints[indexMp]);
if (firstDaily.isValid() && lastDaily.isValid())
{
meteoPointsDbHandler->loadDailyData(getCrit3DDate(firstDaily), getCrit3DDate(lastDaily), &meteoPoints[indexMp]);
}
if (firstHourly.isValid() && lastHourly.isValid())
{
meteoPointsDbHandler->loadHourlyData(getCrit3DDate(firstHourly.date()), getCrit3DDate(lastHourly.date()), &meteoPoints[indexMp]);
}
updateYears();
}

Expand Down

0 comments on commit 533c8be

Please sign in to comment.