Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Cache results of completed-manager? #71

Open
Ma27 opened this issue Jan 20, 2020 · 0 comments
Open

Cache results of completed-manager? #71

Ma27 opened this issue Jan 20, 2020 · 0 comments

Comments

@Ma27
Copy link

Ma27 commented Jan 20, 2020

I'm currently using this library for a simple python-script that displays the amount of accomplished vs scheduled tasks for the current day in my desktop's status-bar.

I decided to filter completed tasks using the CompletedManager.get_all() and filter for the current day to ensure that recurring tasks are counted as well (when loading items for $day, date_completed might not be set if the item is recurring).

Unfortunately the CompletedManager directly calls the REST API and doesn't try to use the local cache first which breaks the script in case of no or weak connectivity. I actually wanted to implement this yesterday, but realized that I'm unsure what's the best approach here. I had the following ideas:

  • Introduce a new object-type completed-item (using the Item-model) which is synced after the /sync call to the API (AFAICS the sync doesn't list completed-tasks on its own or did I miss something?)

    • Cons: a lot of duplicates (all completed tasks are actually cached already) in the cache
  • Fill self.state of CompletedManager with items from the cache that were completed.

    • Con(?): last time I tried something like this, I didn't manager to detect completed recurring items.

As I'm pretty new to the codebase, I don't feel qualified to decide what's best (maybe even something totally different 😇 ).

Thus I'd be fairly happy about getting some feedback here, then I'd be willing to file a patch :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant