Skip to content

Commit c16a638

Browse files
committed
fix: remove minTs
1 parent 2170fcc commit c16a638

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
@@ -406,7 +406,7 @@ module.exports = {
406406
* @returns {Promise<Array<{release: string, timestamp: number, newEventsCount: number, commitsCount: number, filesCount: number}>>}
407407
*/
408408
async releases(project) {
409-
const releasesCol = mongo.databases.events.collection('releases');
409+
const releasesCollection = mongo.databases.events.collection('releases');
410410

411411
const pipeline = [
412412
{ $match: { projectId: project._id.toString() } },
@@ -425,7 +425,6 @@ module.exports = {
425425
_releaseIdSec: { $floor: { $divide: [ { $toLong: { $toDate: '$_id' } }, 1000] } },
426426
},
427427
},
428-
{ $match: { release: { $ne: '' } } },
429428
{
430429
$lookup: {
431430
from: 'events:' + project._id,
@@ -448,7 +447,6 @@ module.exports = {
448447
{
449448
$group: {
450449
_id: null,
451-
minTs: { $min: '$timestamp' },
452450
count: { $sum: 1 },
453451
},
454452
},
@@ -463,15 +461,13 @@ module.exports = {
463461
commitsCount: 1,
464462
filesCount: 1,
465463
newEventsCount: { $ifNull: [ { $arrayElemAt: ['$eventAgg.count', 0] }, 0] },
466-
timestamp: {
467-
$ifNull: [ { $arrayElemAt: ['$eventAgg.minTs', 0] }, '$_releaseIdSec'],
468-
},
464+
timestamp: '$_releaseIdSec',
469465
},
470466
},
471-
{ $sort: { timestamp: -1 } },
467+
{ $sort: { _id: -1 } },
472468
];
473469

474-
const cursor = releasesCol.aggregate(pipeline);
470+
const cursor = releasesCollection.aggregate(pipeline);
475471
const result = await cursor.toArray();
476472

477473
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)