Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/tasksmodel.cpp
Show First 20 Lines • Show All 818 Lines • ▼ Show 20 Line(s) | 802 | case SortActivity: { | |||
---|---|---|---|---|---|
819 | 819 | | |||
820 | if (!rightActivities.isEmpty()) { | 820 | if (!rightActivities.isEmpty()) { | ||
821 | foreach(const QString& activity, rightActivities) { | 821 | foreach(const QString& activity, rightActivities) { | ||
822 | rightScore += activityTaskCounts[activity]; | 822 | rightScore += activityTaskCounts[activity]; | ||
823 | } | 823 | } | ||
824 | } | 824 | } | ||
825 | 825 | | |||
826 | if (leftScore == -1 || rightScore == -1) { | 826 | if (leftScore == -1 || rightScore == -1) { | ||
827 | const QList<int> &counts = activityTaskCounts.values(); | 827 | const int sumScore = std::accumulate(activityTaskCounts.constBegin(), activityTaskCounts.constEnd(), 0); | ||
828 | const int sumScore = std::accumulate(counts.begin(), counts.end(), 0); | | |||
829 | 828 | | |||
830 | if (leftScore == -1) { | 829 | if (leftScore == -1) { | ||
831 | leftScore = sumScore; | 830 | leftScore = sumScore; | ||
832 | } | 831 | } | ||
833 | 832 | | |||
834 | if (rightScore == -1) { | 833 | if (rightScore == -1) { | ||
835 | rightScore = sumScore; | 834 | rightScore = sumScore; | ||
836 | } | 835 | } | ||
▲ Show 20 Lines • Show All 918 Lines • Show Last 20 Lines |