5 from .updateDB
import updater
6 from .models
import Student
8 from .subjectdatabase
import moodle
9 from .automation
import send_message
14 def update_database_daily():
15 all_students = Student.objects.all()
18 for student
in all_students:
19 if(student.user_type ==
"updater"):
20 token = student.moodle_token
21 subs = student.update_courses
22 subs = subs.replace(
'[',
'')
23 subs = subs.replace(
']',
'')
24 subs = subs.replace(
"'",
'')
26 subs = subs.split(
",")
33 def send_update_to_students():
34 all_students = Student.objects.all()
35 for student
in all_students:
36 subs = student.courses
37 subs = subs.replace(
'[',
'')
38 subs = subs.replace(
']',
'')
39 subs = subs.replace(
"'",
'')
40 subs = subs.split(
",")
41 phone_no = student.phone_number
42 send_notification(phone_no,subs)
49 def send_notification(phone_no,subs):
53 ass_info = d.assignment_details(sub)
54 quiz_info = d.quiz_details(sub)
55 contents = d.course_contents(sub)
56 final_message = sub +
"\n"+ ass_info + quiz_info + contents
57 send_message(final_message,phone_no)