Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 15b6b26

Browse files
Merge pull request #423 from mahiuchun/master
Fixed getStatsReport
2 parents b85a94f + 7fd7d18 commit 15b6b26

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/web_app/js/stats.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ function extractStat(stats, statObj, statName) {
4343
// |statName| (if specified), and value |statVal| (if specified). Return
4444
// undef if not present.
4545
function getStatsReport(stats, statObj, statName, statVal) {
46+
var result = null;
4647
if (stats) {
47-
for (var stat in stats) {
48-
var report = stats[stat];
48+
stats.forEach(function(report, stat) {
4949
if (report.type === statObj) {
5050
var found = true;
5151
// If |statName| is present, ensure |report| has that stat.
@@ -55,11 +55,12 @@ function getStatsReport(stats, statObj, statName, statVal) {
5555
found = (statVal !== undefined) ? (val === statVal) : val;
5656
}
5757
if (found) {
58-
return report;
58+
result = report;
5959
}
6060
}
61-
}
61+
});
6262
}
63+
return result;
6364
}
6465

6566
// Takes two stats reports and determines the rate based on two counter readings

0 commit comments

Comments
 (0)