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

Fixed #13300 Custom Asset Report, Checkout date range never includes current day #13309

Merged

Conversation

inietov
Copy link
Collaborator

@inietov inietov commented Jul 13, 2023

Description

We had a problem with the Custom Asset report in the Checkout Range, as we stored the last_checkout field as a DATETIME, when we made a Checkout Range for example from '2023/07/01' to '2023/07/13', if the checkout was today at this moment we got into the database field for example '2023/07/13 16:06:23', which is out of the dates range because of the 'extra' time we are storing.

So I add a cast of the type date to the last_checkout column in the query, so the report can ignore that time part of the DATETIME type and the results are retrieved correctly. I also include in the fix created_at and last_audit_date which probably have the same problem.

Fixes #13300

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Test Configuration:

  • PHP version: 8.1
  • MySQL version: 8.0.23
  • Webserver version: PHP Dev Server
  • OS version: Debian 11

…about time of day in custom report datetimes
@what-the-diff
Copy link

what-the-diff bot commented Jul 13, 2023

PR Summary

  • Improved Query Handling in ReportsController
    In our ReportsController file, we have improved how we retrieve information related to assets. This has been achieved by refining the queries used to find assets based on different date ranges. The following are the benefits from these refinements:

    • Improved Date Range Filtering for Asset Creation
      We've enhanced the system's ability to filter assets based on when they were created. You can now search for assets created within specific date ranges, providing you with a more precise set of results.

    • Enhanced Date Range Filtering for Asset Checkout
      We've also revised how the system filters assets based on their last checkout date. You will now be able to locate checked-out assets within specific date ranges, enabling accurate tracking of asset allocation history.

    • Refined Date Range Filtering for Last Audit Date
      The system has also been improved to better handle filtering of assets based on their last audit date. This ensures that you can track asset audits effectively and correctly, within the precise date ranges needed.

These improvements should help manage your assets more efficiently and make reporting and tracking easier and more accurate.

Copy link
Owner

@snipe snipe left a comment

Choose a reason for hiding this comment

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

I generally don't like introducing DB:raw() if we can ever avoid it. Can we maybe play around with $dt->isStartOfDay() or $dt->isEndOfDay(); from Carbon instead?

@inietov inietov changed the title FIxed #13300 Custom Asset Report, Checkout date range never includes current day Fixed #13300 Custom Asset Report, Checkout date range never includes current day Jul 19, 2023
Copy link
Collaborator

@marcusmoore marcusmoore left a comment

Choose a reason for hiding this comment

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

Looks good to me 😄

@inietov
Copy link
Collaborator Author

inietov commented Jul 28, 2023

Kindly ping @snipe

@snipe snipe merged commit ffb605a into snipe:develop Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants