Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/derived achievements in important information #1090

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

dhenkel92
Copy link
Member

No description provided.

@realmayus realmayus had a problem deploying to backend-feat-derived-ac-ah7edr May 23, 2024 15:35 Failure
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch 3 times, most recently from aab1189 to d52992e Compare May 29, 2024 18:22
@@ -67,7 +67,7 @@ async function _createAchievement<ID extends ActionID>(currentTemplate: achievem
// Consequently, the screening process would trigger the creation of the Onboarding achievement, implying several steps that are inappropriate for the student.
// 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) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea if this will break anything. Need to check.

graphql/user/fields.ts Outdated Show resolved Hide resolved
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch from c6e3d33 to 0cfdc3f Compare June 2, 2024 21:59
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch 2 times, most recently from e3200d3 to b1e29e1 Compare June 18, 2024 18:04
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch from b1e29e1 to 32415fc Compare August 16, 2024 11:59
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch from 32415fc to 8ad1771 Compare September 8, 2024 13:49
@dhenkel92 dhenkel92 temporarily deployed to backend-feat-derived-ac-mqgaot September 8, 2024 14:21 Inactive
@dhenkel92 dhenkel92 had a problem deploying to backend-feat-derived-ac-mqgaot September 8, 2024 16:49 Failure
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch from af9e8d0 to 723cc50 Compare September 8, 2024 17:55
@dhenkel92 dhenkel92 had a problem deploying to backend-feat-derived-ac-mqgaot September 8, 2024 17:55 Failure
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch from 723cc50 to 8f67f13 Compare September 8, 2024 17:58
@dhenkel92 dhenkel92 had a problem deploying to backend-feat-derived-ac-mqgaot September 8, 2024 17:58 Failure
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch from 8f67f13 to bc9af4a Compare September 8, 2024 18:04
@dhenkel92 dhenkel92 temporarily deployed to backend-feat-derived-ac-mqgaot September 8, 2024 18:04 Inactive
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch from bc9af4a to 5150828 Compare September 8, 2024 18:15
@dhenkel92 dhenkel92 temporarily deployed to backend-feat-derived-ac-mqgaot September 8, 2024 18:16 Inactive
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch from 5150828 to 3e254be Compare September 11, 2024 10:13
@dhenkel92 dhenkel92 temporarily deployed to backend-feat-derived-ac-mqgaot September 11, 2024 10:14 Inactive
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch from 3e254be to f1252a5 Compare September 11, 2024 18:07
@dhenkel92 dhenkel92 temporarily deployed to backend-feat-derived-ac-mqgaot September 11, 2024 18:08 Inactive
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch from f1252a5 to dbfb1f0 Compare September 11, 2024 18:28
@dhenkel92 dhenkel92 temporarily deployed to backend-feat-derived-ac-mqgaot September 11, 2024 18:28 Inactive
@dhenkel92
Copy link
Member Author

You can test it here

https://user-app-revert-achieve-m8qo7z.herokuapp.com/start

This is the frontend PR

corona-school/user-app#546

@Jonasdoubleyou Jonasdoubleyou marked this pull request as ready for review September 11, 2024 19:01
Copy link
Member

@Jonasdoubleyou Jonasdoubleyou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall!

});
}

console.log('iso', hasRequest, hasSuccessfulScreening, achievement);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm

context: ctx,
recordValue: null,
achievedAt: new Date(),
// achievedAt: hasRequest || achievement ? new Date() : null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.count(...) might be faster.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

if (successfulScreenings.length > 0) {
ctx.lastScreeningDate = successfulScreenings[0].updatedAt.toISOString();
}
// This case happens when the student just registered and had a successful screening
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: pupil


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({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

ctx: StudentNewMatchGhostContext
): Promise<achievement_with_template[]> {
const result: achievement_with_template[] = [];
// Generating a ramdom relation to be able to show multiple sequences of this kind in parallel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: ramdom

@@ -156,6 +162,9 @@ const assembleAchievementData = async (userAchievements: achievements_with_templ
where: { group: userAchievements[currentAchievementIndex].template.group, isActive: true },
orderBy: { groupOrder: 'asc' },
});
const derivedTemplates = deriveAchievementTemplates(userAchievements[currentAchievementIndex].template.group);
achievementTemplates.push(...derivedTemplates);
achievementTemplates.sort((left, right) => left.groupOrder - right.groupOrder);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks strange - shouldn't it sort by group AND groupOrder? Or why by groupOrder?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because in this case all achievements in the list are of the same group

common/notification/actions.ts Show resolved Hide resolved
@@ -602,6 +610,20 @@ const _notificationActions = {
appointment: sampleAppointment,
},
},
pupil_create_new_match_chat: {
description: 'User has clicked on new chat with a match partner',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tutee / Created a new chat with a match partner

},
},
student_create_new_match_chat: {
description: 'User has clicked on new chat with a match partner',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tutor / Created a new chat with a match partner

The descriptions show up in the Retool UI, maybe good to distinguish them

@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch from dbfb1f0 to 550600b Compare September 14, 2024 13:13
@dhenkel92 dhenkel92 temporarily deployed to backend-feat-derived-ac-mqgaot September 14, 2024 13:13 Inactive
@dhenkel92 dhenkel92 force-pushed the feat/derived-achievements-in-important-information branch from 550600b to a816211 Compare October 20, 2024 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants