Added task search for reclaim and toggl
This commit is contained in:
@@ -179,7 +179,6 @@ def start_task(
|
|||||||
return
|
return
|
||||||
|
|
||||||
toggl_handler.start_task(task.name, reclaim_handler.get_project(task))
|
toggl_handler.start_task(task.name, reclaim_handler.get_project(task))
|
||||||
reclaim_handler.start_task(task)
|
|
||||||
print(f"Started task {task.name}")
|
print(f"Started task {task.name}")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime, date, timedelta
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Dict
|
from typing import List, Dict
|
||||||
|
|
||||||
@@ -32,12 +32,14 @@ def get_project(task: ReclaimTask):
|
|||||||
return task.name.split(" ")[0]
|
return task.name.split(" ")[0]
|
||||||
|
|
||||||
|
|
||||||
def get_events(since_days: int = 1):
|
def get_events_since(since_days: int = 1):
|
||||||
return ReclaimTaskEvent.search()
|
date_now = datetime.now(tz.tzutc()).date()
|
||||||
|
date_since = date_now - timedelta(days=since_days)
|
||||||
|
return ReclaimTaskEvent.search(date_since, date_now)
|
||||||
|
|
||||||
|
|
||||||
def start_task(task: ReclaimTask):
|
def get_events_date_range(from_date: date, to_date: date):
|
||||||
task.prioritize()
|
return ReclaimTaskEvent.search(from_date, to_date)
|
||||||
|
|
||||||
|
|
||||||
def create_reaclaim_task_from_dict(params: Dict):
|
def create_reaclaim_task_from_dict(params: Dict):
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import difflib
|
import difflib
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta, date
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import tomllib
|
import tomllib
|
||||||
|
|
||||||
@@ -32,7 +32,13 @@ def get_time_entry(time_entry_id: int):
|
|||||||
return toggl_python.TimeEntries(auth=auth).retrieve(time_entry_id)
|
return toggl_python.TimeEntries(auth=auth).retrieve(time_entry_id)
|
||||||
|
|
||||||
|
|
||||||
def get_time_entries(since_days: int = 30):
|
def get_time_entries_date_range(from_date: date, to_date: date):
|
||||||
|
return toggl_python.TimeEntries(auth=auth).list(
|
||||||
|
start_date=from_date.isoformat(), end_date=to_date.isoformat()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_time_entries_since(since_days: int = 30):
|
||||||
if since_days > 90:
|
if since_days > 90:
|
||||||
raise ValueError("since_days can't be more than 90 days")
|
raise ValueError("since_days can't be more than 90 days")
|
||||||
time_stamp = int((datetime.now() - timedelta(days=since_days)).timestamp())
|
time_stamp = int((datetime.now() - timedelta(days=since_days)).timestamp())
|
||||||
|
|||||||
Reference in New Issue
Block a user