fix statistics display of months not used

This commit is contained in:
LoudSnorer 2024-07-02 11:18:34 -04:00
parent 4931e60bd5
commit 90e98ccfda

View File

@ -241,7 +241,8 @@ void Statistics::adjustRange(QDate& start , QDate& last) {
} else { } else {
last = qMin(last ,p_profile->general->statReportDate() ); last = qMin(last ,p_profile->general->statReportDate() );
} }
start = qMin(start,last); start = qMax(start,p_profile->FirstDay()); // need if less than a years samples
start = qMin(start,last); // insure start is always less than max. SHould be but???
summaryInfo.update(start,last); summaryInfo.update(start,last);
} }
@ -1399,20 +1400,16 @@ QString Statistics::GenerateCPAPUsage()
// should never get here. // should never get here.
number_periods = 12; number_periods = 12;
} }
last = lastcpap;
first = lastcpap;
} else if (p_profile->general->statReportMode() == STAT_MODE_STANDARD) { } else if (p_profile->general->statReportMode() == STAT_MODE_STANDARD) {
firstcpap = lastcpap.addYears(-1).addDays(1); firstcpap = lastcpap.addYears(-1).addDays(1);
adjustRange(firstcpap,lastcpap); adjustRange(firstcpap,lastcpap);
last = lastcpap;
first = lastcpap;
} else if (p_profile->general->statReportMode() == STAT_MODE_RANGE) { } else if (p_profile->general->statReportMode() == STAT_MODE_RANGE) {
firstcpap = p_profile->general->statReportRangeStart(); firstcpap = p_profile->general->statReportRangeStart();
lastcpap = p_profile->general->statReportRangeEnd(); lastcpap = p_profile->general->statReportRangeEnd();
adjustRange(firstcpap,lastcpap); adjustRange(firstcpap,lastcpap);
first = firstcpap;
last = lastcpap;
} }
last = lastcpap;
first = lastcpap;
QList<Period> periods; QList<Period> periods;
bool skipsection = false;; bool skipsection = false;;