Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Repeating tasks #868

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

zeddo123
Copy link
Member

@zeddo123 zeddo123 commented Mar 16, 2022

Features

Code implementations

  • Adding rrules to Repeating instances.
  • Automatic update of date when repeating rules are changed (with a decorator)
  • Automatic update of timestamp when repeating is enabled.
  • Possibility of setting repeating fields through the constructor of Task (e.g Task(....., repeats_on=BOTH))
  • XML loading and saving.
  • Many others.....

I'll fill this up later

@diegogangl
Copy link
Contributor

oooohhhh I like where this is going!

@zeddo123
Copy link
Member Author

@diegogangl I'm trying to write unittests along side the new code, but I'm having issues with importing the datastore2. However this does not happen in the dev console.

>>> from GTG.core.datastore2 import Datastore2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/zeddo/Documents/github.com/zeddo123/gtg/GTG/core/datastore2.py", line 37, in <module>
    import GTG.core.info as info
ModuleNotFoundError: No module named 'GTG.core.info'
>>>

@diegogangl
Copy link
Contributor

:P I just realized I didn't write any tests for the datastore. The info file has some stuff that is filled in by Meson, so it's not available for tests unless you build (check out core/info.py.in. It kind of sucks, but one way we can do it is by mocking it in datastore2.py.

try:
    # Running the app
    import GTG.core.info as info
except ImportError:
    # Unit tests
    import mock
    info = mock.Mock()
    info.VERSION = 'v0.6'

@zeddo123 zeddo123 self-assigned this Mar 22, 2022
It's more usefull to have the next task id than having the previous
occurrence in the cases when we want to rewind the history.
@zeddo123
Copy link
Member Author

zeddo123 commented Mar 24, 2022

@diegogangl From what I have understood from the new core is that we no longer have a requester but a datastore that has a Taskstore. Will the tasks have a "pointer" to the datastore as it was the case with the previous implementation?
Before we were able to do, inside the task, self.req.get_task(). What is the alternative now?

From the point of view of repeating tasks, I need to get a certain number of tasks to get the history of occurrences.

@diegogangl
Copy link
Contributor

From the point of view of repeating tasks, I need to get a certain number of tasks to get the history of occurrences.

hmm, I hadn't considered getting other arbitrary tasks from inside a task. I guess the only solution for now is to pass the taskstore to each task.

@diegogangl
Copy link
Contributor

There's also another option, which would be to have each task emit a signal when the status changes. Then we can connect the signal of each task to a handler in task store and do the repeating check in there. Don't know about the performance of this though

@zeddo123
Copy link
Member Author

There's also another option, which would be to have each task emit a signal when the status changes. Then we can connect the signal of each task to a handler in task store and do the repeating check in there. Don't know about the performance of this though

If the performance hit isn't catastrophic, this is definitely a better solution.

(using decorators) when the task is enabled, children of
the task will get enabled and inherit their parent's rrules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants