Skip to content

Commit

Permalink
WP-796 - registration list needs to update on modal edits (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
chandra-tacc authored Dec 6, 2024
1 parent ce33aa2 commit dbd9210
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 284 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions apcd_cms/src/apps/admin_regis_table/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ def post(self, request, reg_id):
updated_entity_ids = {reg['entity_id'] for reg in reg_entities if 'entity_id' in reg and reg['entity_id'] >= 0}
updated_contact_ids = {con['contact_id'] for con in reg_contacts if 'contact_id' in con and con['contact_id'] >= 0}
# Retrieve existing IDs
for reg in get_registration_entities(reg_id):
logger.error(reg)
existing_entity_ids = {reg[3] for reg in get_registration_entities(reg_id)}
existing_contact_ids = {contact[0] for contact in get_registration_contacts(reg_id)}
# Find the deleted ones.
Expand Down
4 changes: 3 additions & 1 deletion apcd_cms/src/apps/utils/apcd_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ def get_registrations(reg_id=None, submitter_code=None):
registrations.registration_year
FROM registrations
{f"WHERE registration_id = {str(reg_id)}" if reg_id is not None else ''}
{f"LEFT JOIN registration_submitters on registrations.registration_id = registration_submitters.registration_id LEFT JOIN submitters ON registration_submitters.submitter_id = submitters.submitter_id WHERE submitter_code = ANY(%s) ORDER BY registrations.registration_id" if submitter_code is not None else ''}"""
{f"LEFT JOIN registration_submitters on registrations.registration_id = registration_submitters.registration_id LEFT JOIN submitters ON registration_submitters.submitter_id = submitters.submitter_id WHERE submitter_code = ANY(%s) ORDER BY registrations.registration_id" if submitter_code is not None else ''}
ORDER BY registrations.registration_id desc"""

cur = conn.cursor()
if submitter_code:
cur.execute(query, (submitter_code,))
Expand Down
11 changes: 9 additions & 2 deletions apcd_cms/src/client/src/hooks/registrations/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,15 @@ export function usePostRegistration() {
console.log(err);
},
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: ['submitter-registrations', 'admin-registrations'],
const keysToInvalidate = [
'admin-registrations',
'submitter-registrations',
];
keysToInvalidate.forEach((key) => {
queryClient.invalidateQueries({
queryKey: [key],
exact: false, // we do not know the parameters, so all keys are invalidated
});
});
},
});
Expand Down

0 comments on commit dbd9210

Please sign in to comment.