Opened 4 years ago
Last modified 4 years ago
#32662 closed Cleanup/optimization
Refactor a generator out from part of SQLCompiler.get_order_by() — at Version 1
Reported by: | Chris Jerdonek | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I noticed that SQLCompiler.get_order_by()
has a 70-line chunk of code whose job is to build up an order_by
list, which is then iterated over right after. That chunk of code has 8 order_by.append()
lines and an order_by.extend(). It looks like this could be made cleaner by pulling those lines out into a private method that is instead a generator that yields those pairs. That would eliminate the need for having order_by.append()
in several spots, and it would reduce the size of the method into two smaller methods.