carpentries / amy

A web-based workshop administration application built using Django.
https://amy.carpentries.org
MIT License
114 stars 72 forks source link

Bug: Internal Server Error: /reports/membership_trainings_stats/ #2327

Closed elichad closed 1 year ago

elichad commented 1 year ago

Production issue. Same type as #2313 but on the Membership training statistics page.

When searching for an organization:

FieldError at /reports/membership_trainings_stats/
Cannot resolve keyword 'organization' into field. Choices are: additional_inhouse_instructor_training_seats, additional_public_instructor_training_seats, agreement_end, agreement_link, agreement_start, communityrole, consortium, contribution_type, emergency_contact, event, extensions, id, inhouse_instructor_training_seats, inhouse_instructor_training_seats_rolled_from_previous, inhouse_instructor_training_seats_rolled_over, instructor_training_seats_inhouse_remaining, instructor_training_seats_inhouse_total, instructor_training_seats_inhouse_utilized, instructor_training_seats_public_remaining, instructor_training_seats_public_total, instructor_training_seats_public_utilized, member, membershiptask, name, organizations, persons, public_instructor_training_seats, public_instructor_training_seats_rolled_from_previous, public_instructor_training_seats_rolled_over, public_status, registration_code, rolled_from_membership, rolled_to_membership, rolled_to_membership_id, task, variant, workshops_without_admin_fee_per_agreement, workshops_without_admin_fee_rolled_from_previous, workshops_without_admin_fee_rolled_over

Other issues appear when ordering or filtering with the checkboxes:

Cannot resolve keyword 'instructor_training_seats_total' into field
Cannot resolve keyword 'instructor_training_seats_remaining' into field
Cannot resolve keyword 'instructor_training_seats_utilized' into field.
elichad commented 1 year ago

Also appears on /fiscal/memberships/ with certain filters - I assume it's the same filter set

elichad commented 1 year ago

Also at /workshops/persons when sorting by first or last name:

Cannot resolve keyword 'firstname' into field.
Cannot resolve keyword 'lastname' into field.
Choices are: affiliation, airport, airport_id, archived_at, award, awarded_set, badges, comment_comments, comment_flags, communityrole, consent, country, created_at, data_privacy_agreement, domains, duplication_reviewed_on, email, event, family, gender, gender_other, github, groups, id, instructorrecruitment, instructorrecruitmentsignup, is_active, is_superuser, languages, last_login, last_updated_at, lesson_publication_consent, lessons, logentry, may_contact, memberships, membershiptask, middle, occupation, orcid, password, personal, publish_profile, qualification, revision, rq_jobs, secondary_email, selforganisedsubmission, social_auth, task, trainingprogress, trainingrequest, twitter, url, user_notes, user_permissions, username, workshopinquiryrequest, workshoprequest

Since there are a lot of these, I think we need to introduce some tests that can catch them.

elichad commented 1 year ago

Copied from Slack: We have two pages that present/filter the memberships in slightly different ways. Both of them have tickboxes for "Show only memberships with more than zero allowed/less than zero remaining training seats," but one page shows the in-house seats and one doesn't. Should the page with the in-house seats have separate filters for those, or should they be rolled into the existing filters (with text that makes this clear)? I assume for the page which doesn't display in-house seats, the filter should only apply to public seats.

All Memberships page Membership Trainings Statistics page

My initial inclination is to combine public/in-house seats in an OR fashion, so

and not bother with separate filters for each category, since it seems like this doesn't get used much

maneesha commented 1 year ago

I am tagging @Talishask in this to see how she wants to use this when it comes to looking at membership benefit usage.

Talisha, on the "All memberships" page you see there is a column for "Remaining public seats" but not a column for "Remaining inhouse seats." On the "Membership trainings statistics" page we have columns for total/utilized/remaining for both public and inhouse. On the left side of either page, we have the option to filter by number of training seats. Are you ok with those filters applying to either type of seat?

Keep in mind this will happen as part of fixing the bug noted above. We will be considering more thorough improvements to all parts of the AMY interface and will look for more feedback at that point.

Talishask commented 1 year ago

For this, Eli has highlighted my preference. In both views (All Memberships and Membership Training Statistics) the number of Total, Utilized and Remaining instructor training seats should be cumulative (sum both public and in-house).

So in the 'All Memberships' view:

So in the 'Membership Training Statistics' view: