Exclude Journal in calculating last day of Overview graph

This deals with notes that may be entered for future dates
  and which should not affect the Overview graphs.
This commit is contained in:
Guy Scharf 2020-07-06 11:51:09 -07:00
parent ed1871215e
commit 47c8ece333
2 changed files with 6 additions and 2 deletions

View File

@ -1868,7 +1868,7 @@ QDate Profile::FirstDay(MachineType mt)
return m_last;
}
// Lookup last day record of the specified machine type, or return the first day overall if MT_UNKNOWN
// Lookup last day record of the specified machine type, or return the last day overall if MT_UNKNOWN
QDate Profile::LastDay(MachineType mt)
{
if ((mt == MT_UNKNOWN) || (!m_last.isValid()) || (!m_first.isValid())) {

View File

@ -467,7 +467,11 @@ void Overview::on_rangeCombo_activated(int index)
ui->dateStart->setMinimumDate(p_profile->FirstDay()); // first and last dates for ANY machine type
ui->dateEnd->setMaximumDate(p_profile->LastDay());
QDate end = p_profile->LastDay();
// Exclude Journal in calculating the last day
QDate end = p_profile->LastDay(MT_CPAP);
end = max(end, p_profile->LastDay(MT_OXIMETER));
end = max(end, p_profile->LastDay(MT_POSITION));
end = max(end, p_profile->LastDay(MT_SLEEPSTAGE));
QDate start;
if (index == 8) { // Custom