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

Do we allow a worklogs tree to be just a leaf? #23

Closed
dapritchard opened this issue Feb 22, 2023 · 1 comment · Fixed by #25
Closed

Do we allow a worklogs tree to be just a leaf? #23

dapritchard opened this issue Feb 22, 2023 · 1 comment · Fixed by #25

Comments

@dapritchard
Copy link
Owner

dapritchard commented Feb 22, 2023

Right now we think of a worklogs tree with a single task as being a worklogs_node with a single child worklogs_leaf. But we could potentially end up with a situation where we have a tree that's just a worklogs_leaf. For example:

  1. By calling new
  2. By calling extract_worklogs pointing towards a worklogs_leaf

Some potential approaches:

  1. We could potentially treat this as a special case that's effectively the same as a worklogs_node with a single child worklogs_leaf. We could give it the name as the description from the internal data frame. But then we'd have to program around this everywhere.
    1. If the leaf doesn't contain any worklog entries then we won't be able to extract a name.
      1. We could throw an error in this case
      2. We could make the name of the worklogs be an argument to new and store it with the object. Since we don't really want users to call new directly this might not be a big deal. Furthermore, it might be convenient to store the name of the worklogs along with the object (presumably as duplicated information in lockstep with the names of the parents @children slot.
  2. As a variant of (1) we could try to "fix" the situation whenever we encounter it and wrap worklofs_leaf in a worklogs_node. But if we've already programmed around the special case everywhere is this even helpful?
  3. We could throw an error when we do encounter it.
    1. We'd have to create top-level versions of functions to catch this case
    2. Would this be annoying to the user?
@dapritchard
Copy link
Owner Author

I've decided to make the name of the worklogs be an argument to new and store it with the object, and then program around this special case in all of the functions that operate on worklogs. I think this is the best solution since we can't stop people from using new, and that way we can always perform valid operations on a 'worklogs' object.

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

Successfully merging a pull request may close this issue.

1 participant