@duvdu-v1/duvdu 1.1.245 → 1.1.246
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -36,7 +36,6 @@ const updateRankForUser = (userId) => __awaiter(void 0, void 0, void 0, function
|
|
|
36
36
|
projectsCount: -1
|
|
37
37
|
})
|
|
38
38
|
.exec();
|
|
39
|
-
console.log('currentRank', currentRank);
|
|
40
39
|
// Find next possible rank
|
|
41
40
|
const nextRank = yield ranks_model_1.Rank.findOne({
|
|
42
41
|
$or: [
|
|
@@ -52,7 +51,6 @@ const updateRankForUser = (userId) => __awaiter(void 0, void 0, void 0, function
|
|
|
52
51
|
projectsCount: 1
|
|
53
52
|
})
|
|
54
53
|
.exec();
|
|
55
|
-
console.log('nextRank', nextRank);
|
|
56
54
|
if (currentRank) {
|
|
57
55
|
user.rank.title = currentRank.rank;
|
|
58
56
|
user.rank.color = currentRank.color;
|
|
@@ -76,6 +74,7 @@ const updateRankForUser = (userId) => __awaiter(void 0, void 0, void 0, function
|
|
|
76
74
|
const progress = criteriaProgress
|
|
77
75
|
.filter(c => c.needed > 0)
|
|
78
76
|
.map(c => (c.completed / c.needed) * 100);
|
|
77
|
+
console.log('progress', progress);
|
|
79
78
|
user.rank.nextRangPercentage = progress.length ? Math.max(...progress) : 0;
|
|
80
79
|
user.rank.nextRankTitle = nextRank.rank;
|
|
81
80
|
}
|
|
@@ -126,7 +125,6 @@ const recalculateAllUsersRanks = () => __awaiter(void 0, void 0, void 0, functio
|
|
|
126
125
|
projectsCount: -1
|
|
127
126
|
})
|
|
128
127
|
.exec();
|
|
129
|
-
console.log('currentRank', currentRank);
|
|
130
128
|
// Find next possible rank
|
|
131
129
|
const nextRank = yield ranks_model_1.Rank.findOne({
|
|
132
130
|
$or: [
|
|
@@ -142,7 +140,6 @@ const recalculateAllUsersRanks = () => __awaiter(void 0, void 0, void 0, functio
|
|
|
142
140
|
projectsCount: 1
|
|
143
141
|
})
|
|
144
142
|
.exec();
|
|
145
|
-
console.log('nextRank', nextRank);
|
|
146
143
|
if (currentRank) {
|
|
147
144
|
user.rank.title = currentRank.rank;
|
|
148
145
|
user.rank.color = currentRank.color;
|
|
@@ -162,10 +159,13 @@ const recalculateAllUsersRanks = () => __awaiter(void 0, void 0, void 0, functio
|
|
|
162
159
|
needed: nextRank.projectsCount - currentRank.projectsCount
|
|
163
160
|
}
|
|
164
161
|
];
|
|
162
|
+
console.log('criteriaProgress', criteriaProgress);
|
|
165
163
|
// Find the criterion with the highest progress percentage
|
|
166
164
|
const progress = criteriaProgress
|
|
167
165
|
.filter(c => c.needed > 0)
|
|
168
166
|
.map(c => (c.completed / c.needed) * 100);
|
|
167
|
+
console.log('progress', progress);
|
|
168
|
+
console.log('progress.length', progress.length ? Math.max(...progress) : 0);
|
|
169
169
|
user.rank.nextRangPercentage = progress.length ? Math.max(...progress) : 0;
|
|
170
170
|
user.rank.nextRankTitle = nextRank.rank;
|
|
171
171
|
}
|