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

Refactor and unify annotation functions #1588

Open
richardebeling opened this issue May 4, 2021 · 0 comments
Open

Refactor and unify annotation functions #1588

richardebeling opened this issue May 4, 2021 · 0 comments
Labels
[C] Backend Focuses on backend implementation [P] Nice to have Lowest priority. Some people might use this feature but it won't have a big impact. [T] Refactoring Existing parts should become faster, more readable, or in any other way better.

Comments

@richardebeling
Copy link
Member

Currently we have these functions (feel free to add more if I missed any):

  1. Evaluation:annotate_with_participant_and_voter_counts: takes QuerySet, uses a subquery and calls .annotate, returns modified QuerySet
  2. annotate_distributions_and_grades: takes iterable of Evaluations, modifies in place
  3. annotate_evaluations_with_grade_document_counts: takes QuerySet, calls .annotate and returns modified QuerySet
  4. get_evaluations_with_course_result_attributes: takes iterable of Evaluations, modifies and returns the same iterable
  5. results.get_evaluations_with_prefetched_data: takes iterable or QuerySet. Wrapper for 2 that will prefetch data if given a QuerySet.
  6. staff.get_evaluations_with_prefetched_data: Takes a semester, returns QuerySet annotated with a bunch of stuff, calls 1 and 3.
  7. get_evaluations_of_course: Returns list, calls 4.

Since I'm already at it, I'll also add here that Semester has two class methods:

  • get_all_with_published_unarchived_results
  • get_all_with_unarchived_results

I think these functions should be refactored to use a uniform naming scheme. Maybe there are some possibilities for deduplication? Maybe we could always use QuerySets (perhaps not easily possible)?

@richardebeling richardebeling added [C] Backend Focuses on backend implementation [T] Refactoring Existing parts should become faster, more readable, or in any other way better. labels May 4, 2021
@janno42 janno42 added the [P] Nice to have Lowest priority. Some people might use this feature but it won't have a big impact. label Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Backend Focuses on backend implementation [P] Nice to have Lowest priority. Some people might use this feature but it won't have a big impact. [T] Refactoring Existing parts should become faster, more readable, or in any other way better.
Development

No branches or pull requests

2 participants