Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawk.api",
"version": "1.2.19",
"version": "1.2.20",
"main": "index.ts",
"license": "BUSL-1.1",
"scripts": {
Expand Down
29 changes: 12 additions & 17 deletions src/resolvers/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
const REPETITIONS_GROUP_HASH_INDEX_NAME = 'groupHash_hashed';
const REPETITIONS_USER_ID_INDEX_NAME = 'userId';
const EVENTS_TIMESTAMP_INDEX_NAME = 'timestamp';
const EVENTS_PAYLOAD_RELEASE_INDEX_NAME = 'payloadRelease';
const GROUPING_TIMESTAMP_INDEX_NAME = 'groupingTimestamp';
const GROUPING_TIMESTAMP_AND_LAST_REPETITION_TIME_AND_ID_INDEX_NAME = 'groupingTimestampAndLastRepetitionTimeAndId';
const GROUPING_TIMESTAMP_AND_GROUP_HASH_INDEX_NAME = 'groupingTimestampAndGroupHash';
Expand Down Expand Up @@ -127,6 +128,15 @@
name: GROUPING_TIMESTAMP_AND_LAST_REPETITION_TIME_AND_ID_INDEX_NAME,
});

await projectEventsCollection.createIndex({
'payload.release': 1

Check failure on line 132 in src/resolvers/project.js

View workflow job for this annotation

GitHub Actions / ESlint

Missing trailing comma
},
{
name: EVENTS_PAYLOAD_RELEASE_INDEX_NAME,
background: true,
sparse: true,
});

await projectEventsCollection.createIndex({
groupHash: 1,
},
Expand Down Expand Up @@ -503,14 +513,7 @@
{ $match: { projectId: project._id.toString() } },
{
$project: {
release: {
$convert: {
input: '$release',
to: 'string',
onError: '',
onNull: '',
},
},
release: '$release',
commitsCount: { $size: { $ifNull: ['$commits', [] ] } },
filesCount: { $size: { $ifNull: ['$files', [] ] } },
_releaseIdSec: { $floor: { $divide: [ { $toLong: { $toDate: '$_id' } }, 1000] } },
Expand All @@ -524,14 +527,7 @@
{
$match: {
$expr: {
$eq: [ {
$convert: {
input: '$payload.release',
to: 'string',
onError: '',
onNull: '',
},
}, '$$rel'],
$eq: [ '$payload.release', '$$rel' ],

Check failure on line 530 in src/resolvers/project.js

View workflow job for this annotation

GitHub Actions / ESlint

There should be no space before ']'

Check failure on line 530 in src/resolvers/project.js

View workflow job for this annotation

GitHub Actions / ESlint

There should be no space after '['
},
},
},
Expand Down Expand Up @@ -594,7 +590,6 @@
uploadDate: fileInfo.uploadDate,
} ])
);

enrichedFiles = enrichedFiles.map((entry) => {
const meta = metaById.get(String(entry._id));

Expand Down
Loading