Feat/derived achievements in important information#1090
Open
Feat/derived achievements in important information#1090
Conversation
aab1189 to
d52992e
Compare
dhenkel92
commented
May 29, 2024
| // Thus, the line below ensures that only the current or subsequent achievement steps are created, while others are automatically bypassed. | ||
| // Note: +1 is added because the index is 0-based, while the groupOrder is 1-based. | ||
| if (nextStepIndex + 1 < currentTemplate.groupOrder) { | ||
| if (templatesForGroup[nextStepIndex].groupOrder + 1 < currentTemplate.groupOrder) { |
Member
Author
There was a problem hiding this comment.
I have no idea if this will break anything. Need to check.
dhenkel92
commented
May 29, 2024
c6e3d33 to
0cfdc3f
Compare
e3200d3 to
b1e29e1
Compare
b1e29e1 to
32415fc
Compare
32415fc to
8ad1771
Compare
af9e8d0 to
723cc50
Compare
723cc50 to
8f67f13
Compare
8f67f13 to
bc9af4a
Compare
bc9af4a to
5150828
Compare
5150828 to
3e254be
Compare
3e254be to
f1252a5
Compare
f1252a5 to
dbfb1f0
Compare
dhenkel92
commented
Sep 11, 2024
Member
Author
|
You can test it here https://user-app-revert-achieve-m8qo7z.herokuapp.com/start This is the frontend PR |
common/achievement/derive.ts
Outdated
| context: ctx, | ||
| recordValue: null, | ||
| achievedAt: new Date(), | ||
| // achievedAt: hasRequest || achievement ? new Date() : null, |
Member
There was a problem hiding this comment.
the comment looks correct?
|
|
||
| async function derivePupilMatching(user: User, pupil: Pupil, result: achievement_with_template[], userAchievements: achievement_with_template[]) { | ||
| const hasRequest = pupil.openMatchRequestCount > 0; | ||
| const successfulScreenings = await prisma.pupil_screening.findMany({ |
Member
There was a problem hiding this comment.
.count(...) might be faster.
|
|
||
| async function deriveStudentMatching(user: User, student: Student, result: achievement_with_template[], userAchievements: achievement_with_template[]) { | ||
| const hasRequest = student.openMatchRequestCount > 0; | ||
| const successfulScreenings = await prisma.screening.findMany({ |
| }); | ||
| const derivedTemplates = deriveAchievementTemplates(userAchievements[currentAchievementIndex].template.group); | ||
| achievementTemplates.push(...derivedTemplates); | ||
| achievementTemplates.sort((left, right) => left.groupOrder - right.groupOrder); |
Member
There was a problem hiding this comment.
this looks strange - shouldn't it sort by group AND groupOrder? Or why by groupOrder?
Member
Author
There was a problem hiding this comment.
Because in this case all achievements in the list are of the same group
dbfb1f0 to
550600b
Compare
550600b to
a816211
Compare
2b8e559 to
16669e1
Compare
16669e1 to
308bdaa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.