Changes between Initial Version and Version 1 of Ticket #32662


Ignore:
Timestamp:
Apr 18, 2021, 6:32:29 PM (3 years ago)
Author:
Chris Jerdonek
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32662 – Description

    initial v1  
    1 I noticed that `SQLCompiler.get_order_by()` has a 70-line [https://github.com/django/django/blob/aa4acc164d1247c0de515c959f7b09648b57dc42/django/db/models/sql/compiler.py#L297-L368 chunk of code] whose job is to build up an `order_by` list, which is then iterated over [https://github.com/django/django/blob/aa4acc164d1247c0de515c959f7b09648b57dc42/django/db/models/sql/compiler.py#L372 right after]. That chunk of code has 8 `order_by.append()` lines. 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.
     1I noticed that `SQLCompiler.get_order_by()` has a 70-line [https://github.com/django/django/blob/aa4acc164d1247c0de515c959f7b09648b57dc42/django/db/models/sql/compiler.py#L297-L368 chunk of code] whose job is to build up an `order_by` list, which is then iterated over [https://github.com/django/django/blob/aa4acc164d1247c0de515c959f7b09648b57dc42/django/db/models/sql/compiler.py#L372 right after]. That chunk of code has 8 `order_by.append()` lines and an [https://github.com/django/django/blob/aa4acc164d1247c0de515c959f7b09648b57dc42/django/db/models/sql/compiler.py#L357-L358 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.
Back to Top