scheduler.inactivity_courses

Handle the inactivity for a course.

Module Contents

scheduler.inactivity_courses.create_job(course_id, time_not_active)

Call all the methods that are needs to check the inactivity.

Parameters
  • course_id (int) – Id of the course the inactivity needs to be checked for.

  • time_not_active (int) – Time interval the inactivity needs to be checked for.

scheduler.inactivity_courses.calculate_date(date_today, time_not_active)

Calculate the date since when the inactivity needs to be checked for.

Parameters
  • date_today (date) – Today’s date.

  • time_not_active (int) – Number of days of inactivity.

Returns

Date that a message should be sent.

Return type

int

scheduler.inactivity_courses.students_not_viewed(students, list_viewed)

Determine which students need to be send a message.

Parameters
  • students (list(str)) – List of the enrolled students.

  • list_viewed (list(str)) – List of the students who have viewed a course

Returns

A list of student ids.

Return type

list(str)

scheduler.inactivity_courses.get_message(course_name, time_not_active)

Format the message that needs to be send.

Parameters
  • course_name (str) – The name of the course.

  • time_not_active (int) – Time that a student has not been active.

Returns

Message to be send to users.

Return type

str

scheduler.inactivity_courses.send_message(students, message)

Loop over the list of student ids, and send a message to every student in the list.

Parameters
  • students (list(str)) – List of student ids.

  • message (str) – The message that needs to be send.