BrewPi / brewpi-www

This is the repository for the BrewPi web interface. The web interface will communicate with the Python script, which will in turn talk to the BrewPi Spark
https://www.brewpi.com
106 stars 75 forks source link

parseDayString #50

Closed lukepower closed 9 years ago

lukepower commented 9 years ago

Added parseDayString function to parse strings like "1d2h30m"

elcojacobs commented 9 years ago

Nice work. Thanks for contributing :)

I think it could be expanded by handling errors a bit better (invalid strings, empty strings). And if no specifier is given (d/h/m), default to days.

And then move it into the class, replacing this function: https://github.com/lukepower/brewpi-www/blob/master/js/profile-table.js#L336

And give it a test, try to break it with the nastiest input you can come up with.

lukepower commented 9 years ago

Hm actually I have a more curreent version which has not been updated correctly.. Have to check that.

elcojacobs commented 9 years ago

The string parsing seems to work nicely. I only just found a new issue: we sorted the tables based on the day column. Having these strings in there breaks the sort. We need to sort by date instead. After testing, the console.log statements should probably be removed.

Now for the pedantic, but educational part: Pull requests are easiest to merge if they are against the up-to-date develop branch. This involves 3 steps:

Ideally, also this step:

lukepower commented 9 years ago

Hi Elco,

I see… I definitively need to understand the Git way of updating better, as I only used it till now to get code :)

You can catch me on Skype (lukas_demetz) so maybe we could do a sample procedure together.

As for the sorting by date, I will have alook at it. Either I can provide the sorting with the calculated day value, or I could add a hidden column with the day values and sort by that.

Cheers

Lukas

Von: Elco Jacobs [mailto:notifications@github.com] Gesendet: Donnerstag, 3. September 2015 00:38 An: BrewPi/brewpi-www brewpi-www@noreply.github.com Cc: lukepower lukas@lukepower.com Betreff: Re: [brewpi-www] parseDayString (#50)

The string parsing seems to work nicely. I only just found a new issue: we sorted the tables based on the day column. Having these strings in there breaks the sort. We need to sort by date instead. After testing, the console.log statements should probably be removed.

Now for the pedantic, but educational part: Pull requests are easiest to merge if they are against the up-to-date develop branch. This involves 3 steps:

Ideally, also this step:

— Reply to this email directly or view it on GitHub https://github.com/BrewPi/brewpi-www/pull/50#issuecomment-137264645 . https://github.com/notifications/beacon/AEdwr8gSIZgB-kPhYWkKe4mSBmcWhaDcks5ot3HigaJpZM4F0AjP.gif

lukepower commented 9 years ago

Ok Elco, I fixed the sorting issue, should now work fine.

elcojacobs commented 9 years ago

Closed, merges as a squashed commit in a different pull request