CSC/ECE 517 Spring 2023 - E2302

From Expertiza_Wiki
Jump to navigation Jump to search

E2302. Refactoring the Delayed Mailer and Scheduler

Topic Overview

Background


Prior Work

History: Previous projects

* E2253 [1]
* E2144 [2]
* E2273 [3]

Our Changes

Upon review of previous PRs, we found that the work was thorough, albeit a few test cases were failing, and comments and methods could be refactored better. Based on the prompts we got, we focussed on refactoring the create method of assignments controller, and assignments form, along with the refactoring of sidekiq-related files.

Below is the summary of all the changes as part of this PR.

Changes to spec/controllers/auth_controller_spec.rb

 #  Change Rationale Commit Link
1 We extracted the create method into multiple methods the current create method is long and have multiple complex references and if statements. We created separate helpers to simplify complex db context Commit
2 Used early return in case of errors We refactored the code such that the errors like the assignment already being present or the directory already being present were caught early in the code. It leads to cleaner code as well. Commit
3 Renamed variable names Some of the current variable names were ambiguous as to what they meant, (cur_questionnaire, cur_due, etc.) we renamed those names to be less ambiguous and state their function. Commit
4 Added comments to other helper methods Some functions had comments missing. Commit