Skip to content

Commit 034f5ca

Browse files
committed
Add an extra function for populating notes
1 parent 6a3c056 commit 034f5ca

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/models/report.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,38 @@ class report extends Base {
143143
return promise;
144144
}
145145

146+
/**
147+
* process all notes the given input
148+
* @param input
149+
* @param model
150+
* @param advance
151+
* @returns {*|Promise}
152+
*/
153+
processNote(input, model, advance = false) {
154+
let collect = [];
155+
156+
let promise = this.parallel(this[input], (data, done) => {
157+
158+
let item = new model(this.config, data);
159+
item.project_namespace = this.projects[item.project_id];
160+
161+
item.getNotes()
162+
.then(() => {
163+
collect.push(item);
164+
165+
if (advance) advance();
166+
return done();
167+
});
168+
169+
170+
// collect items, query times & stats
171+
collect.push();
172+
});
173+
174+
promise.then(() => this[input] = collect);
175+
return promise;
176+
}
177+
146178
/**
147179
* merge another report into this report
148180
* @param report
@@ -164,6 +196,15 @@ class report extends Base {
164196
return this.process('issues', Issue, advance);
165197
}
166198

199+
/**
200+
* process notes
201+
* @param advance
202+
* @returns {Promise}
203+
*/
204+
processNotes(advance = false) {
205+
return this.processNote('issues', Issue, advance);
206+
}
207+
167208
/**
168209
* process merge requests
169210
* @param advance

0 commit comments

Comments
 (0)