diff --git a/checkin_notes b/checkin_notes index e7fa6c9959..dc88b998f4 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8219,3 +8219,22 @@ Charlie 19 Nov 2010 mac_installer/ PostInstall.cpp + +David 20 Nov 2010 + - client: improve the way credit history is maintained + Old: maintain list of daily records. + When add a new record, delete records older than a month + Problem: + If there's a gap in the record (e.g. because project was down) + deleting old records may result in a list that + has an entry only for today. + Data for the last month is lost. + New: + When appropriate, adjust the date of old records + rather than deleting them + + client/ + scheduler_op.cpp + + client/ + scheduler_op.cpp diff --git a/client/scheduler_op.cpp b/client/scheduler_op.cpp index ed5ab8ae24..aaf410ce78 100644 --- a/client/scheduler_op.cpp +++ b/client/scheduler_op.cpp @@ -613,13 +613,24 @@ int SCHEDULER_REPLY::parse(FILE* in, PROJECT* project) { // add new record if vector is empty or we have a new day // if (project->statistics.empty() || project->statistics.back().day!=dday()) { - - // delete old stats + double cutoff = dday() - config.save_stats_days*86400; + // delete old stats; fill in the gaps if some days missing + // while (!project->statistics.empty()) { DAILY_STATS& ds = project->statistics[0]; - if (dday() - ds.day > config.save_stats_days*86400) { - project->statistics.erase(project->statistics.begin()); + if (ds.day >= cutoff) { + break; + } + if (project->statistics.size() > 1) { + DAILY_STATS& ds2 = project->statistics[1]; + if (ds2.day <= cutoff) { + project->statistics.erase(project->statistics.begin()); + } else { + ds.day = cutoff; + break; + } } else { + ds.day = cutoff; break; } }