Skip to content

Commit d10533c

Browse files
committed
fix: remove minTs
1 parent 9ce0f1c commit d10533c

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/resolvers/project.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ module.exports = {
382382
* @returns {Promise<Array<{release: string, timestamp: number, newEventsCount: number, commitsCount: number, filesCount: number}>>}
383383
*/
384384
async releases(project) {
385-
const releasesCol = mongo.databases.events.collection('releases');
385+
const releasesCollection = mongo.databases.events.collection('releases');
386386

387387
const pipeline = [
388388
{ $match: { projectId: project._id.toString() } },
@@ -401,7 +401,6 @@ module.exports = {
401401
_releaseIdSec: { $floor: { $divide: [ { $toLong: { $toDate: '$_id' } }, 1000] } },
402402
},
403403
},
404-
{ $match: { release: { $ne: '' } } },
405404
{
406405
$lookup: {
407406
from: 'events:' + project._id,
@@ -424,7 +423,6 @@ module.exports = {
424423
{
425424
$group: {
426425
_id: null,
427-
minTs: { $min: '$timestamp' },
428426
count: { $sum: 1 },
429427
},
430428
},
@@ -439,15 +437,13 @@ module.exports = {
439437
commitsCount: 1,
440438
filesCount: 1,
441439
newEventsCount: { $ifNull: [ { $arrayElemAt: ['$eventAgg.count', 0] }, 0] },
442-
timestamp: {
443-
$ifNull: [ { $arrayElemAt: ['$eventAgg.minTs', 0] }, '$_releaseIdSec'],
444-
},
440+
timestamp: '$_releaseIdSec',
445441
},
446442
},
447-
{ $sort: { timestamp: -1 } },
443+
{ $sort: { _id: -1 } },
448444
];
449445

450-
const cursor = releasesCol.aggregate(pipeline);
446+
const cursor = releasesCollection.aggregate(pipeline);
451447
const result = await cursor.toArray();
452448

453449
return result;

src/typeDefs/project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ type Project {
285285
eventGroupingPatterns: [ProjectEventGroupingPattern]
286286
287287
"""
288-
List of releases with first mention timestamp and events count
288+
List of releases with unique events count, commits count and files count
289289
"""
290290
releases: [ProjectRelease!]!
291291
}

0 commit comments

Comments
 (0)