Skip to content

Commit

Permalink
feat: conduct subcourse appointment metric and mutation adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasFalkowsky committed Jan 19, 2024
1 parent b3cfa90 commit ca14256
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions common/achievement/metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ const batchOfMetrics = [
return 1;
}),

/* CONDUCTED SUBCOURSE APPOINTMENT */
createMetric('student_conducted_subcourse_appointment', ['student_joined_subcourse_meeting'], () => {
return 1;
}),
createMetric('pupil_conducted_subcourse_appointment', ['pupil_joined_subcourse_meeting'], () => {
return 1;
}),

/* REGULAR MATCH LEARNING */
createMetric('pupil_match_learned_regular', ['pupil_joined_match_meeting'], () => {
return 1;
Expand Down
5 changes: 4 additions & 1 deletion common/achievement/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ async function getTemplatesByMetrics(metricsForAction: Metric[]) {
return [];
}
for (const metric of metricsForAction) {
templatesForAction = [...templatesForAction, ...templatesByMetric.get(metric.metricName)];
const templatesForMetric = templatesByMetric.get(metric.metricName);
if (templatesForMetric) {
templatesForAction = [...templatesForAction, ...templatesForMetric];
}
}
return templatesForAction;
}
Expand Down
2 changes: 1 addition & 1 deletion graphql/achievement/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class MutateAchievementResolver {

@Mutation((returns) => Boolean)
@AuthorizedDeferred(Role.ADMIN, Role.OWNER)
async subcourseMeetingJoin(@Ctx() context: GraphQLContext, @Arg('matchId') subcourseId: number) {
async subcourseMeetingJoin(@Ctx() context: GraphQLContext, @Arg('subcourseId') subcourseId: number) {
const { user } = context;
const subcourse = await prisma.subcourse.findUnique({ where: { id: subcourseId }, include: { course: true, lecture: true } });
await hasAccess(context, 'Subcourse', subcourse);
Expand Down

0 comments on commit ca14256

Please sign in to comment.