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

Vsliv30 3515 creation time filter misbehaviour #57

Merged
merged 2 commits into from
Jul 11, 2024

Conversation

hex494D49
Copy link
Contributor

No description provided.

@hex494D49 hex494D49 requested a review from ngaspari July 9, 2024 12:31
Comment on lines +61 to +63
$builder->orWhere(function ($query) use ($column, $formattedDateTime) {
$query->where($column, '=', $formattedDateTime);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

no need for nesting.......
this is enough: $builder->orWhere($column, $formattedDateTime);

Comment on lines +55 to +58
$builder->orWhere(function ($query) use ($column, $formattedDateTime) {
$query->whereDate($column, '=', date('Y-m-d', strtotime($formattedDateTime)))
->whereTime($column, '>=', date('H:i', strtotime($formattedDateTime)))
->whereTime($column, '<', date('H:i', strtotime($formattedDateTime . ' +1 minute')));
Copy link
Contributor

Choose a reason for hiding this comment

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

and what if we strictly want to search by second = 0? :)

Copy link
Contributor Author

@hex494D49 hex494D49 Jul 11, 2024

Choose a reason for hiding this comment

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

you're right, someone could search for '000' or '0000' as well :)) so let's change it to
if (preg_match('/^0+$/', $dateTimeValue->format('s'))) {...}

Copy link
Contributor

Choose a reason for hiding this comment

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

Not needed, because it doesn't change things.
Seconds will always be 00 in this case, number of 0 was not the point... :)
The point is that FE only selects up to minutes (and adds 00 as seconds) - so this scenario works

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the number of zeros wasn't the point, why mention it ;) Since it was mentioned, I went one step further and satisfied those who would go crazy entering endless zeros ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

I did not mention number of zeroes, but the fact that you can not find a record that strictly has 0 second. :)
for example: 2024-07-11 11:28:00

;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we both understood each other in the first run and that's all that matters ;)

@ngaspari ngaspari merged commit 393d83f into master Jul 11, 2024
3 checks passed
@ngaspari ngaspari deleted the VSLIV30-3515-Creation-Time-Filter-Misbehaviour branch July 11, 2024 06:57
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.

3 participants