-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.py
57 lines (43 loc) · 1.49 KB
/
user.py
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
56
57
class User:
def __init__(self, total_ticks, good_ticks, currentBadTicks):
self.total_ticks = total_ticks
self.good_ticks = good_ticks
self.bad_ticks = currentBadTicks
self.good_gazeTicks = 0;
self.bad_gazeTicks = 0;
self.total_gazeTicks = 0;
self.timer = 0
def to_dict(self):
percent = self.good_gazeTicks / self.total_gazeTicks
if(percent > .97):
percent = 1
return {
'good_ticks': self.good_ticks,
'bad_ticks': self.bad_ticks,
'total_ticks': self.total_ticks,
'percent_good_posture': self.good_ticks / self.total_ticks,
'percent_good_gaze': percent
}
def timer_(self):
return self.timer
def increaseTimer(self):
self.timer += 1
def resetTimer(self):
self.timer = 0
def checkTimer(self):
return self.timer == 25
def increaseGoodTick(self):
self.good_ticks += 1
def increaseGoodGazeTick(self):
self.good_gazeTicks += 1
def increaseTick(self):
self.total_ticks += 1
self.total_gazeTicks += 1;
def increaseBadPostureTick(self):
self.bad_ticks += 1
def increaseBadGazeTick(self):
self.bad_gazeTicks += 1
def resetBadTicks(self):
self.bad_ticks = 0
def postureBadForLongTime(self):
return self.bad_ticks >= 100