Search code examples
javascriptangularjsnode.jsrediskue

How to execute code after missing a scheduled event?


I'm building a MEAN roll call app, where a professor opens the app and if there's a class to be taught, he's able to click on it and a lost of the enrolled students shows up. The professor can then mark each student present and click on a "Start class button", after which, any unchecked student and their supervisor gets notified of the student's absence.

However, my trouble is with marking a teacher absent when they do not show up which means they don't even open the app.

The app sets a class schedule, so it knows there should be a lecture on Mondays from 8am to 10am for example, but it has no calendar functionality.

The way I've currently implemented it in node is that when I create the weekly class schedule, I add a notification job to a redis queue for each day the lecture is expected to take place so that when the teacher actually shows up, the notification job is deleted. If not, a notification is sent to the supervisor after the lecture is scheduled to end.

I feel like creating many jobs to run for each lecture is a bit hacky and will not scale well.

Is there a better way to implement this?

Thanks in advance


Solution

  • Assis,

    1. presist the json when you create a weekly class
    2. end of each class update the json and then check the current day is updated
    3. if not send notification to supervisor

      • queue can get messy with lot of data later as you have to pass through the messages