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 the order expiring assets are listed in notifications #11489

Conversation

Godmartinz
Copy link
Collaborator

Description

image

Fixes # SC-19333

Type of change

Please delete options that are not relevant.

  • [X ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • PHP version:
  • MySQL version
  • Webserver version
  • OS version

Checklist:

@Godmartinz Godmartinz requested a review from snipe as a code owner July 11, 2022 19:26
@snipe snipe requested a review from uberbrady July 11, 2022 19:43
@snipe snipe changed the title fixes the order expiring assets are listed in notifications Fixed the order expiring assets are listed in notifications Jul 18, 2022
@snipe
Copy link
Owner

snipe commented Aug 29, 2022

@uberbrady is it possible we can use something other than RAW here? Also is this the order we think a user would expect?

@uberbrady
Copy link
Collaborator

@uberbrady is it possible we can use something other than RAW here? Also is this the order we think a user would expect?

I don't know that there is another way to do this other than DB::raw() (well, orderByRaw() is probably doing most of the heavy lifting here) - the problem is that different assets might have different warranty expiration periods, and typically, the order that you'd want to see is what's expiring first. It's possible that orderByRaw() means that the DB::raw() is extraneous - @Godmartinz , can you check that out for us? It's a small thing, it would just mean we're simplifying the code a teensy bit.

But regardless of that small point, it looks like it handles that use case, and it does so in the only way that I can figure out that makes any sense.

So, I think this is the order users would expect, and I think that orderByRaw() is the only way you can go about it. I hate raw DB queries as much as the next person, but it definitively solves a problem here.

If there is another way to do this without dropping to Raw queries, I certainly don't know what it is :/

@Godmartinz
Copy link
Collaborator Author

On it 👍

@Godmartinz
Copy link
Collaborator Author

/DB:raw() has been removed now 👍

@snipe snipe merged commit 7fa9214 into snipe:develop Aug 29, 2022
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.

None yet

3 participants