Skip to content

Commit db161e3

Browse files
authored
Preventing duplication of groups/projects
1 parent ec5ca47 commit db161e3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/models/reportCollection.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const Base = require('./base');
2+
let projlist = [];
23

34
class reportCollection extends Base {
45
constructor(config) {
@@ -12,12 +13,14 @@ class reportCollection extends Base {
1213
}
1314

1415
push(report) {
15-
this.reports.push(report);
16+
if (projlist.indexOf(report.project.name) === -1) {
17+
projlist.push(report.project.name);
18+
this.reports.push(report);
19+
}
1620
}
17-
1821
get length() {
1922
return this.reports.length;
2023
}
2124
}
2225

23-
module.exports = reportCollection;
26+
module.exports = reportCollection;

0 commit comments

Comments
 (0)