-
Notifications
You must be signed in to change notification settings - Fork 4
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
sort fixing #1124
Merged
Merged
sort fixing #1124
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This pull request is split into 7 parts for easier review. Changed files are located in these folders:
|
…ility to sort only english auctions and user binds for blind auctions
OlegPhenomenon
force-pushed
the
sort-fixing
branch
from
September 13, 2023 13:07
67e6c66
to
7c10a88
Compare
finished auction view - sorting does not work with any columns at all |
OlegPhenomenon
force-pushed
the
sort-fixing
branch
3 times, most recently
from
September 15, 2023 11:09
c903e9d
to
53dc809
Compare
OlegPhenomenon
force-pushed
the
sort-fixing
branch
from
September 15, 2023 11:15
53dc809
to
3932d38
Compare
maricavor
approved these changes
Sep 15, 2023
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What do we have here?
We have a sorting issue here. The problem is that things like the user's bid and username are being sorted incorrectly (actually, correctly), and there are also several issues with sorting in the admin panel. Here are the details: #1125
Why?
The user's bids are actually sorted correctly, we just don't "see" it. The thing is, sorting is done by the Offer model, specifically by the 'cents' column. However, according to business logic, we only see bids made for the English auction, but we don't see bids made for the blind auction, even if they exist. So, we end up sorting the bids we see and the ones we don't, and that's why it seems to us that the sorting is wrong.
As for the fact that the user sorting doesn't occur - the answer is simple, it's just not implemented and another column of the table was specified instead.
Admin panel issue: domain names weren't sorted because of a simple typo in the column name, and sorting by deposit wasn't implemented at all.
The next issue was with class naming. The thing is, our records store record types in uppercase letters. For example,
PaymentOrder::LHV
,PaymentOrder::SEB
. And these records expect there to be subclasses with the same names, specifically in uppercase. However, in Ruby on Rails, the naming logic is slightly different - it uses a capital letter followed by lowercase letters. So, the correct naming would bePaymentOrder::Lhv
,PaymentOrder::Seb
. Hence, there's a conflict with the naming. In the past, this all worked, but apparently, with the Ruby on Rails version update, this logic broke.Well, alright, what did you do?
The main problem with implementing sorting was as follows: I can make it so that only English auctions are sorted, however, those users who placed a bid for blind auctions, they can see their bids. It turns out that in this implementation, only bids for the English auction will be sorted, and their bids for the blind will not be. Therefore, I had to complicate the SQL query so that bids for a specific user's blind auction were also included.
Implementing different business logic for sorting other columns also required SQL queries, but they are not as complex and convoluted as sorting by user bids.
I added exceptions to the inflections.rb file for the classes
PaymentOrder::LHV
,PaymentOrder::SEB
, so Ruby wouldn't apply naming rules to them.How do we test all this?
Testing is simple: just click on columns and ensure they are sorted correctly in alphabetical order. However, there are nuances for auction domain names for regular participants:
PaymentOrder
records for subclasses likeSEB
andLHV
are in uppercase letters, and no others