mirror of https://github.com/BOINC/boinc.git
- 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 svn path=/trunk/boinc/; revision=22722
This commit is contained in:
parent
e427578f05
commit
b179bf37d0
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue