added chrom
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { getMoodleCourseCompletionStatus, getMoodleUserById } from "./moodle";
|
||||
import { CronJob } from "cron";
|
||||
import { DISCORD_ROLES, prisma } from "@repo/db";
|
||||
import { DISCORD_ROLES, ParticipantLog, prisma } from "@repo/db";
|
||||
import { sendCourseCompletedEmail } from "modules/mail";
|
||||
import { handleParticipantFinished } from "modules/event";
|
||||
import { eventCompleted } from "helper/events";
|
||||
import { addRolesToMember, removeRolesFromMember } from "modules/discord";
|
||||
import { JsonValueType } from "@repo/db/zod";
|
||||
|
||||
const syncMoodleIds = async () => {
|
||||
try {
|
||||
@@ -122,9 +123,23 @@ const checkUnfinishedParticipants = async () => {
|
||||
|
||||
if (completed) return;
|
||||
|
||||
if (!p.Event.discordRoleId) {
|
||||
await prisma.participant.update({
|
||||
where: {
|
||||
id: p.id,
|
||||
},
|
||||
data: {
|
||||
inscriptionWorkflowCompleted: true,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.log(
|
||||
`User ${p.User.firstname} ${p.User.lastname} - ${p.User.publicId} did not finish event ${p.Event.name}`,
|
||||
);
|
||||
if (p.User.discordAccounts[0] && p.Event.discordRoleId) {
|
||||
await addRolesToMember(p.User.discordAccounts[0].discordId, [p.Event.discordRoleId]);
|
||||
prisma.participant.update({
|
||||
await prisma.participant.update({
|
||||
where: {
|
||||
id: p.id,
|
||||
},
|
||||
@@ -135,7 +150,7 @@ const checkUnfinishedParticipants = async () => {
|
||||
event: "Discord-Rolle hinzugefügt",
|
||||
timestamp: new Date(),
|
||||
user: "system",
|
||||
},
|
||||
} as ParticipantLog as any,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -117,7 +117,7 @@ const Template = ({ event, user }: { user: User; event: Event }) => (
|
||||
<tr>
|
||||
<td style={{ textAlign: "center", padding: "20px" }}>
|
||||
{event.finishedBadges.map((badge) => (
|
||||
<Badge badge={badge} />
|
||||
<Badge key={badge} badge={badge} />
|
||||
))}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user