Watson icon indicating copy to clipboard operation
Watson copied to clipboard

Aggregate doesn't seem to work with frames that cross day boudaries

Open KennethNielsen opened this issue 6 years ago • 12 comments

Hi everyone

I just noticed the completely awesome aggregate feature in the development version (implemented by @brandomr and thanks!) and I was very thrilled because I really needed that while migrating tasks from another tool.

While migrating the tasks, I noticed that the command fails to show frames that cross day boundaries. I recognize that this is a rare usecase, but none the less I feel that it would be worth fixing.

I can help with it if necessary, but if @brandomr want's to continue the work on this command I completely understand.

KennethNielsen avatar Jan 29 '19 08:01 KennethNielsen

@KennethNielsen that is interesting and might not be such an edge case for developers 😉. I won't have time to work on this until at least next week or the week after, so if you're able to take a whack at it, awesome!

I'm curious what occurs when this happens/what output you see?

brandomr avatar Jan 29 '19 14:01 brandomr

@brandomr the case that I had was a day that had only one frame, that ended after midnight. In that case the aggregate for that day was empty.

KennethNielsen avatar Jan 29 '19 15:01 KennethNielsen

Hmm. As it turns out, this is a special case of report with the same start and end date not returning any output for en event that is only partially within that day. This in turn is due to Frames.span, Frames.filter and Span.__contains__ not doing that. This means that we are all the way down to the most basic objects and behaviour.

So at that point there are basically two routes:

  1. Decide that for report, this is intended behaviour... and implement aggregate without the report functionality. (This is a lot of work, duplicate effort and error prone).
  2. At some level (Frames.filter and probably report), introduce an (internal) option concerning frames that cross the boundaries. If this options is active, it will then replace the frames in question with pseudo frames with time spans that ends at the boundaries.

I tend to lean towards 2, especially considering that it can be implemented cleanly and without affecting any other functionality, but I would like some opinions before I start. What do you think @brandomr @jmaupetit?

KennethNielsen avatar Jan 29 '19 22:01 KennethNielsen

I vote 2!

jmaupetit avatar Jan 31 '19 08:01 jmaupetit

I just started using 1.7 and this is annoying. At first I thought I'm doing something wrong.

loonies avatar Mar 28 '19 07:03 loonies

@loonies thanks for bumping this! @jmaupetit I agree on option 2. I'll take a look into fixing this next week. I'm glad to see that people are finding the feature useful (minus this bug)

brandomr avatar Mar 28 '19 12:03 brandomr

@brandomr I hope you don't mind, but since I didn't see a PR I imagined you were busy, so I tried my hand at a fix. If you are already in progress with it, then if nothing else, it can serve as something to compare with.

KennethNielsen avatar Apr 28 '19 20:04 KennethNielsen

@KennethNielsen that is awesome! I'm sorry to have fallen off this thread--things got busy but I am so glad you picked it up. Nice!

brandomr avatar Apr 28 '19 22:04 brandomr

Any update on this one? I'll often do a long coding session that starts in the evening and ends after midnight. I use Watson to track my hours, which later get transcribed to my billing system. I just noticed large swaths of hours were missing.

emarthinsen avatar Mar 07 '20 20:03 emarthinsen

@emarthinsen the PR (#277) is pending approval of the approach, since I didn't want to keep re-basing it until I had that and I think these guys are busy. Give it a thumbs up if you want to advance it a bit.

KennethNielsen avatar Mar 11 '20 12:03 KennethNielsen

@emarthinsen, @brandomr @loonies the fix for this issue needs to be tested, would any of you mind. (Apologies of the get the message twice, but I was unaware if I could tag you in a PR that you didn't comment on)

KennethNielsen avatar Mar 13 '20 17:03 KennethNielsen

Thanks a lot, I was bitten by this one. Certainly, errr... very rarely! ;-)

pradzins avatar Jun 10 '20 08:06 pradzins