aboutsummaryrefslogtreecommitdiff
path: root/src/Watcher/week_analysis.py
diff options
context:
space:
mode:
authorLibravatar Waishnav <waishnavdeore@gmail.com>2022-07-09 00:11:48 +0530
committerLibravatar Waishnav <waishnavdeore@gmail.com>2022-07-09 00:11:48 +0530
commitf0e484878af5b86b723de6af5f506f8b18e66ddc (patch)
tree0e688955119acf9598a85fdcba77ce21c104b327 /src/Watcher/week_analysis.py
parent255487a34700d6790a2771a177c16991caaca72f (diff)
parentac79bbea7b113613bf160512064b8e2478181db9 (diff)
downloadshopno-os-log-sync-f0e484878af5b86b723de6af5f506f8b18e66ddc.tar.gz
shopno-os-log-sync-f0e484878af5b86b723de6af5f506f8b18e66ddc.zip
Update 1.2 | AFK feature | New algorithm to update log file at each second
Diffstat (limited to 'src/Watcher/week_analysis.py')
-rwxr-xr-xsrc/Watcher/week_analysis.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/Watcher/week_analysis.py b/src/Watcher/week_analysis.py
deleted file mode 100755
index a82b5f3..0000000
--- a/src/Watcher/week_analysis.py
+++ /dev/null
@@ -1,46 +0,0 @@
-import os
-import csv
-import datetime
-import report_creation as rc
-import time_operations as to
-
-def get_dates():
- theday = datetime.date.today()
- weekday = theday.isoweekday() - 1
- # The start of the week
- start = theday - datetime.timedelta(days=weekday)
- # build a simple range
- dates = [start + datetime.timedelta(days=d) for d in range(weekday + 1)]
- dates = [str(d) for d in dates]
-
- return dates
-
-def weekday_from_date(date):
- day = os.popen('''date -d "'''+ date + '''" +%a''').read()
- return day[0:-1]
-
-W_Y = os.popen('''date +"W%V-%Y"''').read()[0:-1]
-user = os.getlogin()
-filename = "/home/"+user+"/.cache/Watcher/Analysis/"+W_Y+".csv"
-with open(filename, "w") as csvfile:
- csvwriter = csv.writer(csvfile, delimiter='\t')
- #csvwriter.writerow(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"])
- dates = get_dates()
-
- window_opened = list()
- time_spent = list()
- for i in dates:
- window_opened, time_spent = rc.extract_data(i)
- Total_screen_time = "00:00:00"
- for x, y in rc.final_report(window_opened, time_spent).items():
- Total_screen_time = to.time_addition(y, Total_screen_time)
-
- csvwriter.writerow([weekday_from_date(i), Total_screen_time])
-
- for i in dates:
- x, y = rc.extract_data(str(i))
- window_opened += x
- time_spent += y
- for x, y in rc.final_report(window_opened, time_spent).items():
- csvwriter.writerow([y, x])
-