UoaWDCC / ASPA-EnrollmentForm

6 stars 1 forks source link

[ASPA-020] Preventing duplicated entries #28

Closed MartinTiangco closed 4 years ago

MartinTiangco commented 4 years ago

Issue: Two issues:

  1. If a user has already paid for an event, we do not want them to pay again.
  2. Currently, every payment creates an entry in the Google Spreadsheet. This leads to many duplicate entries.

Solution: To fix Issue 1, modifications to the EnrollmentForm.php controller and Verification_Model have been made. Function has_user_paid_event has been made, similar to has_user_paid (for the membership). Function is_email_on_sheet has been modified to include two new parameters, sheetId and sheetName with MEMBERSHIP_SPREADSHEETID and MEMBERSHIP_SHEETNAME constants as defaults respectively. This calls is_email_on_sheet with additional parameters regarding to the spreadsheet being accessed. This call will access the Event Registration System spreadsheet. The validate() function in EnrollmentForm.php will now check has_user_paid_event. The error messages being displayed are in enrollmentForm.js

To fix Issue 2, Gsheet_Interface_Model.php and EnrollmentForm.php is also added. Added a function in Gsheet_Interface_Model.php called update_payment_method that updates the column F (the payment method) to the selected payment method. Added a check in EnrollmentForm.php for duplicated entries. If so, update_payment_method is called.

Risk area: Make sure there are no empty lines in the Google Sheet, for example: image For some reason, this breaks the functionality. However, this should not be a problem unless someone deletes a line manually.

Reviewed by: Lucas, Raymond, Anubhav, Daniel, Victor