projects
/
harbour-pedalo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added new graphs
[harbour-pedalo.git]
/
src
/
statsweekdaycongestion.cpp
diff --git
a/src/statsweekdaycongestion.cpp
b/src/statsweekdaycongestion.cpp
index
685e175
..
c4842b3
100644
(file)
--- a/
src/statsweekdaycongestion.cpp
+++ b/
src/statsweekdaycongestion.cpp
@@
-5,13
+5,13
@@
StatsWeekdayCongestion::StatsWeekdayCongestion(JourneyModel * journeys) :
journeys(journeys)
{
StatsWeekdayCongestion::StatsWeekdayCongestion(JourneyModel * journeys) :
journeys(journeys)
{
- title = "Congested days (cycles passed)";
+ title = "Congestion by day (cycles per hour)";
units = "";
labels = QStringList{"M", "T", "W", "Th", "F", "S", "Su"};
}
void StatsWeekdayCongestion::update() {
units = "";
labels = QStringList{"M", "T", "W", "Th", "F", "S", "Su"};
}
void StatsWeekdayCongestion::update() {
- quint32 passed[7];
+ double passed[7];
unsigned int count[7];
int pos;
unsigned int count[7];
int pos;
@@
-26,8
+26,9
@@
void StatsWeekdayCongestion::update() {
foreach (Journey const &journey, journeys->getData()) {
QDate date = journey.getStartDate();
int dayofweek = date.dayOfWeek() - 1;
foreach (Journey const &journey, journeys->getData()) {
QDate date = journey.getStartDate();
int dayofweek = date.dayOfWeek() - 1;
+ double duration = journey.getDuration() / (60.0 * 60.0);
if (dayofweek >= 0) {
if (dayofweek >= 0) {
- passed[dayofweek] += journey.getOvertook() + journey.getOvertakenBy();
+ passed[dayofweek] += (journey.getOvertook() + journey.getOvertakenBy()) / duration;
count[dayofweek]++;
}
}
count[dayofweek]++;
}
}
@@
-44,7
+45,7
@@
void StatsWeekdayCongestion::update() {
values << result;
}
values << result;
}
- step = qRound(maxval / 5.0);
+ step = maxval > 5.0 ? qRound(maxval / 5.0) : (maxval / 5.0);
qDebug() << "Calculated values";
}
qDebug() << "Calculated values";
}