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

Update feast filter dropdown options on Source pages & general clean-up of source views #1711

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

dchiller
Copy link
Contributor

@dchiller dchiller commented Nov 14, 2024

Changes the feast dropdown on SourceBrowseChants, SourceDetail, and SourceEditChants views. Rather than have one option for each feast-folio combination (that then returned results for all chants of the selected feast, regardless of folio), we have one option for feast and show the range of folios on which that feast appears. Feasts are presented in order of the folio of their first appearance in the source.

Previous version of Source Detail page

image

New version of Source Detail page

image

Previously, the chant object to be updated was determined first by the presence of pk in the request parameters, and then, if no pk was present, by whatever chant in the source had most recently been created. In practice, edits to chants through the SourceEditChants view were always passed with a chant pk, so the second option did not ever seem to be used on the "live" site. On the other hand, all tests of this view made use of the second option. This discrepancy between "real-life" behaviour and tested behaviour seemed like a suboptimal situation, so I modified the view and tests to that a chant pk is always required.

Also implements two other minor refactorings and fixes of source-related pages:

  1. Updates permissions checks to reduce the number of duplicate queries (gets a list of groups a user is in and then checks against that list, rather than running a new query to check each group).
  2. Changes instructions on the Chant Edit form when no chant pk is selected to conform to the actual behaviour of the page.

Closes #1707. Closes #1708.

Modify options in the feast dropdown to include the feast and the range of folios on which the feast appears, rather than a single option for each feast-folio pair.

Remove duplicate tests of feast selector options on various views. Add single test for feast dropdown options.

Refs: 1707
…request

Fix behaviour of feast and folio dropdown selectors on Chant Edit page to show chants on a specific folio or for a specific feast so that the selector remains on the selected option. Fix blank headers for filtered lists of chants on Chant Edit page.

Modify instructions on the Chant Edit page when no chant is selected (these has previously suggested that only full texts and volpiano was editable via that page; this has been corrected to note that all chant fields are editable).

Modify SourceEditChantsView `get_object` method so that the edited chant is always set by pk rather than recency of creation. Previously, this had been effectively true when changes were made through the form, as Django parsed the URL parameter for chant pk into the request.GET queryset; however, since URL parameters cannot currently be set with the Django test client, tests of this views were relying on the recency of chant feature. Now tests and the live form rely on the same logic (the presence of a `pk` option in the form data itself).

Reduce extraneous querysets in SourceEditChantsView.

Refs: DDMAL#1707, DDMAL#1708
@dchiller dchiller marked this pull request as ready for review December 2, 2024 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants