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

Merge develop into staging; 16 July 2024 #1565

Merged
merged 71 commits into from
Jul 17, 2024
Merged

Merge develop into staging; 16 July 2024 #1565

merged 71 commits into from
Jul 17, 2024

Conversation

dchiller
Copy link
Contributor

@dchiller dchiller commented Jul 16, 2024

Want to get the changes in #1545 up on staging so all can see as soon as we can.

@lucasmarchd01 We could merge #1564 first to include in this round of updates too.

adds blocks for title and scripts so that templates can put those parts in the header.
The title and scripts are no longer simply added to the body of the page, but are now actually contained by the header, where they should be.
Since the siglum and institution name now come from the institution, the source only needs
to have the shelfmark.

However, until all the data is properly migrated, the old title and siglum fields will remain.
This is a hacky, change-as-needed script that serves to migrate the source data from the old structure to the new, creating institutions and moving the shelfmark data to the new sources.

There is a whole bunch of sigla that get skipped (essentially all private collectors) until we figure out how they will be handled.

Don't look to closely, since there are lots of skeletons in this closet.
Allows sources to be added to an institution by using the autocomplete widget
Previously, the LoginView import in the URLs was taken from the views.user module, instead of directly from the django auth views, because this view was also imported into the user module. (aka, a transitive import). This changes it to import from the auth views directly.

I also ran a formatter on the imports in the user module, so that's why it looks like there are more changes than there actually are!
Previously there were several duplicated property definitions that varied only by checking whether the user was logged in. They also did the sorting in Python, rather than in the database.

This condenses all the definitions to a single one per property, and uses the expanding empty dict trick to determine whether `published=True` gets added to the filters. (Since without this, what is really desired is `published = True OR False` but without resorting to Q queries this was the simplest way to do it.)
This commit completely reworks the fetching of data for the feast detail page.

Previously, this page took several seconds to load, and generated a large number of queries, due to the complexity of the information needing to be collated.

This was rewritten to instead use two custom SQL queries that are executed directly. This means that the number of queries generated by this segment of code is now no more than two.

There are a few 'interesting' things in this, which I've tried to note in comments.

In the process, this also fixes a number of other small bugs:

Fixes #1540
Fixes #1136
Fixes #596
This commit reworks the source display in the templates, primarily by calling a couple helper methods on the Source model to keep the referencing consistent. The 'short heading' method displays the Institution siglum and the shelfmark, while the 'heading' displays the full institution name and the shelfmark.

The edit and create templates were reworked for the new structure and source referencing. The source display will now show the institution and the shelfmark in separate columns.
This is to allow saving sources in the create / edit without triggering a validation error.
Buckle up, this one's a bit messy.

This commit disables the Feast Detail tests. It turns out, after much searching and Googling and digging, that the Django Test Suite always wraps the tests in a transaction, so that the test can be easily rolled back after each one is run, and thus present a database in a known state for each individual test.

However, with the switch to running a raw SQL query, the cursor in the Feast Detail View now runs outside of this transaction. Thus to the View, the database always looks empty, even if it's running inside of the test.

I tried fixtures, TransactionTestCase, overriding methods and hacking the TestCase to prevent this behaviour, but no dice.

So for now I've marked the Feast Detail tests as "skip" so that they still appear in the runs, but are skipped because they will always fail, as they're written.
It's better to use the named fields for the column content than to rely on the order of the tuple unpacking....
Still failing, but being worked on. Committing here to merge in latest changes.
# Conflicts:
#	django/cantusdb_project/main_app/templates/browse_chants.html
#	django/cantusdb_project/main_app/templates/chant_create.html
#	django/cantusdb_project/main_app/templates/chant_detail.html
#	django/cantusdb_project/main_app/templates/chant_edit.html
#	django/cantusdb_project/main_app/templates/melody_search.html
#	django/cantusdb_project/main_app/templates/source_detail.html
#	django/cantusdb_project/main_app/templates/source_edit.html
#	django/cantusdb_project/main_app/templates/user_source_list.html
Syncing the templates with the latest develop generated a number of merge conflicts. This commit fixes them.

Also it fixes the new block definitions in the base templates.

Fixes #1551
The numbers from a fresh database copy now match the numbers running on the production site, and the numbers
fetched in the browse Chants UI for the chants associated with a feast.
Adds a section that shows a list of sources that are attached to the institution at the bottom of the institution page. Also adds the ID as a link field to that source record.
This commit adds the ability to specify private collectors as a type of Institution.

The model constraints are set up so that you can either specify that an institution is a private collector (via a checkbox) OR they have a siglum. Both cannot be selected for the same record, but one of the two options must be selected for each record.

Institutions that do not have a siglum currently get the word "Private" prepended to the shelfmark.

All other fields are accessible for private collectors.

Alters the admin UI to make the distinction via the layout as well.
Puts the siglum at the front, so that the fact that it is ordered by siglum is clear.
Removes the old "siglum" field.
Still janky, still works.
ahankinson and others added 23 commits June 21, 2024 23:04
There's a lot of stuff going on here, and a lot of stuff that I still don't understand.

But this now works, and is better than before.
Also suppress siglum if it's Unknown
It's been replaced with the new one, but this is for posterity's sake
Skip only those that are not correct.
Change links under Resources menu and add link to procedures manual
Escape special characters in suggested chant data
- Ensure data from old feasts are transferred to new feasts
- Update chants and sequences to use new feast IDs
- Delete old feasts after reassignment
- add_prefix management command no longer exists
Big Source Changes, Much Improvements, Wow.
@dchiller dchiller requested a review from lucasmarchd01 July 16, 2024 15:42
@dchiller dchiller marked this pull request as ready for review July 16, 2024 15:42
@dchiller dchiller merged commit a1e2a93 into staging Jul 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants