This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
points.py
50 lines (33 loc) · 1.45 KB
/
points.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
from tierscore import ProblemTracker
import datetime
from webscraper import Webscraper
#problemtracker = ProblemTracker()
#newArray = problemtracker.getArray()
#points = problemtracker.calculate_user_score()
class pointSystem:
def sendReminder(self,userName):
problemtracker = ProblemTracker(userName)
newArray = problemtracker.getArray()
self.points = problemtracker.calculate_user_score()
timeStamp = float(newArray[0].returnTime()) # or int(newArray[0].returnTime()) if it's an integer string
dt_object = datetime.datetime.fromtimestamp(timeStamp)
currentTime = datetime.datetime.now()
time_difference = currentTime - dt_object
days_difference = time_difference.days
reminder = "It's been over 24 hours. Why not practice some LeetCode?"
if days_difference >= 1:
return reminder
#After a day call this method
count = 0
def pointsOnTime(self,points, count):
timeStamp = float(self.newArray[0].returnTime())
dt_object = datetime.datetime.fromtimestamp(timeStamp)
currentTime = datetime.datetime.now()
time_difference = currentTime - dt_object
days_difference = time_difference.days
if days_difference <= 1:
count = count + 1
if count == 3:
count = 0
points = points + 1
return points