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
By default select site creation date if site was created today or if select date is before site creation date #16287
Conversation
Could it be that the Menu test fails because the period is week and for week it shouldn't matter if the day is previous creation date because the date is within the same week?
|
@dev-clavis I'll have a look when I continue working on this but basically added some code so the week should work as expected which is needed when someone manually sets a very old date. I simply haven't adjusted the expected test result yet I think. |
Tests should pass now. There is one test failure and one UI failure in https://builds-artifacts.matomo.org/matomo-org/matomo/4.x-dev/41910/ but seems unrelated to this change. |
if (!$endDate->isLater($siteCreationDate)) { | ||
// when selected date is before site creation date or it is the site creation day | ||
$defaultDate = $siteCreationDate->toString(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sets the date to load to the site creation date if the default period end date is past the site creation date correct? So if the site creation date is 2015-02-02, and $defaultDate
is 2020-01-01 w/ period = year, then the date is always set to 2015-02-02. Is this the intended functionality? It doesn't sound like what the PR title implies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 adjusted the PR title @diosmosis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then should it be $endDate->isEarlier($siteCreationDate)
? To set it "if select date is before site creation date"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's pretty much the same or not? !$endDate->isLater == $endDate->isEarlier()
? Will change the code ... tests still pass that way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, I missed the !
while reading, LGTM
fix #13754
implementing this already now as we'll want to patch this on the cloud