-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathidb_visits.py
More file actions
55 lines (41 loc) · 1.63 KB
/
idb_visits.py
File metadata and controls
55 lines (41 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from abc import ABC, abstractmethod
class IVisits(ABC):
def __init__(self):
super().__init__()
@abstractmethod
def create_visit(self, student, ta, enqueue_time, visit_reason) -> int:
"""Create a database entry for the ongoing visit
between the specified student and TA.
enqueue_time should be in format "YYYY-MM-DD HH:MM:SS"
Should indicate the time the visit was created
:param student: The user ID of the student
:param ta: The user ID of the TA
:param enqueue_time: Timestamp when the student joined the queue,
in the format "YYYY-MM-DD HH:MM:SS"
:param visit_reason: Student-supplied reason for joining the queue
:return: A numeric ID representing the specific visit
"""
raise NotImplementedError()
@abstractmethod
def end_visit(self, visit_id, reason):
"""Mark in the database that the specified visit
has ended.
:param visit_id: The numeric ID representing the specific visit
:param reason: The resolution of the visit
"""
raise NotImplementedError()
@abstractmethod
def cancel_visit(self, visit_id):
""" Destroy this visit from the database if it's still in progress.
Un-dequeue this student from the queue if they have been dequeued.
:param visit_id:
:return:
"""
raise NotImplementedError()
@abstractmethod
def get_in_progress_visits(self):
""" Return all database entries for visits that have
not ended.
:return:
"""
raise NotImplementedError()