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

Add timeframe to hourly #4

Closed
wants to merge 4 commits into from
Closed

Conversation

jaap
Copy link
Contributor

@jaap jaap commented Jul 18, 2017

Resolves #3

@ricbra
Copy link
Owner

ricbra commented Aug 24, 2017

This PR also contains the changes from #1 which makes it hard to review. Can these be reverted from this PR?

@jaap
Copy link
Contributor Author

jaap commented Aug 24, 2017

I updated my branch and removed 88459b8.
Does this help?

@jaap
Copy link
Contributor Author

jaap commented Aug 24, 2017

Ok, now checks fail of course. Sorry for making such a mess here.
Combined all changes in a single PR (#5) now to make life a little easier. Hope that helps.

@jaap jaap closed this Aug 24, 2017
@ricbra
Copy link
Owner

ricbra commented Aug 24, 2017

Cool, could take a look at my comments and fix them in the new PR? Thanks for your patience again :)

@jaap
Copy link
Contributor Author

jaap commented Aug 24, 2017

For some reason I can't find the comments you're mentioning. Am I overlooking something?

@ricbra
Copy link
Owner

ricbra commented Aug 24, 2017

I commented in the previous PR's ( #2 and #4). If you select the "Files changed" tab, you should see them. Let me know if you still can't find them.

@jaap
Copy link
Contributor Author

jaap commented Aug 24, 2017

Strange, I did check there (and did it again just now), no comments visible to me 😥

{

$start = $start->format('Ymd') . sprintf("%02d", $timeframe_start);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should just completely drop the DateTime usage here as KNMI expects an alternative format anyway. So:

public function getHourly(string $timeframeStart, string $timeframeEnd, array $stations, array $vars) : array

I don't like adding another two params here as it can be confusing. Less params is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it, but for 'day selection' using regular dates is IMO easier then formatting it into a string on forehand. The separate timeframe option allows you to set the timeframes you'd wish to collect from those days. Doing it your way you'd still be formatting the start, end and timeframe into 2 strings.

Doing it by using my proposal you can still use regular date objects and just collect only morning data by providing $timeframe_start = 6, and $timeframe_end = 12.
Do you get what I mean? Or am I understanding you wrong?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you got a point. It's just confusing design from the KNMI 😄.

Could you change the vars to camelCase:

$timeframeStart


class ClientTest extends \PHPUnit_Framework_TestCase
class ClientTest extends TestCase
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you revert this change as it is not required? We're depending on phpunit ^5.6 which still has the old non-namespaced class names. If you run the tests with the composer installed phpunit, it should work with the non-namespaced classes (vendor/bin/phpunit).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

@@ -137,4 +139,26 @@ public function it_correctly_calls_and_parses_knmi_hourly_response()
$response
);
}
/**
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a newline like this:

}

/**

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

$parsed[0]['station']['name']
);
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

* @group integration
* @test
*/
public function it_correctly_calls_and_parses_station_names_with_specia_characters()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo "specia" -> "special"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️


class ResponseParserTest extends \PHPUnit_Framework_TestCase
class ResponseParserTest extends TestCase
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert, see my earlier comment in the other test case

@ricbra
Copy link
Owner

ricbra commented Aug 25, 2017

I just submitted another review with all the comments, you should be able to see them now. My previous reviews weren't submitted, my bad.

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