Feedback page: results, responses, who hasn't answered, reminders (2.1.0)
- Supervisor -> Feedback (supervisors and admins, campus-scoped): every event's form with answered of asked, response rate, average rating and last reminder; per event the results per question (with the AI summary), each response, and on named forms who was asked and who has answered. - Remind those who haven't answered (or one person on a named form): a fresh link, plus the form to anyone eligible who hasn't had it; nobody gets the form or a reminder twice within 24 hours. The 3-day job is unchanged. - Anonymous forms show no names and no list of who has answered. - FeedbackInvite.reminderCount (migration 20261103120000_feedback_reminders); access log action feedback_responses; help page; dashboard and Ctrl+K links. - Roadmap: the AI helpers on the privacy pages are dropped; 2.1.0 is the feedback page. - Tests: tests/feedbackPage.test.ts, e2e/feedback.spec.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -245,6 +245,27 @@ async function seed(url) {
|
||||
await prisma.securityEvent.create({ data: { userId: toWarn.id, type: 'login', createdAt: new Date(Date.now() - 3 * 365 * 24 * 60 * 60 * 1000) } });
|
||||
return { toWarn: toWarn.id, toAnonymise: toAnonymise.id };
|
||||
})(),
|
||||
// 2.1.0 Feedback page: a named form on the past event, sent two days ago to Thandi (the
|
||||
// seeded user, who answers in the test) and Lerato (who doesn't). The links' tokens.
|
||||
feedback: await (async () => {
|
||||
const { hashToken } = require(path.join(backend, 'src/utils/feedback'));
|
||||
const twoDaysAgo = new Date(Date.now() - 2 * 24 * 60 * 60 * 1000);
|
||||
const form = await prisma.feedbackForm.create({
|
||||
data: {
|
||||
eventId: pastEvent.id, audience: 'all', anonymous: false, sendAt: twoDaysAgo, sentAt: twoDaysAgo,
|
||||
fields: { create: [
|
||||
{ type: 'rating', label: 'How was the service?', isRequired: true, order: 0 },
|
||||
{ type: 'text', label: 'What should we keep doing?', order: 1 },
|
||||
] },
|
||||
},
|
||||
});
|
||||
const tokens = { user: 'e2e-feedback-thandi-token', late: 'e2e-feedback-lerato-token' };
|
||||
await prisma.feedbackInvite.createMany({ data: [
|
||||
{ formId: form.id, userId: users.user.id, tokenHash: hashToken(tokens.user), sentAt: twoDaysAgo },
|
||||
{ formId: form.id, userId: latecomer.id, tokenHash: hashToken(tokens.late), sentAt: twoDaysAgo },
|
||||
] });
|
||||
return { tokens };
|
||||
})(),
|
||||
// The link a news email to the seeded user would carry (signed with JWT_SECRET).
|
||||
unsubscribeToken: require(path.join(backend, 'src/utils/privacy')).unsubscribeToken({ userId: users.user.id }),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user