Skip to content

Commit d52a4d3

Browse files
committed
added real_time to csv
1 parent c7187b6 commit d52a4d3

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lash/ExtraTools/work.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,24 @@ def time_format(*args: int) -> List:
1818
else str(x), args))
1919
return fmt
2020

21-
def time_conversor(s: float) -> Tuple[str, int, str]:
21+
def time_conversor(s: float) -> Tuple[str, int]:
2222
"""
2323
Take seconds, and return it in h:m:s format.
2424
2525
x seconds -> 00:05:12
2626
2727
total_hours, total_minutes are saved in the
28-
csv database. tm to plot, th only to register.
28+
csv database. rt to plot, th only to register.
2929
3030
total_minutes is used to make a groupby using
3131
pandas when -a are inputted.
3232
"""
3333
h = int(s / 3600)
34-
total_hours = f'{(s / 3600):.2f}'
3534
total_minutes = int(s / 60)
3635
m = int(s / 60) - h * 60 # Rest
3736
s = int(s - total_minutes * 60)
3837
h, m, s = time_format(h, m, s)
39-
return f'{h}:{m}:{s}', total_minutes, total_hours
38+
return f'{h}:{m}:{s}', total_minutes
4039

4140

4241
def make_files(s, cache:str, csv:str) -> NoReturn:
@@ -66,7 +65,7 @@ def analyze(workcsv: str) -> NoReturn:
6665
set_loglevel('error') # Hide terminal warnings
6766
df = pd.read_csv(workcsv)
6867
df = df.drop(columns=['message'], axis=1)
69-
df = df.drop(columns=['hours'], axis=1)
68+
df = df.drop(columns=['real_time'], axis=1)
7069
fdf = df.groupby(['date']).sum()
7170
plt.style.use('seaborn-dark')
7271

@@ -131,12 +130,12 @@ def work(s, e, m, sv, a):
131130
date_time = datetime(cache_time['year'], cache_time['month'],
132131
cache_time['day'], cache_time['hour'], cache_time['minute'])
133132
delta = now - date_time
134-
time, total_minutes, total_hours = time_conversor(delta.total_seconds())
135-
print(f'Time worked: {time}')
133+
real_time, total_minutes = time_conversor(delta.total_seconds())
134+
print(f'Time worked: {real_time}')
136135
if sv:
137136
date = date_time.date()
138137
csv = pd.read_csv(workcsv)
139-
csv.loc[len(csv.index)] = [date, total_minutes, total_hours, m]
138+
csv.loc[len(csv.index)] = [date, total_minutes, real_time, m]
140139
with open(workcsv, 'w') as file:
141140
file.write(csv.to_csv(index=False))
142141
del_cache(cache)

0 commit comments

Comments
 (0)