Closed Bug 1054279 Opened 10 years ago Closed 4 years ago

Refactor the filter_for_list method into multiple model manager methods

Categories

(developer.mozilla.org Graveyard :: General, defect)

All
Other
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jezdez, Unassigned)

Details

(Whiteboard: [specification][type:change])

What feature should be changed? Please provide the URL of the feature if possible.
==================================================================================
This is proposed by :jezdez in pull #2166 (https://github.com/mozilla/kuma/pull/2166):
"This is slowly becoming a kitchen sink and harder to test. Please open a Github issue to refactor the filter_for_list method into multiple model manager methods (e.g. with_errors, without_parents etc)."

I would love to learn more about this. Some newbie thoughts and questions (jumping into cold water, be patient with me):

1) The exclude slugs ("User:", "Talk:") should be synced with the ones we use in the search. How to DRY?
2) No idea about Managers. But looking at the code: Should there be a DocumentListingManager and the filter_for_list should be removed from the BaseDocumentManager?
3) Maybe similar to the DeletedDocumentManager ? Does that manager then offer the methods that are called from the view?

class DocumentListingManager(BaseDocumentManager):
    def get_query_set(self):
        return super(DocumentListingManager, self).get_query_set()
        .filter() // filtering for standard excludes etc...

    def with_errors() // return the error docs

4) Seems like all these views could need tests. Looking at the test files I feel a bit lost. Tips or entry points?

What problems would this solve?
===============================
Fix code smell

Who would use this?
===================
n/a

What would users see?
=====================
n/a

What would users do? What would happen as a result?
===================================================
n/a

Is there anything else we should know?
======================================
MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.