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
Fixing Alerts flow #836
Fixing Alerts flow #836
Conversation
- Need 2 alert GET calls for some reason in order to fetch back the new alerts list - Pass correct AlertModel type to service - Fetch 'stafflist` relation on queue so that `checkIsOpen` works
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/sandboxneu/office-hours/FhGThhkgzpqiBsJmAbzCsKACMq2z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting this 🙏 🙏
I manual tested it some, looks good as far as i can tell!
@@ -136,6 +142,21 @@ export default function TAQueueDetailButtons({ | |||
return [true, "Help Student"]; | |||
} | |||
})(); | |||
const [canRephrase, rephraseTooltip] = ((): [boolean, string] => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merged the two ternaries into this pair. kinda just followed the same pattern as [canHelp, helpTooltip]
, but do lmk if there's a better way to organize them
], | ||
exports: [QueueCleanService, QueueSSEService], | ||
imports: [SSEModule], | ||
imports: [SSEModule, AlertsModule], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im boomer, AlertsModule
needs to be added/kept here right? for dependencies and stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh i see the problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so? I forget bc it's been a while since I've used worked with these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea i think we do in order to inject the AlertsService
I added
I don't know if we can do much about this, but the alert is resolved when the question modal pops up -- not when the person closes out of the question modal. So it can result in some weird scenarios like this (asking a student to resolve their question again as they are trying to address their previous question). |
Hmm I think we can maybe consider that as just people using the app incorrectly - it doesn't seem all that likely that a TA will be impatient enough to ask a student to requestion while the student is still editing Unless Vera is really gung ho to do some refactoring of our alerts architecture lol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, everything seems to work nicely!
Some really minor nits, but otherwise it's good! Thanks for picking up this ticket!
user, | ||
resolved: null, | ||
}, | ||
}); | ||
return { alerts: await this.alertsService.removeStaleAlerts(alerts) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to your PR exactly: but do we clean up alerts at night? I wonder what happens when when I ask a student to rephrase their question today, they never address it, and they open up the app tomorrow?
Maybe nothing because the questions are cleaned from the queue (and hence there will be no alerts in the ListQuestionsResponse). Do we want to mark alerts as Stale when closing these questions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it should be fine because theoretically this removeStaleAlerts
gets called whenever alerts are fetched. So when the student checks in the next time in the course, i think the old alerts should be culled
const alerts = await AlertModel.find({
where: {
courseId,
user,
resolved: null,
},
});
return await AlertModel.createQueryBuilder('alert') | ||
.where('alert.resolved IS NULL') | ||
.andWhere('alert.alertType = :alertType', { alertType }) | ||
.andWhere("(alert.payload ->> 'queueId')::INTEGER = :queueId ", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~fancy~
const queue = await QueueModel.findOne(payload.queueId); | ||
if (question.closedAt || !(await queue.checkIsOpen())) { | ||
console.log(`Rephrase Question alert with id ${alert.id} expired`); | ||
const queue = await QueueModel.findOne(payload.queueId, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: Why do we need to load the stafflist here? Is it to check if the queue is open?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @IrisLiu-00
iirc, i think it had smth to do with fetching correctly. related to this pr:#834
], | ||
exports: [QueueCleanService, QueueSSEService], | ||
imports: [SSEModule], | ||
imports: [SSEModule, AlertsModule], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so? I forget bc it's been a while since I've used worked with these
i have smol amount of faith the TA doesn't spam the button |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳
Description
Fixing the alerts/rephrase question flow that never got merged in before. Should allow TAs/Profs to ask students to rephrase their question multiple times. Note: the rephrase tooltip is not displayed for grouped questions cause they're grouped xd.
Closes #803
Closes #661
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe how you tested this PR (both manually and with tests)
Provide instructions so we can reproduce.
Checklist: