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

Chant create: optimize suggested chants feature #1579

Merged
merged 7 commits into from
Aug 7, 2024

Conversation

dchiller
Copy link
Contributor

@dchiller dchiller commented Aug 6, 2024

This PR eliminates all calls to the json-cid endpoint for the "suggested chants" feature on the Chant Create view. All data required for the suggested chants is now supplied directly in the response to the json-nextchants endpoint.

Given that we no longer need to make these extra calls, this PR also returns the number of suggested chants presented to at most 5 rather than at most 3.

Modifies tests and relevant mock data to conform to this change in endpoint behaviour.

In the process, adds a few development-related items:

  • adds the django-extensions and werkzeug packages so that the development django container runs runserver_plus. This server provides a shell for debugging any time a view errors -- a useful development feature.
  • add the types-requests package with type stubs for the requests package.

Closes #1424

With this change, we can make use of the python shell that runserver_plus
provides when a python error occurs in django
Installs typing stubs for the requests package
…ture

With a fix to the Cantus Index json-nextchants endpoint, we can now
reduce the number of calls that need to be made to Cantus Index to
support the suggested chants feature of the Chant Create page. All
the data on the suggested chants that we need for the feature comes
now in the result of that call and does not require additional json-cid
calls.
…feature

Additionally, cast the "count" attribute of the response to the json-nextchants
endpoint to int.
@dchiller dchiller requested a review from lucasmarchd01 August 6, 2024 12:42
@dchiller
Copy link
Contributor Author

dchiller commented Aug 6, 2024

Tests are currently failing because we install the "production" version on the test runner but use the development docker-compose file (which now requires a development dependency for the runserver_plus command). I'll solve.

@dchiller
Copy link
Contributor Author

dchiller commented Aug 6, 2024

Ok, I think it makes the most sense to replicate the production environment on the test runner... so in that case we'll need to use a different command for the django container on the test runner.

…go_tests

Introduce a separate docker-compose file for use with the django_tests github
action that replicates the production run environment (use of gunicorn rather
than the django development server).
@dchiller dchiller merged commit 3e8f70c into DDMAL:develop Aug 7, 2024
1 check passed
@dchiller dchiller deleted the optimize-suggested-chants branch August 7, 2024 20:30
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.

Chant Create: Suggested Chants feature needs to be optimized
2 participants