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

We shouldn't try and collect data from the future #42

Merged
merged 10 commits into from
Aug 26, 2013
Merged

Conversation

annashipman
Copy link
Member

This pull request addresses issue #40. I hadn't quite understood the problem when I raised the issue so to restate it here:

Be Habitual requests information for the current time period. This is not a major problem if the time period is a day, but if it's a week it means you get an email at 9.30 on Monday morning asking you how you have done, and the link takes you to a page which wants the upcoming week's data (i.e. future data).

This is nonsensical, but it's also problematic in that you are not permitted to enter only some data on that page. So if I want to enter last week's data only, I can't, I also need to enter data for this week, which hasn't happened yet. So I have to wait until the end of this week to enter last week's data, or set this week's data forever to 0.

  1. I think the longer term solution for this is actually slightly more complex logic on the record progress page, such that you cannot leave the page without entering previous time periods' data but data on the current week does not have to be entered/can be altered. That would also address You should only have to fill in the ones you want to #39 and Can't mark completion a second time #36.
  2. In the current absence of that more complex logic, we can default to either:
    (a) having to enter the current period's data
    (b) not being able to enter the current period's data
    Currently, it is (a). This leads to the non-sensical situation I described above. Therefore, the changes in this PR changes the logic so it defaults instead to (b).
  3. The logic change is here: dec0b82
    It looks like the +1 is solely to ensure we include the current time period.
  4. I have also had to change tests other than the one I changed to reflect the exact behaviour I was changing. Therefore I'd really appreciate a close eye on this from others - especially in case there are other areas that use this functionality that are not unit tested.

Paricularly @nickstenning and @ashb who worked on this file; and/or @georgebrock, @mnowster, @SteveMarshall, @jaylett, @jcoglan, or @norm.

Oh, and the other thing I haven't done is tested it locally as my local running Be Habitual falls over when I try and create a habit (on master as well as this branch). Tips on that welcome...

If this is merged whoever does that could also raise an issue for point 1?

Cheers! To Industry!

This logic took me ages to work out so I've added some extremely detailed documentation to the fixture. This is not the right thing to do or the right place to do it - the code and tests should be refactored so this logic is clear from reading the tests; however, I do not want to make too many changes at once so this will do for now.
As in, this is the result I expect
I can't see why this +1 has been added. The work it is doing means we include
the current time period. Pending more complex logic for handling this (to allow
users to enter data for previous time periods but not current time period) I do
not think we should collect data for the current time period.
These three were failing because the latest time period was not being returned.
Have fixed them therefore by setting the start date one day earlier.
Fixed a couple more tests by setting the start date to yesterday. The sceond one
here, test_record_get now may not quite make sense because how can you record
data if it's not on the view screen? But I don't think this matters right now.
...but there is probably a better way of doing this. I think it still tests what
it's meant to test, but you might want to take a look.
@jaylett
Copy link
Member

jaylett commented Jun 12, 2013

This looks good to me; the tests still all pass, although for other reasons (mostly attempts to eschew VirtualBox, which turns out to be more problematic than using it) I cannot do anything serious via a local web instance either.

I don't have a huge amount of time right now, so I won't actually merge it as I don't have time to write up the other ticket that needs to come out of it. If no one else gets to it by early next week, when I should have some more time, then I'm happy to spend a couple of hours getting a VBox working for this again, then doing all the admin and making this live.

@annashipman
Copy link
Member Author

I raised the issue as #43. Would still appreciate another eye on this - maybe someone who can get it running locally? Ta.

@jaylett
Copy link
Member

jaylett commented Jun 17, 2013

Cool — for some reason comments on commits go to one inbox, but issue stuff goes to another, so I didn't notice your issue. Sigh.

I've spent the day upgrading my hosted server; hopefully I'll get some time tomorrow to wrestle VBox into submission and have a look at this.

annashipman added a commit that referenced this pull request Aug 26, 2013
We shouldn't try and collect data from the future

I have finally got behabitual working locally and it works fine, so I'm going to merge and deploy this change. Yes, merging my own pull requests. http://wheningit.tumblr.com/post/25796306185/when-i-merge-my-own-pull-requests
@annashipman annashipman merged commit 86c745c into master Aug 26, 2013
@annashipman annashipman deleted the week_habits branch August 26, 2013 12:47
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 this pull request may close these issues.

2 participants