<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vrcholay</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vrcholay"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Vrcholay"/>
	<updated>2026-07-21T12:29:46Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=147252</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=147252"/>
		<updated>2022-12-06T13:27:53Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Topic Overview ==&lt;br /&gt;
===Background===&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
===Prior Work===&lt;br /&gt;
The prior work which is the basis for this topic is linked here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]. This work was done in Fall of 2021, and achieved much of the desired functionality for this task. This prior work will be referenced several times within this documentation, as it has a more comprehensive explanation of the underlying design principles behind the views, controller, model, algorithm, and RSpec tests implemented. These details will only be briefly summarized here. &lt;br /&gt;
&lt;br /&gt;
This prior implementation was rejected due to lack of method comments and a failing test, and so correcting the test and adding method comments--and explaining how those corrections were done--will be the major focus of this project documentation.&lt;br /&gt;
&lt;br /&gt;
The work in [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2253] was rejected because it included code changes in files that were deemed by Dr. Gehringer to be unnecessary and unassociated with the core functionality of this feature. Additionally, some of the comments are shallow and not insightful enough according to Dr. Gehringer.&lt;br /&gt;
&lt;br /&gt;
=== History: Previous projects ===&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&amp;lt;li&amp;gt; This project used the Sidekiq gem to asynchronously handle email tasks, which is sort of similar to E2135. Sidekiq was partially merged before, but this project changes the queue setup slightly. The refactor of methods in assignment_form.rb is significant, and several methods were moved to due_date.rb. It also adds reminder functionality to mail_worker, which also conflicts with E2135. Significant spec additions have been made from what exists in beta. Overall, code looks appropriate and well-written. Sidekiq needs to be started in the background while Expertiza is running, but since Sidekiq was already partially merged, I think this should be expected. ''After viewing the peer reviews and newest Travis run, this appears almost ready to merge. Peer reviewers believe it is a quality project, but note that several methods lack method comments. The travis build has a single small error in models (assignment_form_spec.rb)''.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files involved (some changed should not have been changed):&lt;br /&gt;
&amp;lt;li&amp;gt; app/controllers/assignments_controller.rb&lt;br /&gt;
&amp;lt;li&amp;gt; app/mailers/mail_worker.rb&lt;br /&gt;
&amp;lt;li&amp;gt; app/models/assignment_form.rb&lt;br /&gt;
&amp;lt;li&amp;gt; config/sidekiq.yml&lt;br /&gt;
&amp;lt;li&amp;gt; spec/models/assignment_form_spec.rb&lt;br /&gt;
&amp;lt;li&amp;gt; spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;li&amp;gt; spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The code for the prior PR is linked here [https://github.com/expertiza/expertiza/pull/2089 is linked here].&lt;br /&gt;
&lt;br /&gt;
==Explanation of Feature==&lt;br /&gt;
Mailer/mailing is referring to the sending of emails to email address associated with expertiza account. There are two types of mailing: '''synchronous and asynchronous'''. Synchronous mailing occurs after an action is taken e.g., an email that notifies when a change is made to a document. Asynchronous mailing occurs during a set time e.g., a notification email to warn students when a deadline is approaching.&lt;br /&gt;
&lt;br /&gt;
=== Summary of Work Needed ===&lt;br /&gt;
&lt;br /&gt;
After discussing with our project mentor and Dr. Gehringer, we discovered that what needed to be done is refining the reason why the previous PR was not deemed production-ready and resolve those issues in order to merge to main:&lt;br /&gt;
&amp;lt;li&amp;gt; Add insightful method comments&lt;br /&gt;
&amp;lt;li&amp;gt; Limit changes to delayed_mailer.rb and scheduled_task.rb (this means removing any changes to assignments_controller.rb and assignment_form.rb&lt;br /&gt;
&amp;lt;li&amp;gt; Increase test coverage for above files&lt;br /&gt;
&amp;lt;li&amp;gt; Fix failing test in assignment_form_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In terms of functionality, Dr. Gehringer mentioned that asynchronous mailing is having issues e.g., not sending out an assignment deadline notification a day before it is due. If there is time, the team may debug and work to fix this. If the team is unable to resolve, this may be passed on to future teams. Dr. Gehringer did not specify if it is within scope of this project.&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mailer.rb===&lt;br /&gt;
 * '''Proposed Solution''': Add insightful comments to each method.&lt;br /&gt;
 * '''Solution Implemented''': Added meaningful comments to every major line in the mailer.rb file to reflect the functionality and purpose of each method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Fix the failing existing tests.&lt;br /&gt;
 * '''Solution Implemented''': Changed the email from expertiza.development@gmail.com to expertiza.debugging@gmail.com. Generated an email with the appropriate body, instead of a nil object. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should have sent welcome email after user was created&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      email = Mailer.sync_message(&lt;br /&gt;
        to: 'tluo@ncsu.edu',&lt;br /&gt;
        subject: 'Your Expertiza account and password has been created',&lt;br /&gt;
        body: {&lt;br /&gt;
          obj_name: 'assignment',&lt;br /&gt;
          type: 'submission',&lt;br /&gt;
          location: '1',&lt;br /&gt;
          first_name: 'User',&lt;br /&gt;
          partial_name: 'update'&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.to[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Your Expertiza account and password has been created&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'should send reminder email to required email address with proper content' do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;metareview&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(1)&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.bcc[0]).to eq(&amp;quot;psingh22@ncsu.edu&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Message regarding teammate review for assignment no assignment&amp;quot;)&lt;br /&gt;
      expect(email.body).to eq(&amp;quot;This is a reminder to complete teammate review for assignment no assignment.\nPlease follow the link: http://expertiza.ncsu.edu/student_task/view?id=1\nDeadline is 2018-12-31 00:00:01. If you have already done the teammate review, then please ignore this mail.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
 * '''Solution Implemented''': Added the following tests:&lt;br /&gt;
1. Test to check an email is not sent when there is deadline with outstanding reviews.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should not return email if deadline is drop_outstanding_reviews&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;drop_outstanding_reviews&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(0)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
2. Test to check if the size of the queue is increased when Mailworker is used.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should increase the size of queue by 1 when MailWorker is used&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(1, 'review', '2022-12-05 00:00:01')&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(1)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:E2273_mailer_spec.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should have sent welcome email after user was created&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      email = Mailer.sync_message(&lt;br /&gt;
        to: 'tluo@ncsu.edu',&lt;br /&gt;
        subject: 'Your Expertiza account and password has been created',&lt;br /&gt;
        body: {&lt;br /&gt;
          obj_name: 'assignment',&lt;br /&gt;
          type: 'submission',&lt;br /&gt;
          location: '1',&lt;br /&gt;
          first_name: 'User',&lt;br /&gt;
          partial_name: 'update'&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.to[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Your Expertiza account and password has been created&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
=== Test all new worker classes to ensure Sidekiq jobs were being dequeued and run as expected ===&lt;br /&gt;
==== Sidekiq setup ====&lt;br /&gt;
In order to test the Sidekiq workers, we needed to run Sidekiq (steps were obtained from [https://tudip.com/blog-post/how-to-use-sidekiq-in-rails-for-background-processing/ this site]):&lt;br /&gt;
# In a terminal separate from the one in which the main rails application is running, run&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle exec sidekiq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This Sidekiq-specific terminal will show logs and printed statements from the workers.&lt;br /&gt;
&lt;br /&gt;
NB: To create a generic sidekiq worker to test with, you could use&lt;br /&gt;
&amp;lt;pre&amp;gt;rails g sidekiq:worker TestWorker&amp;lt;/pre&amp;gt;&lt;br /&gt;
to create a shell worker class.&lt;br /&gt;
&lt;br /&gt;
===== Sidekiq UI =====&lt;br /&gt;
To see which messages were being enqueued and dequeued in Sidekiq, we use the Sidekiq user interface, which can be accessed via the &amp;lt;code&amp;gt;/sidekiq&amp;lt;/code&amp;gt; route of the application.&lt;br /&gt;
[[File:Sidekiq-ui.png|950px|The Sidekiq UI]]&lt;br /&gt;
&lt;br /&gt;
==== SimicheckWorker Test ====&lt;br /&gt;
To enqueue a Simicheck job:&lt;br /&gt;
# Edit an assignment.&lt;br /&gt;
# Select the &amp;lt;code&amp;gt;Use simicheck?&amp;lt;/code&amp;gt; box.&lt;br /&gt;
# Set &amp;lt;code&amp;gt;Simicheck Delay&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; (or to a nonzero value to observe a delay).&lt;br /&gt;
# Set the SimiCheck Similarity Threshold to a nonzero value.&lt;br /&gt;
# Ensure the Late Policy is set to &amp;lt;code&amp;gt;--None--&amp;lt;/code&amp;gt; under the Due Dates tab. If there is a late policy set, per pre-existing code, the enqueued SimicheckWorker job will be deleted and will not appear in the Sidekiq UI (unless it is dequeued quickly, before the code can delete the jobs in the queue).&lt;br /&gt;
# Click &amp;lt;code&amp;gt;Save&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Observe a Simicheck Worker job enqueued and dequeued in the Sidekiq UI.&lt;br /&gt;
&lt;br /&gt;
[[File:Enqueue-simicheck-job.png|500px|How to Enqueue a Simicheck Worker Job]]&lt;br /&gt;
&lt;br /&gt;
[[File:simicheck-job-enqueued.png|950px|How to Enqueue a Simicheck Worker Job]]&lt;br /&gt;
&lt;br /&gt;
==== MailWorker and DropOustandingReviews Test ====&lt;br /&gt;
The Mail Worker sends out notifications to students if the due date of an assignment is changed. Drop Outstanding Reviews Worker drops all reviews that had not been worked on before the due date was changed. These both can be tested together, as when an assignment with a review is updated, Sidekiq should queue both the jobs for Mail Worker and Drop Outstanding Reviews Worker. To test these:&lt;br /&gt;
# Log into Expertiza as an instructor.&lt;br /&gt;
# Navigate to '''Manage'''&amp;gt;'''Assignments''' in the navigation.&lt;br /&gt;
# Click the plus button in the top right corner on the '''Manage Assignments''' and create an assignment with default settings. &lt;br /&gt;
# Go to the '''Due Dates''' tab and assign due dates for both the assignment and the review.&lt;br /&gt;
# Select a late policy next to '''Apply penalty policy:'''. If a late policy has not been created, press '''New Late Policy''' and follow the steps for creating a late policy.&lt;br /&gt;
# Assign student7613 to the assignment you created by clicking the person with the plus icon in the icons next to the assignment on the '''Manage Assignments''' page. &lt;br /&gt;
# Edit the assignment, go to the due dates tab, and change the due date on the review to be a day ahead of its current due date, and press save. The assignment due date must be changed to a time at least an hour ahead of the current time for the job to be queued.&lt;br /&gt;
# To ensure that the assignments are now queued on Sidekiq, visit the Sidekiq UI by going to [Expertiza VCL URL]/sidekiq.&lt;br /&gt;
# Upon arriving on this page, verify that the jobs added to the queue were correct by clicking to '''Scheduled'''. After arriving on this page, you should see something like the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Sidekiq-jobs.png|950px|Sidekiq jobs]]&lt;br /&gt;
&lt;br /&gt;
The job '''MailWorker''' that had been queued successfully shows that our refactoring of Mail Worker had worked properly and the Mail Worker was operational. The job '''DropOutstandingReviewsWorker''' showed that our refactoring of Drop Outstanding Reviews Worker had also been done correctly.&lt;br /&gt;
&lt;br /&gt;
'''Functional Tests'''&lt;br /&gt;
&lt;br /&gt;
Functional testing is done by manually checking to see if Sidekiq tasks were queued as expected when changes to assignments were made. The three important functional tests that we decided needed to be verified were that the Simicheck Worker was queuing, the Mail Worker was queueing, and the Drop Outstanding Reviews Worker was queuing. These could be considered verified under the condition that the '''When''' field, '''Job''' field, and '''Arguments''' field in the Sidekiq view all came out as expected. A previously implemented test for Simicheck was commented out as advised by Dr. Gehringer, because it has a helper function dependency called PlagiarismCheckerHelper. According to Dr. Gehringer, in PlagiarismCheckerHelper, the request &amp;quot;variable is supposed to contain an http request for running the plagiarism checker.  The checker has not been used for several years.  It will not hurt anything important if it does not work now.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2478 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=147064</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=147064"/>
		<updated>2022-12-05T13:39:06Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: /* Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Topic Overview ==&lt;br /&gt;
===Background===&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
===Prior Work===&lt;br /&gt;
The prior work which is the basis for this topic is linked here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]. This work was done in Fall of 2021, and achieved much of the desired functionality for this task. This prior work will be referenced several times within this documentation, as it has a more comprehensive explanation of the underlying design principles behind the views, controller, model, algorithm, and RSpec tests implemented. These details will only be briefly summarized here. &lt;br /&gt;
&lt;br /&gt;
This prior implementation was rejected due to lack of method comments and a failing test, and so correcting the test and adding method comments--and explaining how those corrections were done--will be the major focus of this project documentation.&lt;br /&gt;
&lt;br /&gt;
The work in [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2253] was rejected because it included code changes in files that were deemed by Dr. Gehringer to be unnecessary and unassociated with the core functionality of this feature. Additionally, some of the comments are shallow and not insightful enough according to Dr. Gehringer.&lt;br /&gt;
&lt;br /&gt;
=== History: Previous projects ===&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&amp;lt;li&amp;gt; This project used the Sidekiq gem to asynchronously handle email tasks, which is sort of similar to E2135. Sidekiq was partially merged before, but this project changes the queue setup slightly. The refactor of methods in assignment_form.rb is significant, and several methods were moved to due_date.rb. It also adds reminder functionality to mail_worker, which also conflicts with E2135. Significant spec additions have been made from what exists in beta. Overall, code looks appropriate and well-written. Sidekiq needs to be started in the background while Expertiza is running, but since Sidekiq was already partially merged, I think this should be expected. ''After viewing the peer reviews and newest Travis run, this appears almost ready to merge. Peer reviewers believe it is a quality project, but note that several methods lack method comments. The travis build has a single small error in models (assignment_form_spec.rb)''.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files involved (some changed should not have been changed):&lt;br /&gt;
&amp;lt;li&amp;gt; app/controllers/assignments_controller.rb&lt;br /&gt;
&amp;lt;li&amp;gt; app/mailers/mail_worker.rb&lt;br /&gt;
&amp;lt;li&amp;gt; app/models/assignment_form.rb&lt;br /&gt;
&amp;lt;li&amp;gt; config/sidekiq.yml&lt;br /&gt;
&amp;lt;li&amp;gt; spec/models/assignment_form_spec.rb&lt;br /&gt;
&amp;lt;li&amp;gt; spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;li&amp;gt; spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The code for the prior PR is linked here [https://github.com/expertiza/expertiza/pull/2089 is linked here].&lt;br /&gt;
&lt;br /&gt;
==Explanation of Feature==&lt;br /&gt;
Mailer/mailing is referring to the sending of emails to email address associated with expertiza account. There are two types of mailing: '''synchronous and asynchronous'''. Synchronous mailing occurs after an action is taken e.g., an email that notifies when a change is made to a document. Asynchronous mailing occurs during a set time e.g., a notification email to warn students when a deadline is approaching.&lt;br /&gt;
&lt;br /&gt;
=== Summary of Work Needed ===&lt;br /&gt;
&lt;br /&gt;
After discussing with our project mentor and Dr. Gehringer, we discovered that what needed to be done is refining the reason why the previous PR was not deemed production-ready and resolve those issues in order to merge to main:&lt;br /&gt;
&amp;lt;li&amp;gt; Add insightful method comments&lt;br /&gt;
&amp;lt;li&amp;gt; Limit changes to delayed_mailer.rb and scheduled_task.rb (this means removing any changes to assignments_controller.rb and assignment_form.rb&lt;br /&gt;
&amp;lt;li&amp;gt; Increase test coverage for above files&lt;br /&gt;
&amp;lt;li&amp;gt; Fix failing test in assignment_form_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In terms of functionality, Dr. Gehringer mentioned that asynchronous mailing is having issues e.g., not sending out an assignment deadline notification a day before it is due. If there is time, the team may debug and work to fix this. If the team is unable to resolve, this may be passed on to future teams. Dr. Gehringer did not specify if it is within scope of this project.&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mailer.rb===&lt;br /&gt;
 * '''Proposed Solution''': Add insightful comments to each method.&lt;br /&gt;
 * '''Solution Implemented''': Added meaningful comments to every major line in the mailer.rb file to reflect the functionality and purpose of each method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Fix the failing existing tests.&lt;br /&gt;
 * '''Solution Implemented''': Changed the email from expertiza.development@gmail.com to expertiza.debugging@gmail.com. Generated an email with the appropriate body, instead of a nil object. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should have sent welcome email after user was created&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      email = Mailer.sync_message(&lt;br /&gt;
        to: 'tluo@ncsu.edu',&lt;br /&gt;
        subject: 'Your Expertiza account and password has been created',&lt;br /&gt;
        body: {&lt;br /&gt;
          obj_name: 'assignment',&lt;br /&gt;
          type: 'submission',&lt;br /&gt;
          location: '1',&lt;br /&gt;
          first_name: 'User',&lt;br /&gt;
          partial_name: 'update'&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.to[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Your Expertiza account and password has been created&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'should send reminder email to required email address with proper content' do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;metareview&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(1)&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.bcc[0]).to eq(&amp;quot;psingh22@ncsu.edu&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Message regarding teammate review for assignment no assignment&amp;quot;)&lt;br /&gt;
      expect(email.body).to eq(&amp;quot;This is a reminder to complete teammate review for assignment no assignment.\nPlease follow the link: http://expertiza.ncsu.edu/student_task/view?id=1\nDeadline is 2018-12-31 00:00:01. If you have already done the teammate review, then please ignore this mail.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
 * '''Solution Implemented''': Added the following tests:&lt;br /&gt;
1. Test to check an email is not sent when there is deadline with outstanding reviews.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should not return email if deadline is drop_outstanding_reviews&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;drop_outstanding_reviews&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(0)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
2. Test to check if the size of the queue is increased when Mailworker is used.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should increase the size of queue by 1 when MailWorker is used&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(1, 'review', '2022-12-05 00:00:01')&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(1)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:E2273_mailer_spec.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should have sent welcome email after user was created&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      email = Mailer.sync_message(&lt;br /&gt;
        to: 'tluo@ncsu.edu',&lt;br /&gt;
        subject: 'Your Expertiza account and password has been created',&lt;br /&gt;
        body: {&lt;br /&gt;
          obj_name: 'assignment',&lt;br /&gt;
          type: 'submission',&lt;br /&gt;
          location: '1',&lt;br /&gt;
          first_name: 'User',&lt;br /&gt;
          partial_name: 'update'&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.to[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Your Expertiza account and password has been created&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
'''Functional Tests'''&lt;br /&gt;
&lt;br /&gt;
Functional testing is done by manually checking to see if Sidekiq tasks were queued as expected when changes to assignments were made. The three important functional tests that we decided needed to be verified were that the Simicheck Worker was queuing, the Mail Worker was queueing, and the Drop Outstanding Reviews Worker was queuing. These could be considered verified under the condition that the '''When''' field, '''Job''' field, and '''Arguments''' field in the Sidekiq view all came out as expected. A previously implemented test for Simicheck was commented out as advised by Dr. Gehringer, because it has a helper function dependency called PlagiarismCheckerHelper. According to Dr. Gehringer, in PlagiarismCheckerHelper, the request &amp;quot;variable is supposed to contain an http request for running the plagiarism checker.  The checker has not been used for several years.  It will not hurt anything important if it does not work now.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2478 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=147063</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=147063"/>
		<updated>2022-12-05T12:48:53Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: /* Problem 1: Add insightful comments to the methods in mail_worker.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Topic Overview ==&lt;br /&gt;
===Background===&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
===Prior Work===&lt;br /&gt;
The prior work which is the basis for this topic is linked here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]. This work was done in Fall of 2021, and achieved much of the desired functionality for this task. This prior work will be referenced several times within this documentation, as it has a more comprehensive explanation of the underlying design principles behind the views, controller, model, algorithm, and RSpec tests implemented. These details will only be briefly summarized here. &lt;br /&gt;
&lt;br /&gt;
This prior implementation was rejected due to lack of method comments and a failing test, and so correcting the test and adding method comments--and explaining how those corrections were done--will be the major focus of this project documentation.&lt;br /&gt;
&lt;br /&gt;
The work in [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2253] was rejected because it included code changes in files that were deemed by Dr. Gehringer to be unnecessary and unassociated with the core functionality of this feature. Additionally, some of the comments are shallow and not insightful enough according to Dr. Gehringer.&lt;br /&gt;
&lt;br /&gt;
=== History: Previous projects ===&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&amp;lt;li&amp;gt; This project used the Sidekiq gem to asynchronously handle email tasks, which is sort of similar to E2135. Sidekiq was partially merged before, but this project changes the queue setup slightly. The refactor of methods in assignment_form.rb is significant, and several methods were moved to due_date.rb. It also adds reminder functionality to mail_worker, which also conflicts with E2135. Significant spec additions have been made from what exists in beta. Overall, code looks appropriate and well-written. Sidekiq needs to be started in the background while Expertiza is running, but since Sidekiq was already partially merged, I think this should be expected. ''After viewing the peer reviews and newest Travis run, this appears almost ready to merge. Peer reviewers believe it is a quality project, but note that several methods lack method comments. The travis build has a single small error in models (assignment_form_spec.rb)''.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files involved (some changed should not have been changed):&lt;br /&gt;
&amp;lt;li&amp;gt; app/controllers/assignments_controller.rb&lt;br /&gt;
&amp;lt;li&amp;gt; app/mailers/mail_worker.rb&lt;br /&gt;
&amp;lt;li&amp;gt; app/models/assignment_form.rb&lt;br /&gt;
&amp;lt;li&amp;gt; config/sidekiq.yml&lt;br /&gt;
&amp;lt;li&amp;gt; spec/models/assignment_form_spec.rb&lt;br /&gt;
&amp;lt;li&amp;gt; spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;li&amp;gt; spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The code for the prior PR is linked here [https://github.com/expertiza/expertiza/pull/2089 is linked here].&lt;br /&gt;
&lt;br /&gt;
==Explanation of Feature==&lt;br /&gt;
Mailer/mailing is referring to the sending of emails to email address associated with expertiza account. There are two types of mailing: '''synchronous and asynchronous'''. Synchronous mailing occurs after an action is taken e.g., an email that notifies when a change is made to a document. Asynchronous mailing occurs during a set time e.g., a notification email to warn students when a deadline is approaching.&lt;br /&gt;
&lt;br /&gt;
=== Summary of Work Needed ===&lt;br /&gt;
&lt;br /&gt;
After discussing with our project mentor and Dr. Gehringer, we discovered that what needed to be done is refining the reason why the previous PR was not deemed production-ready and resolve those issues in order to merge to main:&lt;br /&gt;
&amp;lt;li&amp;gt; Add insightful method comments&lt;br /&gt;
&amp;lt;li&amp;gt; Limit changes to delayed_mailer.rb and scheduled_task.rb (this means removing any changes to assignments_controller.rb and assignment_form.rb&lt;br /&gt;
&amp;lt;li&amp;gt; Increase test coverage for above files&lt;br /&gt;
&amp;lt;li&amp;gt; Fix failing test in assignment_form_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In terms of functionality, Dr. Gehringer mentioned that asynchronous mailing is having issues e.g., not sending out an assignment deadline notification a day before it is due. If there is time, the team may debug and work to fix this. If the team is unable to resolve, this may be passed on to future teams. Dr. Gehringer did not specify if it is within scope of this project.&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mailer.rb===&lt;br /&gt;
 * '''Proposed Solution''': Add insightful comments to each method.&lt;br /&gt;
 * '''Solution Implemented''': Added meaningful comments to every major line in the mailer.rb file to reflect the functionality and purpose of each method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Fix the failing existing tests.&lt;br /&gt;
 * '''Solution Implemented''': Changed the email from expertiza.development@gmail.com to expertiza.debugging@gmail.com. Generated an email with the appropriate body, instead of a nil object. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should have sent welcome email after user was created&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      email = Mailer.sync_message(&lt;br /&gt;
        to: 'tluo@ncsu.edu',&lt;br /&gt;
        subject: 'Your Expertiza account and password has been created',&lt;br /&gt;
        body: {&lt;br /&gt;
          obj_name: 'assignment',&lt;br /&gt;
          type: 'submission',&lt;br /&gt;
          location: '1',&lt;br /&gt;
          first_name: 'User',&lt;br /&gt;
          partial_name: 'update'&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.to[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Your Expertiza account and password has been created&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'should send reminder email to required email address with proper content' do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;metareview&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(1)&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.bcc[0]).to eq(&amp;quot;psingh22@ncsu.edu&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Message regarding teammate review for assignment no assignment&amp;quot;)&lt;br /&gt;
      expect(email.body).to eq(&amp;quot;This is a reminder to complete teammate review for assignment no assignment.\nPlease follow the link: http://expertiza.ncsu.edu/student_task/view?id=1\nDeadline is 2018-12-31 00:00:01. If you have already done the teammate review, then please ignore this mail.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
 * '''Solution Implemented''': Added the following tests:&lt;br /&gt;
1. Test to check an email is not sent when there is deadline with outstanding reviews.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should not return email if deadline is drop_outstanding_reviews&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;drop_outstanding_reviews&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(0)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:E2273_mailer_spec.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should have sent welcome email after user was created&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      email = Mailer.sync_message(&lt;br /&gt;
        to: 'tluo@ncsu.edu',&lt;br /&gt;
        subject: 'Your Expertiza account and password has been created',&lt;br /&gt;
        body: {&lt;br /&gt;
          obj_name: 'assignment',&lt;br /&gt;
          type: 'submission',&lt;br /&gt;
          location: '1',&lt;br /&gt;
          first_name: 'User',&lt;br /&gt;
          partial_name: 'update'&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.to[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Your Expertiza account and password has been created&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
'''Functional Tests'''&lt;br /&gt;
&lt;br /&gt;
Functional testing is done by manually checking to see if Sidekiq tasks were queued as expected when changes to assignments were made. The three important functional tests that we decided needed to be verified were that the Simicheck Worker was queuing, the Mail Worker was queueing, and the Drop Outstanding Reviews Worker was queuing. These could be considered verified under the condition that the '''When''' field, '''Job''' field, and '''Arguments''' field in the Sidekiq view all came out as expected. A previously implemented test for Simicheck was commented out as advised by Dr. Gehringer, because it has a helper function dependency called PlagiarismCheckerHelper. According to Dr. Gehringer, in PlagiarismCheckerHelper, the request &amp;quot;variable is supposed to contain an http request for running the plagiarism checker.  The checker has not been used for several years.  It will not hurt anything important if it does not work now.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2478 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146745</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146745"/>
		<updated>2022-11-16T23:29:33Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: /* Automated Testing using RSPEC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mail_worker.rb===&lt;br /&gt;
 * '''Proposed Solution''': Add insightful comments to each method.&lt;br /&gt;
 * '''Solution Implemented''': Added meaningful comments to every major line in the mail worker.rb file to reflect the functionality and purpose of each method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Fix the failing existing tests.&lt;br /&gt;
 * '''Solution Implemented''': Changed the email from expertiza.development@gmail.com to expertiza.debugging@gmail.com. Generated an email with the appropriate body, instead of a nil object. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should have sent welcome email after user was created&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      email = Mailer.sync_message(&lt;br /&gt;
        to: 'tluo@ncsu.edu',&lt;br /&gt;
        subject: 'Your Expertiza account and password has been created',&lt;br /&gt;
        body: {&lt;br /&gt;
          obj_name: 'assignment',&lt;br /&gt;
          type: 'submission',&lt;br /&gt;
          location: '1',&lt;br /&gt;
          first_name: 'User',&lt;br /&gt;
          partial_name: 'update'&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.to[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Your Expertiza account and password has been created&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'should send reminder email to required email address with proper content' do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;metareview&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(1)&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.bcc[0]).to eq(&amp;quot;psingh22@ncsu.edu&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Message regarding teammate review for assignment no assignment&amp;quot;)&lt;br /&gt;
      expect(email.body).to eq(&amp;quot;This is a reminder to complete teammate review for assignment no assignment.\nPlease follow the link: http://expertiza.ncsu.edu/student_task/view?id=1\nDeadline is 2018-12-31 00:00:01. If you have already done the teammate review, then please ignore this mail.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
 * '''Solution Implemented''': Added the following tests:&lt;br /&gt;
1. Test to check an email is not sent when there is deadline with outstanding reviews.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should not return email if deadline is drop_outstanding_reviews&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;drop_outstanding_reviews&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(0)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
1. Test to check an email is not sent when there is deadline with outstanding reviews.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2478 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146744</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146744"/>
		<updated>2022-11-16T23:28:58Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: /* Problem 1: Add insightful comments to the methods in mail_worker.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mail_worker.rb===&lt;br /&gt;
 * '''Proposed Solution''': Add insightful comments to each method.&lt;br /&gt;
 * '''Solution Implemented''': Added meaningful comments to every major line in the mail worker.rb file to reflect the functionality and purpose of each method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Fix the failing existing tests.&lt;br /&gt;
 * '''Solution Implemented''': Changed the email from expertiza.development@gmail.com to expertiza.debugging@gmail.com. Generated an email with the appropriate body, instead of a nil object. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should have sent welcome email after user was created&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      email = Mailer.sync_message(&lt;br /&gt;
        to: 'tluo@ncsu.edu',&lt;br /&gt;
        subject: 'Your Expertiza account and password has been created',&lt;br /&gt;
        body: {&lt;br /&gt;
          obj_name: 'assignment',&lt;br /&gt;
          type: 'submission',&lt;br /&gt;
          location: '1',&lt;br /&gt;
          first_name: 'User',&lt;br /&gt;
          partial_name: 'update'&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.to[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Your Expertiza account and password has been created&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'should send reminder email to required email address with proper content' do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;metareview&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(1)&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.bcc[0]).to eq(&amp;quot;psingh22@ncsu.edu&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Message regarding teammate review for assignment no assignment&amp;quot;)&lt;br /&gt;
      expect(email.body).to eq(&amp;quot;This is a reminder to complete teammate review for assignment no assignment.\nPlease follow the link: http://expertiza.ncsu.edu/student_task/view?id=1\nDeadline is 2018-12-31 00:00:01. If you have already done the teammate review, then please ignore this mail.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
 * '''Solution Implemented''': Added the following tests:&lt;br /&gt;
1. Test to check an email is not sent when there is deadline with outstanding reviews.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should not return email if deadline is drop_outstanding_reviews&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;drop_outstanding_reviews&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(0)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2478 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146743</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146743"/>
		<updated>2022-11-16T23:28:24Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: /* Problem 1: Add insightful comments to the methods in mail_worker.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mail_worker.rb===&lt;br /&gt;
 * '''Proposed Solution''': Add insightful comments to each method.&lt;br /&gt;
 * '''Solution Implemented''': Added meaningful comments to every major line in the mail_worker.rb file to reflect what each and every methods functionality and purpose.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Fix the failing existing tests.&lt;br /&gt;
 * '''Solution Implemented''': Changed the email from expertiza.development@gmail.com to expertiza.debugging@gmail.com. Generated an email with the appropriate body, instead of a nil object. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should have sent welcome email after user was created&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      email = Mailer.sync_message(&lt;br /&gt;
        to: 'tluo@ncsu.edu',&lt;br /&gt;
        subject: 'Your Expertiza account and password has been created',&lt;br /&gt;
        body: {&lt;br /&gt;
          obj_name: 'assignment',&lt;br /&gt;
          type: 'submission',&lt;br /&gt;
          location: '1',&lt;br /&gt;
          first_name: 'User',&lt;br /&gt;
          partial_name: 'update'&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.to[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Your Expertiza account and password has been created&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'should send reminder email to required email address with proper content' do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;metareview&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(1)&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.bcc[0]).to eq(&amp;quot;psingh22@ncsu.edu&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Message regarding teammate review for assignment no assignment&amp;quot;)&lt;br /&gt;
      expect(email.body).to eq(&amp;quot;This is a reminder to complete teammate review for assignment no assignment.\nPlease follow the link: http://expertiza.ncsu.edu/student_task/view?id=1\nDeadline is 2018-12-31 00:00:01. If you have already done the teammate review, then please ignore this mail.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
 * '''Solution Implemented''': Added the following tests:&lt;br /&gt;
1. Test to check an email is not sent when there is deadline with outstanding reviews.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should not return email if deadline is drop_outstanding_reviews&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;drop_outstanding_reviews&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(0)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2478 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146742</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146742"/>
		<updated>2022-11-16T23:26:51Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: /* Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mail_worker.rb===&lt;br /&gt;
 * '''Proposed Solution''': Add insightful comments to each method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Fix the failing existing tests.&lt;br /&gt;
 * '''Solution Implemented''': Changed the email from expertiza.development@gmail.com to expertiza.debugging@gmail.com. Generated an email with the appropriate body, instead of a nil object. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should have sent welcome email after user was created&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      email = Mailer.sync_message(&lt;br /&gt;
        to: 'tluo@ncsu.edu',&lt;br /&gt;
        subject: 'Your Expertiza account and password has been created',&lt;br /&gt;
        body: {&lt;br /&gt;
          obj_name: 'assignment',&lt;br /&gt;
          type: 'submission',&lt;br /&gt;
          location: '1',&lt;br /&gt;
          first_name: 'User',&lt;br /&gt;
          partial_name: 'update'&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.to[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Your Expertiza account and password has been created&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'should send reminder email to required email address with proper content' do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;metareview&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(1)&lt;br /&gt;
      email = Mailer.deliveries.first&lt;br /&gt;
      expect(email.from[0]).to eq(&amp;quot;expertiza.debugging@gmail.com&amp;quot;)&lt;br /&gt;
      expect(email.bcc[0]).to eq(&amp;quot;psingh22@ncsu.edu&amp;quot;)&lt;br /&gt;
      expect(email.subject).to eq(&amp;quot;Message regarding teammate review for assignment no assignment&amp;quot;)&lt;br /&gt;
      expect(email.body).to eq(&amp;quot;This is a reminder to complete teammate review for assignment no assignment.\nPlease follow the link: http://expertiza.ncsu.edu/student_task/view?id=1\nDeadline is 2018-12-31 00:00:01. If you have already done the teammate review, then please ignore this mail.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
 * '''Solution Implemented''': Added the following tests:&lt;br /&gt;
1. Test to check an email is not sent when there is deadline with outstanding reviews.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should not return email if deadline is drop_outstanding_reviews&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;drop_outstanding_reviews&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(0)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2478 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146741</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146741"/>
		<updated>2022-11-16T23:23:23Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: /* Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mail_worker.rb===&lt;br /&gt;
 * '''Proposed Solution''': Add insightful comments to each method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Comment out or Fix the failing existing tests.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
 * '''Solution Implemented''': Added the following tests:&lt;br /&gt;
1. Test to check an email is not sent when there is deadline with outstanding reviews.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should not return email if deadline is drop_outstanding_reviews&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;drop_outstanding_reviews&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(0)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2478 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146740</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146740"/>
		<updated>2022-11-16T23:23:03Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mail_worker.rb===&lt;br /&gt;
 * '''Proposed Solution''': Add insightful comments to each method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Comment out or Fix the failing existing tests.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
 * '''Solution Implemented''': Added the following tests:&lt;br /&gt;
 &lt;br /&gt;
1. Test to check an email is not sent when there is deadline with outstanding reviews.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it &amp;quot;should not return email if deadline is drop_outstanding_reviews&amp;quot; do&lt;br /&gt;
      Sidekiq::Testing.inline!&lt;br /&gt;
      Mailer.deliveries.clear&lt;br /&gt;
      worker = MailWorker.new&lt;br /&gt;
      worker.perform(&amp;quot;1&amp;quot;, &amp;quot;drop_outstanding_reviews&amp;quot;, &amp;quot;2018-12-31 00:00:01&amp;quot;)&lt;br /&gt;
      expect(Mailer.deliveries.size).to eq(0)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2478 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022&amp;diff=146733</id>
		<title>CSC/ECE 517 Fall 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022&amp;diff=146733"/>
		<updated>2022-11-16T21:17:04Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: /* Final Projects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2252. Refactor auth controller.rb &amp;amp; password retrieval controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2253.Refactor delayed mailer.rb and scheduled task.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2254: Refactor teams_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2255. Refactor student_quizzes_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2256: Refactor late_policies_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2257: Refactor questionnaires_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2258. Refactor submitted_content_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2260. Refactor review_mapping_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2255. Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2262: Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2263.Refactor student teams functionality]]&lt;br /&gt;
&lt;br /&gt;
== Final Projects ==&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2275. Further refactoring and improvement of student_quizzes controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2276. Fix &amp;quot;Back&amp;quot; link on “New Late Policy” page]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2277. Further Refactoring questionnaires_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2278. Improve assessment360 controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2279. Further refactoring and improvement of signup_sheet controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2281. Reimplement Waitlists]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2283. Refactor student_teams functionality]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2285. Grading audit trail]]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146727</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146727"/>
		<updated>2022-11-16T15:05:54Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mail_worker.rb===&lt;br /&gt;
 * '''Proposed Solution''': Add insightful comments to each method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Comment out or Fix the failing existing tests.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2478 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146726</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146726"/>
		<updated>2022-11-16T12:14:04Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mail_worker.rb===&lt;br /&gt;
 * '''Proposed Solution''': Add insightful comments to each method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Comment out or Fix the failing existing tests.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
==Automated Testing using RSPEC==&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing from UI==&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2478 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146725</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146725"/>
		<updated>2022-11-16T11:56:27Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: /* Problems and planned changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mail_worker.rb===&lt;br /&gt;
 * '''Proposed Solution''': Add insightful comments to each method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Comment out or Fix the failing existing tests.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
==Automated Testing using RSPEC==&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing from UI==&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2477 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146724</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146724"/>
		<updated>2022-11-16T11:51:15Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: /* Problems and planned changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mail_worker.rb===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks. Change the name of the variables to meaningful names in the method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Comment out or Fix the failing existing tests.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
==Automated Testing using RSPEC==&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing from UI==&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2477 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146723</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146723"/>
		<updated>2022-11-16T11:50:26Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Add insightful comments to the methods in mail_worker.rb===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks. Change the name of the variables to meaningful names in the method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Comment out or Fix the failing existing tests.&lt;br /&gt;
&lt;br /&gt;
=== Problem 4: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
==Automated Testing using RSPEC==&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing from UI==&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2477 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146579</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146579"/>
		<updated>2022-11-15T14:31:16Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Refactor the create method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks. Change the name of the variables to meaningful names in the method.&lt;br /&gt;
 * '''Solution Implemented''': Refactored the create method to split tasks into different methods and renamed a variable to correctly reflect its purpose.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # creates a new assignment via the assignment form&lt;br /&gt;
  def create&lt;br /&gt;
    @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
    if params[:button]&lt;br /&gt;
      # first check if assignment name exists, if not then create new, otherwise don't create new assignment&lt;br /&gt;
      find_existing_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      dir_path = assignment_form_params[:assignment][:directory_path]&lt;br /&gt;
      find_existing_directory = Assignment.find_by(directory_path: dir_path, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      if !find_existing_assignment &amp;amp;&amp;amp; !find_existing_directory &amp;amp;&amp;amp; @assignment_form.save # No existing names/directories&lt;br /&gt;
        assignment_creation_success&lt;br /&gt;
        # return&lt;br /&gt;
      else&lt;br /&gt;
        assignemnt_creation_failure(find_existing_assignment, dir_path, find_existing_directory)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  # create a new assignment via the assigment form if the new assignment name and directory doesn't exist&lt;br /&gt;
  def assignment_creation_success&lt;br /&gt;
    @assignment_form.create_assignment_node&lt;br /&gt;
    exist_assignment = Assignment.find(@assignment_form.assignment.id)&lt;br /&gt;
    assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
    if assignment_form_params[:assignment][:directory_path].blank? # No existing assignment for assignment form&lt;br /&gt;
      assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    assignment_form_params[:assignment_questionnaire] = assign_questionnaire_array(exist_assignment)&lt;br /&gt;
    assignment_form_params[:due_date] = assign_due_date_array(exist_assignment)&lt;br /&gt;
    @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
    assignment_id = Assignment.find(@assignment_form.assignment.id).id&lt;br /&gt;
    ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
    redirect_to edit_assignment_path assignment_id&lt;br /&gt;
    undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # raises a flash error messgae when it fails to create an assignment and redirect to assignement/new page &lt;br /&gt;
  def assignemnt_creation_failure(existing_assignment, dir_path, existing_directory)&lt;br /&gt;
    flash[:error] = 'Failed to create assignment.'&lt;br /&gt;
    if existing_assignment&lt;br /&gt;
      flash[:error] &amp;lt;&amp;lt; '&amp;lt;br&amp;gt;  ' + @assignment_form.assignment.name + ' already exists as an assignment name'&lt;br /&gt;
    end&lt;br /&gt;
    if existing_directory&lt;br /&gt;
      flash[:error] &amp;lt;&amp;lt; '&amp;lt;br&amp;gt;  ' + dir_path + ' already exists as a submission directory name'&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to '/assignments/new?private=1'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Refactor the edit_params_setting method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks.&lt;br /&gt;
 *'''Solution Implemented''': Refactored edit_params_setting by extracting functionality on setting submissions and review rounds.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def set_submissions_and_reviews_rounds&lt;br /&gt;
    # The submission round i.e. Round 1 (before 1st deadline), Round 2 (after first peer review, before 2nd deadline)&lt;br /&gt;
    @num_submissions_round = @assignment.find_due_dates('submission').nil? ? 0 : @assignment.find_due_dates('submission').count&lt;br /&gt;
    @num_reviews_round = @assignment.find_due_dates('review').nil? ? 0 : @assignment.find_due_dates('review').count&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  # populates values and settings of the assignment for editing&lt;br /&gt;
  def edit_params_setting&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: params[:id])&lt;br /&gt;
    @assignment_form = AssignmentForm.create_form_object(params[:id])&lt;br /&gt;
    @user = current_user&lt;br /&gt;
    &lt;br /&gt;
    set_submissions_and_reviews_rounds&lt;br /&gt;
&lt;br /&gt;
    @assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: params[:id])&lt;br /&gt;
    &lt;br /&gt;
    # Set due date&lt;br /&gt;
    @due_date_all = AssignmentDueDate.where(parent_id: params[:id])&lt;br /&gt;
    @due_date_nameurl_not_empty = false&lt;br /&gt;
    @due_date_nameurl_not_empty_checkbox = false&lt;br /&gt;
    &lt;br /&gt;
    # Set metareview (self-review)&lt;br /&gt;
    @metareview_allowed = false&lt;br /&gt;
    @metareview_allowed_checkbox = false&lt;br /&gt;
&lt;br /&gt;
    # Set up signup and drop topic&lt;br /&gt;
    @signup_allowed = false&lt;br /&gt;
    @signup_allowed_checkbox = false&lt;br /&gt;
    @drop_topic_allowed = false&lt;br /&gt;
    @drop_topic_allowed_checkbox = false&lt;br /&gt;
&lt;br /&gt;
    # Set up team formation&lt;br /&gt;
    @team_formation_allowed = false&lt;br /&gt;
    @team_formation_allowed_checkbox = false&lt;br /&gt;
&lt;br /&gt;
    # Set up participants and teams counts&lt;br /&gt;
    @participants_count = @assignment_form.assignment.participants.size&lt;br /&gt;
    @teams_count = @assignment_form.assignment.teams.size&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Fix Bugs in sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Comment out or Fix the failing existing tests.&lt;br /&gt;
&lt;br /&gt;
=== Problem 4: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
==Automated Testing using RSPEC==&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/models/assignment_form_spec.rb&lt;br /&gt;
&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing from UI==&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/team-E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2477 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146574</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146574"/>
		<updated>2022-11-15T14:02:47Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Refactor the create method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks. Change the name of the variables to meaningful names in the method.&lt;br /&gt;
 * '''Solution Implemented''': Refactored the create method to split tasks into different methods and renamed a variable to correctly reflect its purpose.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # creates a new assignment via the assignment form&lt;br /&gt;
  def create&lt;br /&gt;
    @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
    if params[:button]&lt;br /&gt;
      # first check if assignment name exists, if not then create new, otherwise don't create new assignment&lt;br /&gt;
      find_existing_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      dir_path = assignment_form_params[:assignment][:directory_path]&lt;br /&gt;
      find_existing_directory = Assignment.find_by(directory_path: dir_path, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      if !find_existing_assignment &amp;amp;&amp;amp; !find_existing_directory &amp;amp;&amp;amp; @assignment_form.save # No existing names/directories&lt;br /&gt;
        assignment_creation_success&lt;br /&gt;
        # return&lt;br /&gt;
      else&lt;br /&gt;
        assignemnt_creation_failure(find_existing_assignment, dir_path, find_existing_directory)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  # create a new assignment via the assigment form if the new assignment name and directory doesn't exist&lt;br /&gt;
  def assignment_creation_success&lt;br /&gt;
    @assignment_form.create_assignment_node&lt;br /&gt;
    exist_assignment = Assignment.find(@assignment_form.assignment.id)&lt;br /&gt;
    assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
    if assignment_form_params[:assignment][:directory_path].blank? # No existing assignment for assignment form&lt;br /&gt;
      assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    assignment_form_params[:assignment_questionnaire] = assign_questionnaire_array(exist_assignment)&lt;br /&gt;
    assignment_form_params[:due_date] = assign_due_date_array(exist_assignment)&lt;br /&gt;
    @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
    assignment_id = Assignment.find(@assignment_form.assignment.id).id&lt;br /&gt;
    ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
    redirect_to edit_assignment_path assignment_id&lt;br /&gt;
    undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # raises a flash error messgae when it fails to create an assignment and redirect to assignement/new page &lt;br /&gt;
  def assignemnt_creation_failure(existing_assignment, dir_path, existing_directory)&lt;br /&gt;
    flash[:error] = 'Failed to create assignment.'&lt;br /&gt;
    if existing_assignment&lt;br /&gt;
      flash[:error] &amp;lt;&amp;lt; '&amp;lt;br&amp;gt;  ' + @assignment_form.assignment.name + ' already exists as an assignment name'&lt;br /&gt;
    end&lt;br /&gt;
    if existing_directory&lt;br /&gt;
      flash[:error] &amp;lt;&amp;lt; '&amp;lt;br&amp;gt;  ' + dir_path + ' already exists as a submission directory name'&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to '/assignments/new?private=1'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Refactor the edit_params_setting method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks.&lt;br /&gt;
 *'''Solution Implemented''': Refactored edit_params_setting by extracting functionality on setting submissions and review rounds.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def set_submissions_and_reviews_rounds&lt;br /&gt;
    # The submission round i.e. Round 1 (before 1st deadline), Round 2 (after first peer review, before 2nd deadline)&lt;br /&gt;
    @num_submissions_round = @assignment.find_due_dates('submission').nil? ? 0 : @assignment.find_due_dates('submission').count&lt;br /&gt;
    @num_reviews_round = @assignment.find_due_dates('review').nil? ? 0 : @assignment.find_due_dates('review').count&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  # populates values and settings of the assignment for editing&lt;br /&gt;
  def edit_params_setting&lt;br /&gt;
    @assignment = Assignment.find(params[:id])&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: params[:id])&lt;br /&gt;
    @assignment_form = AssignmentForm.create_form_object(params[:id])&lt;br /&gt;
    @user = current_user&lt;br /&gt;
    &lt;br /&gt;
    set_submissions_and_reviews_rounds&lt;br /&gt;
&lt;br /&gt;
    @assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: params[:id])&lt;br /&gt;
    &lt;br /&gt;
    # Set due date&lt;br /&gt;
    @due_date_all = AssignmentDueDate.where(parent_id: params[:id])&lt;br /&gt;
    @due_date_nameurl_not_empty = false&lt;br /&gt;
    @due_date_nameurl_not_empty_checkbox = false&lt;br /&gt;
    &lt;br /&gt;
    # Set metareview (self-review)&lt;br /&gt;
    @metareview_allowed = false&lt;br /&gt;
    @metareview_allowed_checkbox = false&lt;br /&gt;
&lt;br /&gt;
    # Set up signup and drop topic&lt;br /&gt;
    @signup_allowed = false&lt;br /&gt;
    @signup_allowed_checkbox = false&lt;br /&gt;
    @drop_topic_allowed = false&lt;br /&gt;
    @drop_topic_allowed_checkbox = false&lt;br /&gt;
&lt;br /&gt;
    # Set up team formation&lt;br /&gt;
    @team_formation_allowed = false&lt;br /&gt;
    @team_formation_allowed_checkbox = false&lt;br /&gt;
&lt;br /&gt;
    # Set up participants and teams counts&lt;br /&gt;
    @participants_count = @assignment_form.assignment.participants.size&lt;br /&gt;
    @teams_count = @assignment_form.assignment.teams.size&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
==Automated Testing using RSPEC==&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/models/assignment_form_spec.rb&lt;br /&gt;
&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing from UI==&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/team-E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2477 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146392</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146392"/>
		<updated>2022-11-13T00:18:06Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Refactor the create method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks. Change the name of the variables to meaningful names in the method.&lt;br /&gt;
 * '''Solution Implemented''': Refactored the create method to split tasks into different methods and renamed a variable to correctly reflect its purpose.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # creates a new assignment via the assignment form&lt;br /&gt;
  def create&lt;br /&gt;
    @assignment_form = AssignmentForm.new(assignment_form_params)&lt;br /&gt;
    if params[:button]&lt;br /&gt;
      # first check if assignment name exists, if not then create new, otherwise don't create new assignment&lt;br /&gt;
      find_existing_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      dir_path = assignment_form_params[:assignment][:directory_path]&lt;br /&gt;
      find_existing_directory = Assignment.find_by(directory_path: dir_path, course_id: @assignment_form.assignment.course_id)&lt;br /&gt;
      if !find_existing_assignment &amp;amp;&amp;amp; !find_existing_directory &amp;amp;&amp;amp; @assignment_form.save # No existing names/directories&lt;br /&gt;
        assignment_creation_success&lt;br /&gt;
        # return&lt;br /&gt;
      else&lt;br /&gt;
        assignemnt_creation_failure(find_existing_assignment, dir_path, find_existing_directory)&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      render 'new'&lt;br /&gt;
      undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  # create a new assignment via the assigment form if the new assignment name and directory doesn't exist&lt;br /&gt;
  def assignment_creation_success&lt;br /&gt;
    @assignment_form.create_assignment_node&lt;br /&gt;
    exist_assignment = Assignment.find(@assignment_form.assignment.id)&lt;br /&gt;
    assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
    if assignment_form_params[:assignment][:directory_path].blank? # No existing assignment for assignment form&lt;br /&gt;
      assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    assignment_form_params[:assignment_questionnaire] = assign_questionnaire_array(exist_assignment)&lt;br /&gt;
    assignment_form_params[:due_date] = assign_due_date_array(exist_assignment)&lt;br /&gt;
    @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
    assignment_id = Assignment.find(@assignment_form.assignment.id).id&lt;br /&gt;
    ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
    redirect_to edit_assignment_path assignment_id&lt;br /&gt;
    undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # raises a flash error messgae when it fails to create an assignment and redirect to assignement/new page &lt;br /&gt;
  def assignemnt_creation_failure(existing_assignment, dir_path, existing_directory)&lt;br /&gt;
    flash[:error] = 'Failed to create assignment.'&lt;br /&gt;
    if existing_assignment&lt;br /&gt;
      flash[:error] &amp;lt;&amp;lt; '&amp;lt;br&amp;gt;  ' + @assignment_form.assignment.name + ' already exists as an assignment name'&lt;br /&gt;
    end&lt;br /&gt;
    if existing_directory&lt;br /&gt;
      flash[:error] &amp;lt;&amp;lt; '&amp;lt;br&amp;gt;  ' + dir_path + ' already exists as a submission directory name'&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to '/assignments/new?private=1'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Refactor the edit_params_setting method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
==Automated Testing using RSPEC==&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/models/assignment_form_spec.rb&lt;br /&gt;
&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing from UI==&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/team-E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2477 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146391</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146391"/>
		<updated>2022-11-13T00:16:06Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Refactor the create method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks. Change the name of the variables to meaningful names in the method.&lt;br /&gt;
 * '''Solution Implemented''': Refactored the create method to split tasks into different methods and renamed a variable to correctly reflect its purpose.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# create a new assignment via the assigment form if the new assignment name and directory doesn't exist&lt;br /&gt;
  def assignment_creation_success&lt;br /&gt;
    @assignment_form.create_assignment_node&lt;br /&gt;
    exist_assignment = Assignment.find(@assignment_form.assignment.id)&lt;br /&gt;
    assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
    if assignment_form_params[:assignment][:directory_path].blank? # No existing assignment for assignment form&lt;br /&gt;
      assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    assignment_form_params[:assignment_questionnaire] = assign_questionnaire_array(exist_assignment)&lt;br /&gt;
    assignment_form_params[:due_date] = assign_due_date_array(exist_assignment)&lt;br /&gt;
    @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
    assignment_id = Assignment.find(@assignment_form.assignment.id).id&lt;br /&gt;
    ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
    redirect_to edit_assignment_path assignment_id&lt;br /&gt;
    undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # raises a flash error messgae when it fails to create an assignment and redirect to assignement/new page &lt;br /&gt;
  def assignemnt_creation_failure(existing_assignment, dir_path, existing_directory)&lt;br /&gt;
    flash[:error] = 'Failed to create assignment.'&lt;br /&gt;
    if existing_assignment&lt;br /&gt;
      flash[:error] &amp;lt;&amp;lt; '&amp;lt;br&amp;gt;  ' + @assignment_form.assignment.name + ' already exists as an assignment name'&lt;br /&gt;
    end&lt;br /&gt;
    if existing_directory&lt;br /&gt;
      flash[:error] &amp;lt;&amp;lt; '&amp;lt;br&amp;gt;  ' + dir_path + ' already exists as a submission directory name'&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to '/assignments/new?private=1'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Refactor the edit_params_setting method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
==Automated Testing using RSPEC==&lt;br /&gt;
The current version of expertiza included tests for the assignments_form and the mail_worker, but they were far from extensive. Thus we added a few tests of our own.&lt;br /&gt;
&lt;br /&gt;
To run the tests, run the following commands from the expertiza directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rspec ./spec/models/assignment_form_spec.rb&lt;br /&gt;
&lt;br /&gt;
rspec ./spec/workers/sidekiq_mail_worker_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing from UI==&lt;br /&gt;
No changes were made to the functionality of the project, however you can access it through the setup below.&lt;br /&gt;
&lt;br /&gt;
*Visit the VCL hosted site: http://152.7.99.69:8080/&lt;br /&gt;
**Login: Instructor6&lt;br /&gt;
**Password: Password&lt;br /&gt;
&lt;br /&gt;
'''To Test via UI'''&lt;br /&gt;
&lt;br /&gt;
1) Login with the login above&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage...&lt;br /&gt;
&lt;br /&gt;
3) Click on Assignments&lt;br /&gt;
&lt;br /&gt;
4) On the right side click the +&lt;br /&gt;
&lt;br /&gt;
5) Once you've added a name, scroll to the bottom and click create&lt;br /&gt;
&lt;br /&gt;
6) Repeat steps 2 and 3, to view the assignment added to the list&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/team-E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2477 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146390</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146390"/>
		<updated>2022-11-13T00:09:38Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
==About Assignment Controller==&lt;br /&gt;
This class is responsible for the creation and implementation of assignment forms. This includes due dates, questionnaires and assigning reviews.&lt;br /&gt;
&lt;br /&gt;
'''Previous Information''' can be found here [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task E2144]&lt;br /&gt;
&lt;br /&gt;
Files Involved (some changed should not have been changed):&lt;br /&gt;
* app/controllers/assignments_controller.rb&lt;br /&gt;
* app/mailers/mail_worker.rb&lt;br /&gt;
* app/models/assignment_form.rb&lt;br /&gt;
* config/sidekiq.yml&lt;br /&gt;
* spec/models/assignment_form_spec.rb&lt;br /&gt;
* spec/sidekiq_mail_worker_spec.rb&lt;br /&gt;
* spec/spec_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Refactor the create method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks. Change the name of the variables to meaningful names in the method.&lt;br /&gt;
 * '''Solution Implemented''': Refactored the create method to split tasks into different methods and renamed a variable to correctly reflect its purpose.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# create a new assignment via the assigment form if the new assignment name and directory doesn't exist&lt;br /&gt;
  def assignment_creation_success&lt;br /&gt;
    @assignment_form.create_assignment_node&lt;br /&gt;
    exist_assignment = Assignment.find(@assignment_form.assignment.id)&lt;br /&gt;
    assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
    if assignment_form_params[:assignment][:directory_path].blank? # No existing assignment for assignment form&lt;br /&gt;
      assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    assignment_form_params[:assignment_questionnaire] = assign_questionnaire_array(exist_assignment)&lt;br /&gt;
    assignment_form_params[:due_date] = assign_due_date_array(exist_assignment)&lt;br /&gt;
    @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
    assignment_id = Assignment.find(@assignment_form.assignment.id).id&lt;br /&gt;
    ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
    redirect_to edit_assignment_path assignment_id&lt;br /&gt;
    undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # raises a flash error messgae when it fails to create an assignment and redirect to assignement/new page &lt;br /&gt;
  def assignemnt_creation_failure(existing_assignment, dir_path, existing_directory)&lt;br /&gt;
    flash[:error] = 'Failed to create assignment.'&lt;br /&gt;
    if existing_assignment&lt;br /&gt;
      flash[:error] &amp;lt;&amp;lt; '&amp;lt;br&amp;gt;  ' + @assignment_form.assignment.name + ' already exists as an assignment name'&lt;br /&gt;
    end&lt;br /&gt;
    if existing_directory&lt;br /&gt;
      flash[:error] &amp;lt;&amp;lt; '&amp;lt;br&amp;gt;  ' + dir_path + ' already exists as a submission directory name'&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to '/assignments/new?private=1'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Refactor the edit_params_setting method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/team-E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2477 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146343</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146343"/>
		<updated>2022-11-11T19:01:28Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Refactor the create method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks. Change the name of the variables to meaningful names in the method.&lt;br /&gt;
 * '''Solution Implemented''': Refactored the create method to split tasks into different methods and renamed a variable to correctly reflect its purpose.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# create a new assignment via the assigment form if the new assignment name and directory doesn't exist&lt;br /&gt;
  def assignment_creation_success&lt;br /&gt;
    @assignment_form.create_assignment_node&lt;br /&gt;
    exist_assignment = Assignment.find(@assignment_form.assignment.id)&lt;br /&gt;
    assignment_form_params[:assignment][:id] = exist_assignment.id.to_s&lt;br /&gt;
    if assignment_form_params[:assignment][:directory_path].blank? # No existing assignment for assignment form&lt;br /&gt;
      assignment_form_params[:assignment][:directory_path] = &amp;quot;assignment_#{assignment_form_params[:assignment][:id]}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    assignment_form_params[:assignment_questionnaire] = assign_questionnaire_array(exist_assignment)&lt;br /&gt;
    assignment_form_params[:due_date] = assign_due_date_array(exist_assignment)&lt;br /&gt;
    @assignment_form.update(assignment_form_params, current_user)&lt;br /&gt;
    assignment_id = Assignment.find(@assignment_form.assignment.id).id&lt;br /&gt;
    ExpertizaLogger.info &amp;quot;Assignment created: #{@assignment_form.as_json}&amp;quot;&lt;br /&gt;
    redirect_to edit_assignment_path assignment_id&lt;br /&gt;
    undo_link(&amp;quot;Assignment \&amp;quot;#{@assignment_form.assignment.name}\&amp;quot; has been created successfully. &amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # raises a flash error messgae when it fails to create an assignment and redirect to assignement/new page &lt;br /&gt;
  def assignemnt_creation_failure(existing_assignment, dir_path, existing_directory)&lt;br /&gt;
    flash[:error] = 'Failed to create assignment.'&lt;br /&gt;
    if existing_assignment&lt;br /&gt;
      flash[:error] &amp;lt;&amp;lt; '&amp;lt;br&amp;gt;  ' + @assignment_form.assignment.name + ' already exists as an assignment name'&lt;br /&gt;
    end&lt;br /&gt;
    if existing_directory&lt;br /&gt;
      flash[:error] &amp;lt;&amp;lt; '&amp;lt;br&amp;gt;  ' + dir_path + ' already exists as a submission directory name'&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to '/assignments/new?private=1'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Refactor the edit_params_setting method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/team-E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2477 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146308</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146308"/>
		<updated>2022-11-10T19:55:25Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Refactor the create method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks. Change the name of the variables to meaningful names in the method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Refactor the edit_params_setting method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/team-E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2477 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146274</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146274"/>
		<updated>2022-11-09T19:28:09Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Refactor the create method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks. Change the name of the variables to meaningful names in the method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Refactor the edit_params_setting method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/team-E2273 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2477 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146273</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146273"/>
		<updated>2022-11-09T19:27:39Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
=== Problem 1: Refactor the create method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks. Change the name of the variables to meaningful names in the method.&lt;br /&gt;
&lt;br /&gt;
=== Problem 2: Refactor the edit_params_setting method  in assignment_controller.rb file ===&lt;br /&gt;
 * '''Proposed Solution''': Split the whole function into multiple methods performing specific tasks.&lt;br /&gt;
&lt;br /&gt;
=== Problem 3: Increase the test coverage for sidekiq_mail_worker_spec.rb ===&lt;br /&gt;
&lt;br /&gt;
 * '''Proposed Solution''': Add more tests to increase test coverage.&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/MichaelDacanay/expertiza-mailer-refactor/tree/team-E2253 GitHub Project Repository Fork]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2469 E2273 Pull Request]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146272</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146272"/>
		<updated>2022-11-09T17:31:07Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
== History: Previous projects ==&lt;br /&gt;
&lt;br /&gt;
 * E2253 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2253.Refactor_delayed_mailer.rb_and_scheduled_task.rb]&lt;br /&gt;
 * E2144 [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2144._Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
&lt;br /&gt;
== Problems and planned changes ==&lt;br /&gt;
&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;br /&gt;
&lt;br /&gt;
 * Modify the create method  in assignment_controller.rb file.&lt;br /&gt;
 * Refactor methods like edit_params_setting , update_assignment_form.&lt;br /&gt;
 * Add more tests to increase test coverage.&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146271</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146271"/>
		<updated>2022-11-09T17:23:49Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza uses Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146267</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146267"/>
		<updated>2022-11-08T21:24:14Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146266</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146266"/>
		<updated>2022-11-08T21:23:25Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Problem Statement===&lt;br /&gt;
We are planning to accomplish the following tasks in this project:&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146265</id>
		<title>CSC/ECE 517 Fall 2022 - E2273.Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2273.Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=146265"/>
		<updated>2022-11-08T18:08:05Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: Created page with &amp;quot;===Problem Statement=== The following tasks were accomplished in this project:&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022&amp;diff=146245</id>
		<title>CSC/ECE 517 Fall 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022&amp;diff=146245"/>
		<updated>2022-11-02T12:52:35Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2252. Refactor auth controller.rb &amp;amp; password retrieval controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2253.Refactor delayed mailer.rb and scheduled task.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2254: Refactor teams_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2255. Refactor student_quizzes_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2256: Refactor late_policies_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2257: Refactor questionnaires_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2258. Refactor submitted_content_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2260. Refactor review_mapping_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2255. Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2262: Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2263.Refactor student teams functionality]]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022&amp;diff=146244</id>
		<title>CSC/ECE 517 Fall 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022&amp;diff=146244"/>
		<updated>2022-11-02T12:51:24Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2252. Refactor auth controller.rb &amp;amp; password retrieval controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2253.Refactor delayed mailer.rb and scheduled task.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2254: Refactor teams_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2255. Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2255. Refactor student_quizzes_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2256: Refactor late_policies_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2257: Refactor questionnaires_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2258. Refactor submitted_content_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2260. Refactor review_mapping_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2262: Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2263.Refactor student teams functionality]]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022&amp;diff=145813</id>
		<title>CSC/ECE 517 Fall 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022&amp;diff=145813"/>
		<updated>2022-10-26T01:06:01Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2253.Refactor delayed mailer.rb and scheduled task.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2256: Refactor late_policies_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2258. Refactor submitted_content_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2259. Refactor signup_sheet_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2260. Refactor review_mapping_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb]]&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145811</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145811"/>
		<updated>2022-10-26T01:03:34Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
* Increased the test coverage of the suggestion controller by adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactor the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 3''': Rename methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Renamed approve method to approve_suggestion and approve_suggestion to approve_suggestion_and_notify&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion_and_notify&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 4''': Move the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file and change its name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def send_email&lt;br /&gt;
    proposer = User.find_by(id: @user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      Mailer.suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{@suggestion.title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: @suggestion.title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Also changed the name of the method to notify_suggestion_approval.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notify_suggestion_approval(used_id, team_id, suggestion_title)&lt;br /&gt;
    proposer = User.find_by(id: user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{suggestion_title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: suggestion_title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 5''': In views/suggestion/show.html.erb and views/suggestion/student_view.html.erb, there is a DRY violation which needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Merge views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if current_user_role?.name.eql?(&amp;quot;Student&amp;quot;) or session[:flip_user] %&amp;gt;&lt;br /&gt;
&amp;lt;!--If user is a student or non-student user in Student view--&amp;gt;&lt;br /&gt;
.....&lt;br /&gt;
else&lt;br /&gt;
.....&lt;br /&gt;
&amp;lt;%end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 6''': Increase the test coverage of the controller and functionality by adding more tests.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Increase the test coverage of the suggestion controller by adjusting current test for above problems and adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'adds a participant is not successfull' do&lt;br /&gt;
      allow_any_instance_of(SuggestionComment).to receive(:save).and_return(false)&lt;br /&gt;
      request_params = { id: 1, suggestion_comment: { vote: 'Y', comments: 'comments' } }&lt;br /&gt;
      user_session = { user: instructor }&lt;br /&gt;
      get :add_comment, params: request_params, session: user_session, xhr: true&lt;br /&gt;
      expect(flash[:error]).to eq 'There was an error in adding your comment.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'rejecting a suggestion is not successfull' do&lt;br /&gt;
        allow_any_instance_of(Suggestion).to receive(:update_attribute).and_return(false)&lt;br /&gt;
        request_params = { id: 1, reject_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when rejecting the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'accept a suggestion is not successfull' do&lt;br /&gt;
        allow(SignUpTopic).to receive(:new_topic_from_suggestion).and_return('failed')&lt;br /&gt;
        allow_any_instance_of(SuggestionController).to receive(:notification).and_return(true)&lt;br /&gt;
        request_params = { id: 1, approve_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when approving the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
Go to the expertiza source code root path and use following command to run test:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rspec spec/contollers/suggestion_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here is the operation video link:&lt;br /&gt;
&lt;br /&gt;
https://youtu.be/qzkdNmTnAIc&lt;br /&gt;
&lt;br /&gt;
====Test Plan====&lt;br /&gt;
[[File:TestFlow.png|900px]]&lt;br /&gt;
&lt;br /&gt;
====Travis CI====&lt;br /&gt;
&lt;br /&gt;
Also , our project passed the Travis CI build test.&lt;br /&gt;
&lt;br /&gt;
[[File:TravisCISuggestionController.png]]&lt;br /&gt;
&lt;br /&gt;
====Coverage====&lt;br /&gt;
Our coverage increased 8.04%.&lt;br /&gt;
&lt;br /&gt;
* '''Before Changes'''&lt;br /&gt;
[[File:CoverageBeforeChanges.png|900px]]&lt;br /&gt;
&lt;br /&gt;
* '''After Changes'''&lt;br /&gt;
&lt;br /&gt;
[[File:CoverageAfterChanges.png|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Here is the VCL link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://152.7.176.119:8080/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password (Use this account for Testing)&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
1. After logging in as '''Instructor''', click &amp;quot;Manage instructor content&amp;quot; -&amp;gt; &amp;quot;Assignment&amp;quot;:&lt;br /&gt;
   [[File:E2121_S1.png|700px]]&lt;br /&gt;
&lt;br /&gt;
2. Select the &amp;quot;Assignment&amp;quot; tab, in this example we search &amp;quot;textbook&amp;quot; as figure shows.&lt;br /&gt;
   [[File:E2121_S2.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. Choose a item and click &amp;quot;view suggestion&amp;quot; icon. In this example we use &amp;quot;Wiki textbook 2&amp;quot;:&lt;br /&gt;
   [[File:E2121_S3.png|700px]]&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;view&amp;quot; link in which tuple the Status is &amp;quot;Initiated&amp;quot;:&lt;br /&gt;
   [[File:E2121_S4.png|700px]]&lt;br /&gt;
&lt;br /&gt;
5. Now we can see the Suggestion page with &amp;quot;Approve suggestion&amp;quot; and &amp;quot;Reject suggestion&amp;quot; butttons: &lt;br /&gt;
   [[File:E2121_S5.png|700px]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/vyasrc/expertiza/tree/refactor_suggestion_controller GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://152.7.176.119:8080/  VCL link (will expire on Nov 24th 2022)] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:TravisCISuggestionController.png&amp;diff=145810</id>
		<title>File:TravisCISuggestionController.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:TravisCISuggestionController.png&amp;diff=145810"/>
		<updated>2022-10-26T01:01:29Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: Vrcholay uploaded a new version of File:TravisCISuggestionController.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:TravisCISuggestionController.png&amp;diff=145809</id>
		<title>File:TravisCISuggestionController.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:TravisCISuggestionController.png&amp;diff=145809"/>
		<updated>2022-10-26T00:59:17Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: Vrcholay uploaded a new version of File:TravisCISuggestionController.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145808</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145808"/>
		<updated>2022-10-26T00:58:39Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
* Increased the test coverage of the suggestion controller by adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactor the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 3''': Rename methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Renamed approve method to approve_suggestion and approve_suggestion to approve_suggestion_and_notify&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion_and_notify&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 4''': Move the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file and change its name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def send_email&lt;br /&gt;
    proposer = User.find_by(id: @user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      Mailer.suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{@suggestion.title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: @suggestion.title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Also changed the name of the method to notify_suggestion_approval.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notify_suggestion_approval(used_id, team_id, suggestion_title)&lt;br /&gt;
    proposer = User.find_by(id: user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{suggestion_title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: suggestion_title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 5''': In views/suggestion/show.html.erb and views/suggestion/student_view.html.erb, there is a DRY violation which needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Merge views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if current_user_role?.name.eql?(&amp;quot;Student&amp;quot;) or session[:flip_user] %&amp;gt;&lt;br /&gt;
&amp;lt;!--If user is a student or non-student user in Student view--&amp;gt;&lt;br /&gt;
.....&lt;br /&gt;
else&lt;br /&gt;
.....&lt;br /&gt;
&amp;lt;%end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 6''': Increase the test coverage of the controller and functionality by adding more tests.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Increase the test coverage of the suggestion controller by adjusting current test for above problems and adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'adds a participant is not successfull' do&lt;br /&gt;
      allow_any_instance_of(SuggestionComment).to receive(:save).and_return(false)&lt;br /&gt;
      request_params = { id: 1, suggestion_comment: { vote: 'Y', comments: 'comments' } }&lt;br /&gt;
      user_session = { user: instructor }&lt;br /&gt;
      get :add_comment, params: request_params, session: user_session, xhr: true&lt;br /&gt;
      expect(flash[:error]).to eq 'There was an error in adding your comment.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'rejecting a suggestion is not successfull' do&lt;br /&gt;
        allow_any_instance_of(Suggestion).to receive(:update_attribute).and_return(false)&lt;br /&gt;
        request_params = { id: 1, reject_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when rejecting the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'accept a suggestion is not successfull' do&lt;br /&gt;
        allow(SignUpTopic).to receive(:new_topic_from_suggestion).and_return('failed')&lt;br /&gt;
        allow_any_instance_of(SuggestionController).to receive(:notification).and_return(true)&lt;br /&gt;
        request_params = { id: 1, approve_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when approving the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
Go to the expertiza source code root path and use following command to run test:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rspec spec/contollers/suggestion_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here is the operation video link:&lt;br /&gt;
&lt;br /&gt;
https://youtu.be/qzkdNmTnAIc&lt;br /&gt;
&lt;br /&gt;
====Test Plan====&lt;br /&gt;
[[File:TravisCISuggestionController.png|900px]]&lt;br /&gt;
&lt;br /&gt;
====Travis CI====&lt;br /&gt;
&lt;br /&gt;
Also , our project passed the Travis CI build test.&lt;br /&gt;
&lt;br /&gt;
[[File:travisCL.png|900px]]&lt;br /&gt;
&lt;br /&gt;
====Coverage====&lt;br /&gt;
Our coverage increased 8.04%.&lt;br /&gt;
&lt;br /&gt;
* '''Before Changes'''&lt;br /&gt;
[[File:CoverageBeforeChanges.png|900px]]&lt;br /&gt;
&lt;br /&gt;
* '''After Changes'''&lt;br /&gt;
&lt;br /&gt;
[[File:CoverageAfterChanges.png|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Here is the VCL link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://152.7.176.119:8080/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password (Use this account for Testing)&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
1. After logging in as '''Instructor''', click &amp;quot;Manage instructor content&amp;quot; -&amp;gt; &amp;quot;Assignment&amp;quot;:&lt;br /&gt;
   [[File:E2121_S1.png|700px]]&lt;br /&gt;
&lt;br /&gt;
2. Select the &amp;quot;Assignment&amp;quot; tab, in this example we search &amp;quot;textbook&amp;quot; as figure shows.&lt;br /&gt;
   [[File:E2121_S2.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. Choose a item and click &amp;quot;view suggestion&amp;quot; icon. In this example we use &amp;quot;Wiki textbook 2&amp;quot;:&lt;br /&gt;
   [[File:E2121_S3.png|700px]]&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;view&amp;quot; link in which tuple the Status is &amp;quot;Initiated&amp;quot;:&lt;br /&gt;
   [[File:E2121_S4.png|700px]]&lt;br /&gt;
&lt;br /&gt;
5. Now we can see the Suggestion page with &amp;quot;Approve suggestion&amp;quot; and &amp;quot;Reject suggestion&amp;quot; butttons: &lt;br /&gt;
   [[File:E2121_S5.png|700px]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/vyasrc/expertiza/tree/refactor_suggestion_controller GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://152.7.176.119:8080/  VCL link (will expire on Nov 24th 2022)] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:TravisCISuggestionController.png&amp;diff=145807</id>
		<title>File:TravisCISuggestionController.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:TravisCISuggestionController.png&amp;diff=145807"/>
		<updated>2022-10-26T00:58:10Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145806</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145806"/>
		<updated>2022-10-26T00:56:47Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
* Increased the test coverage of the suggestion controller by adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactor the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 3''': Rename methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Renamed approve method to approve_suggestion and approve_suggestion to approve_suggestion_and_notify&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion_and_notify&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 4''': Move the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file and change its name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def send_email&lt;br /&gt;
    proposer = User.find_by(id: @user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      Mailer.suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{@suggestion.title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: @suggestion.title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Also changed the name of the method to notify_suggestion_approval.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notify_suggestion_approval(used_id, team_id, suggestion_title)&lt;br /&gt;
    proposer = User.find_by(id: user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{suggestion_title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: suggestion_title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 5''': In views/suggestion/show.html.erb and views/suggestion/student_view.html.erb, there is a DRY violation which needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Merge views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if current_user_role?.name.eql?(&amp;quot;Student&amp;quot;) or session[:flip_user] %&amp;gt;&lt;br /&gt;
&amp;lt;!--If user is a student or non-student user in Student view--&amp;gt;&lt;br /&gt;
.....&lt;br /&gt;
else&lt;br /&gt;
.....&lt;br /&gt;
&amp;lt;%end%&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 6''': Increase the test coverage of the controller and functionality by adding more tests.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Increase the test coverage of the suggestion controller by adjusting current test for above problems and adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'adds a participant is not successfull' do&lt;br /&gt;
      allow_any_instance_of(SuggestionComment).to receive(:save).and_return(false)&lt;br /&gt;
      request_params = { id: 1, suggestion_comment: { vote: 'Y', comments: 'comments' } }&lt;br /&gt;
      user_session = { user: instructor }&lt;br /&gt;
      get :add_comment, params: request_params, session: user_session, xhr: true&lt;br /&gt;
      expect(flash[:error]).to eq 'There was an error in adding your comment.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'rejecting a suggestion is not successfull' do&lt;br /&gt;
        allow_any_instance_of(Suggestion).to receive(:update_attribute).and_return(false)&lt;br /&gt;
        request_params = { id: 1, reject_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when rejecting the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'accept a suggestion is not successfull' do&lt;br /&gt;
        allow(SignUpTopic).to receive(:new_topic_from_suggestion).and_return('failed')&lt;br /&gt;
        allow_any_instance_of(SuggestionController).to receive(:notification).and_return(true)&lt;br /&gt;
        request_params = { id: 1, approve_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when approving the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
Go to the expertiza source code root path and use following command to run test:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rspec spec/contollers/suggestion_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here is the operation video link:&lt;br /&gt;
&lt;br /&gt;
https://youtu.be/qzkdNmTnAIc&lt;br /&gt;
&lt;br /&gt;
====Test Plan====&lt;br /&gt;
[[File:TestFlow.png|900px]]&lt;br /&gt;
&lt;br /&gt;
====Travis CI====&lt;br /&gt;
&lt;br /&gt;
Also , our project passed the Travis CI build test.&lt;br /&gt;
&lt;br /&gt;
[[File:travisCL.png|900px]]&lt;br /&gt;
&lt;br /&gt;
====Coverage====&lt;br /&gt;
Our coverage increased 8.04%.&lt;br /&gt;
&lt;br /&gt;
* '''Before Changes'''&lt;br /&gt;
[[File:CoverageBeforeChanges.png|900px]]&lt;br /&gt;
&lt;br /&gt;
* '''After Changes'''&lt;br /&gt;
&lt;br /&gt;
[[File:CoverageAfterChanges.png|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Here is the VCL link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://152.7.176.119:8080/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password (Use this account for Testing)&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
1. After logging in as '''Instructor''', click &amp;quot;Manage instructor content&amp;quot; -&amp;gt; &amp;quot;Assignment&amp;quot;:&lt;br /&gt;
   [[File:E2121_S1.png|700px]]&lt;br /&gt;
&lt;br /&gt;
2. Select the &amp;quot;Assignment&amp;quot; tab, in this example we search &amp;quot;textbook&amp;quot; as figure shows.&lt;br /&gt;
   [[File:E2121_S2.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. Choose a item and click &amp;quot;view suggestion&amp;quot; icon. In this example we use &amp;quot;Wiki textbook 2&amp;quot;:&lt;br /&gt;
   [[File:E2121_S3.png|700px]]&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;view&amp;quot; link in which tuple the Status is &amp;quot;Initiated&amp;quot;:&lt;br /&gt;
   [[File:E2121_S4.png|700px]]&lt;br /&gt;
&lt;br /&gt;
5. Now we can see the Suggestion page with &amp;quot;Approve suggestion&amp;quot; and &amp;quot;Reject suggestion&amp;quot; butttons: &lt;br /&gt;
   [[File:E2121_S5.png|700px]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/vyasrc/expertiza/tree/refactor_suggestion_controller GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://152.7.176.119:8080/  VCL link (will expire on Nov 24th 2022)] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145722</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145722"/>
		<updated>2022-10-25T11:26:04Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
* Increased the test coverage of the suggestion controller by adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactor the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 3''': Rename methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Renamed approve method to approve_suggestion and approve_suggestion to approve_suggestion_and_notify&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion_and_notify&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 4''': Move the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file and change its name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def send_email&lt;br /&gt;
    proposer = User.find_by(id: @user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      Mailer.suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{@suggestion.title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: @suggestion.title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Also changed the name of the method to notify_suggestion_approval.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notify_suggestion_approval(used_id, team_id, suggestion_title)&lt;br /&gt;
    proposer = User.find_by(id: user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{suggestion_title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: suggestion_title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 5''': In views/suggestion/show.html.erb and views/suggestion/student_view.html.erb, there is a DRY violation which needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Merge views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
&lt;br /&gt;
* '''Problem 6''': Increase the test coverage of the controller and functionality by adding more tests.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Increase the test coverage of the suggestion controller by adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'adds a participant is not successfull' do&lt;br /&gt;
      allow_any_instance_of(SuggestionComment).to receive(:save).and_return(false)&lt;br /&gt;
      request_params = { id: 1, suggestion_comment: { vote: 'Y', comments: 'comments' } }&lt;br /&gt;
      user_session = { user: instructor }&lt;br /&gt;
      get :add_comment, params: request_params, session: user_session, xhr: true&lt;br /&gt;
      expect(flash[:error]).to eq 'There was an error in adding your comment.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'rejecting a suggestion is not successfull' do&lt;br /&gt;
        allow_any_instance_of(Suggestion).to receive(:update_attribute).and_return(false)&lt;br /&gt;
        request_params = { id: 1, reject_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when rejecting the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'accept a suggestion is not successfull' do&lt;br /&gt;
        allow(SignUpTopic).to receive(:new_topic_from_suggestion).and_return('failed')&lt;br /&gt;
        allow_any_instance_of(SuggestionController).to receive(:notification).and_return(true)&lt;br /&gt;
        request_params = { id: 1, approve_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when approving the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
Go to the expertiza source code root path and use following command to run test:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rspec spec/contollers/suggestion_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here is the operation video link:&lt;br /&gt;
&lt;br /&gt;
https://youtu.be/qzkdNmTnAIc&lt;br /&gt;
&lt;br /&gt;
====Test Plan====&lt;br /&gt;
[[File:TestFlow.png|900px]]&lt;br /&gt;
&lt;br /&gt;
====Coverage====&lt;br /&gt;
Our coverage increased 8.04%.&lt;br /&gt;
&lt;br /&gt;
* '''Before Changes'''&lt;br /&gt;
[[File:CoverageBeforeChanges.png|900px]]&lt;br /&gt;
&lt;br /&gt;
* '''After Changes'''&lt;br /&gt;
&lt;br /&gt;
[[File:CoverageAfterChanges.png|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Here is the VCL link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://152.7.176.119:8080/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password (Use this account for Testing)&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
1. After logging in as '''Instructor''', click &amp;quot;Manage instructor content&amp;quot; -&amp;gt; &amp;quot;Assignment&amp;quot;:&lt;br /&gt;
   [[File:E2121_S1.png|700px]]&lt;br /&gt;
&lt;br /&gt;
2. Select the &amp;quot;Assignment&amp;quot; tab, in this example we search &amp;quot;textbook&amp;quot; as figure shows.&lt;br /&gt;
   [[File:E2121_S2.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. Choose a item and click &amp;quot;view suggestion&amp;quot; icon. In this example we use &amp;quot;Wiki textbook 2&amp;quot;:&lt;br /&gt;
   [[File:E2121_S3.png|700px]]&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;view&amp;quot; link in which tuple the Status is &amp;quot;Initiated&amp;quot;:&lt;br /&gt;
   [[File:E2121_S4.png|700px]]&lt;br /&gt;
&lt;br /&gt;
5. Now we can see the Suggestion page with &amp;quot;Approve suggestion&amp;quot; and &amp;quot;Reject suggestion&amp;quot; butttons: &lt;br /&gt;
   [[File:E2121_S5.png|700px]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/vyasrc/expertiza/tree/refactor_suggestion_controller GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://152.7.176.119:8080/  VCL link (will expire on Nov 24th 2022)] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:CoverageAfterChanges.png&amp;diff=145721</id>
		<title>File:CoverageAfterChanges.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:CoverageAfterChanges.png&amp;diff=145721"/>
		<updated>2022-10-25T11:21:27Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:CoverageBeforeChanges.png&amp;diff=145720</id>
		<title>File:CoverageBeforeChanges.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:CoverageBeforeChanges.png&amp;diff=145720"/>
		<updated>2022-10-25T11:20:16Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145719</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145719"/>
		<updated>2022-10-25T11:13:22Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
* Increased the test coverage of the suggestion controller by adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactor the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 3''': Rename methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Renamed approve method to approve_suggestion and approve_suggestion to approve_suggestion_and_notify&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion_and_notify&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 4''': Move the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file and change its name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def send_email&lt;br /&gt;
    proposer = User.find_by(id: @user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      Mailer.suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{@suggestion.title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: @suggestion.title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Also changed the name of the method to notify_suggestion_approval.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notify_suggestion_approval(used_id, team_id, suggestion_title)&lt;br /&gt;
    proposer = User.find_by(id: user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{suggestion_title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: suggestion_title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 5''': In views/suggestion/show.html.erb and views/suggestion/student_view.html.erb, there is a DRY violation which needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Merge views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
&lt;br /&gt;
* '''Problem 6''': Increase the test coverage of the controller and functionality by adding more tests.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Increase the test coverage of the suggestion controller by adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'adds a participant is not successfull' do&lt;br /&gt;
      allow_any_instance_of(SuggestionComment).to receive(:save).and_return(false)&lt;br /&gt;
      request_params = { id: 1, suggestion_comment: { vote: 'Y', comments: 'comments' } }&lt;br /&gt;
      user_session = { user: instructor }&lt;br /&gt;
      get :add_comment, params: request_params, session: user_session, xhr: true&lt;br /&gt;
      expect(flash[:error]).to eq 'There was an error in adding your comment.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'rejecting a suggestion is not successfull' do&lt;br /&gt;
        allow_any_instance_of(Suggestion).to receive(:update_attribute).and_return(false)&lt;br /&gt;
        request_params = { id: 1, reject_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when rejecting the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'accept a suggestion is not successfull' do&lt;br /&gt;
        allow(SignUpTopic).to receive(:new_topic_from_suggestion).and_return('failed')&lt;br /&gt;
        allow_any_instance_of(SuggestionController).to receive(:notification).and_return(true)&lt;br /&gt;
        request_params = { id: 1, approve_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when approving the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
Go to the expertiza source code root path and use following command to run test:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rspec spec/contollers/suggestion_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here is the operation video link:&lt;br /&gt;
&lt;br /&gt;
https://youtu.be/qzkdNmTnAIc&lt;br /&gt;
&lt;br /&gt;
====Test Plan====&lt;br /&gt;
[[File:TestFlow.png|900px]]&lt;br /&gt;
&lt;br /&gt;
====Travis CI====&lt;br /&gt;
&lt;br /&gt;
Also , our project passed the Travis CI build test.&lt;br /&gt;
&lt;br /&gt;
[[File:travisCL.png|900px]]&lt;br /&gt;
&lt;br /&gt;
====Coverage====&lt;br /&gt;
Our coverage increased 4.77%.&lt;br /&gt;
&lt;br /&gt;
[[File:CoverageSuggestion.png|900px]]&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Here is the VCL link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://152.7.176.119:8080/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password (Use this account for Testing)&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
1. After logging in as '''Instructor''', click &amp;quot;Manage instructor content&amp;quot; -&amp;gt; &amp;quot;Assignment&amp;quot;:&lt;br /&gt;
   [[File:E2121_S1.png|700px]]&lt;br /&gt;
&lt;br /&gt;
2. Select the &amp;quot;Assignment&amp;quot; tab, in this example we search &amp;quot;textbook&amp;quot; as figure shows.&lt;br /&gt;
   [[File:E2121_S2.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. Choose a item and click &amp;quot;view suggestion&amp;quot; icon. In this example we use &amp;quot;Wiki textbook 2&amp;quot;:&lt;br /&gt;
   [[File:E2121_S3.png|700px]]&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;view&amp;quot; link in which tuple the Status is &amp;quot;Initiated&amp;quot;:&lt;br /&gt;
   [[File:E2121_S4.png|700px]]&lt;br /&gt;
&lt;br /&gt;
5. Now we can see the Suggestion page with &amp;quot;Approve suggestion&amp;quot; and &amp;quot;Reject suggestion&amp;quot; butttons: &lt;br /&gt;
   [[File:E2121_S5.png|700px]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/vyasrc/expertiza/tree/refactor_suggestion_controller GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://152.7.176.119:8080/  VCL link (will expire on Nov 24th 2022)] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145718</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145718"/>
		<updated>2022-10-25T11:09:10Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
* Increased the test coverage of the suggestion controller by adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactor the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 3''': Rename methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Renamed approve method to approve_suggestion and approve_suggestion to approve_suggestion_and_notify&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion_and_notify&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 4''': Move the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file and change its name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def send_email&lt;br /&gt;
    proposer = User.find_by(id: @user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      Mailer.suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{@suggestion.title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: @suggestion.title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Also changed the name of the method to notify_suggestion_approval.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notify_suggestion_approval(used_id, team_id, suggestion_title)&lt;br /&gt;
    proposer = User.find_by(id: user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{suggestion_title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: suggestion_title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 5''': In views/suggestion/show.html.erb and views/suggestion/student_view.html.erb, there is a DRY violation which needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Merge views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
&lt;br /&gt;
* '''Problem 6''': Increase the test coverage of the controller and functionality by adding more tests.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Increase the test coverage of the suggestion controller by adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'adds a participant is not successfull' do&lt;br /&gt;
      allow_any_instance_of(SuggestionComment).to receive(:save).and_return(false)&lt;br /&gt;
      request_params = { id: 1, suggestion_comment: { vote: 'Y', comments: 'comments' } }&lt;br /&gt;
      user_session = { user: instructor }&lt;br /&gt;
      get :add_comment, params: request_params, session: user_session, xhr: true&lt;br /&gt;
      expect(flash[:error]).to eq 'There was an error in adding your comment.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'rejecting a suggestion is not successfull' do&lt;br /&gt;
        allow_any_instance_of(Suggestion).to receive(:update_attribute).and_return(false)&lt;br /&gt;
        request_params = { id: 1, reject_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when rejecting the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'accept a suggestion is not successfull' do&lt;br /&gt;
        allow(SignUpTopic).to receive(:new_topic_from_suggestion).and_return('failed')&lt;br /&gt;
        allow_any_instance_of(SuggestionController).to receive(:notification).and_return(true)&lt;br /&gt;
        request_params = { id: 1, approve_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when approving the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
Go to the expertiza source code root path and use following command to run test:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rspec spec/contollers/suggestion_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here is the operation video link:&lt;br /&gt;
&lt;br /&gt;
https://youtu.be/_HsUSm39iEQ&lt;br /&gt;
&lt;br /&gt;
====Test Plan====&lt;br /&gt;
[[File:TestFlow.png|900px]]&lt;br /&gt;
&lt;br /&gt;
====Travis CI====&lt;br /&gt;
&lt;br /&gt;
Also , our project passed the Travis CI build test.&lt;br /&gt;
&lt;br /&gt;
[[File:travisCL.png|900px]]&lt;br /&gt;
&lt;br /&gt;
====Coverage====&lt;br /&gt;
Our coverage increased 4.77%.&lt;br /&gt;
&lt;br /&gt;
[[File:CoverageSuggestion.png|900px]]&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Here is the VCL link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://152.7.176.119:8080/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password (Use this account for Testing)&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
1. After logging in as '''Instructor''', click &amp;quot;Manage instructor content&amp;quot; -&amp;gt; &amp;quot;Assignment&amp;quot;:&lt;br /&gt;
   [[File:E2121_S1.png|700px]]&lt;br /&gt;
&lt;br /&gt;
2. Select the &amp;quot;Assignment&amp;quot; tab, in this example we search &amp;quot;textbook&amp;quot; as figure shows.&lt;br /&gt;
   [[File:E2121_S2.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. Choose a item and click &amp;quot;view suggestion&amp;quot; icon. In this example we use &amp;quot;Wiki textbook 2&amp;quot;:&lt;br /&gt;
   [[File:E2121_S3.png|700px]]&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;view&amp;quot; link in which tuple the Status is &amp;quot;Initiated&amp;quot;:&lt;br /&gt;
   [[File:E2121_S4.png|700px]]&lt;br /&gt;
&lt;br /&gt;
5. Now we can see the Suggestion page with &amp;quot;Approve suggestion&amp;quot; and &amp;quot;Reject suggestion&amp;quot; butttons: &lt;br /&gt;
   [[File:E2121_S5.png|700px]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/vyasrc/expertiza/tree/refactor_suggestion_controller GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://152.7.176.119:8080/  VCL link (will expire on Nov 24th 2022)] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145717</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145717"/>
		<updated>2022-10-25T11:01:54Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
* Increased the test coverage of the suggestion controller by adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactor the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 3''': Rename methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Renamed approve method to approve_suggestion and approve_suggestion to approve_suggestion_and_notify&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion_and_notify&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 4''': Move the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file and change its name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def send_email&lt;br /&gt;
    proposer = User.find_by(id: @user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      Mailer.suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{@suggestion.title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: @suggestion.title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Also changed the name of the method to notify_suggestion_approval.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notify_suggestion_approval(used_id, team_id, suggestion_title)&lt;br /&gt;
    proposer = User.find_by(id: user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{suggestion_title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: suggestion_title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 5''': In views/suggestion/show.html.erb and views/suggestion/student_view.html.erb, there is a DRY violation which needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Merge views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
&lt;br /&gt;
* '''Problem 6''': Increase the test coverage of the controller and functionality by adding more tests.&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Increase the test coverage of the suggestion controller by adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'adds a participant is not successfull' do&lt;br /&gt;
      allow_any_instance_of(SuggestionComment).to receive(:save).and_return(false)&lt;br /&gt;
      request_params = { id: 1, suggestion_comment: { vote: 'Y', comments: 'comments' } }&lt;br /&gt;
      user_session = { user: instructor }&lt;br /&gt;
      get :add_comment, params: request_params, session: user_session, xhr: true&lt;br /&gt;
      expect(flash[:error]).to eq 'There was an error in adding your comment.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'rejecting a suggestion is not successfull' do&lt;br /&gt;
        allow_any_instance_of(Suggestion).to receive(:update_attribute).and_return(false)&lt;br /&gt;
        request_params = { id: 1, reject_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when rejecting the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'accept a suggestion is not successfull' do&lt;br /&gt;
        allow(SignUpTopic).to receive(:new_topic_from_suggestion).and_return('failed')&lt;br /&gt;
        allow_any_instance_of(SuggestionController).to receive(:notification).and_return(true)&lt;br /&gt;
        request_params = { id: 1, approve_suggestion: true }&lt;br /&gt;
        user_session = { user: instructor }&lt;br /&gt;
        get :submit, params: request_params, session: user_session, xhr: true&lt;br /&gt;
        expect(flash[:error]).to eq 'An error occurred when approving the suggestion.'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Here is the VCL link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://152.7.176.119:8080/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password (Use this account for Testing)&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
1. After logging in as '''Instructor''', click &amp;quot;Manage instructor content&amp;quot; -&amp;gt; &amp;quot;Assignment&amp;quot;:&lt;br /&gt;
   [[File:E2121_S1.png|700px]]&lt;br /&gt;
&lt;br /&gt;
2. Select the &amp;quot;Assignment&amp;quot; tab, in this example we search &amp;quot;textbook&amp;quot; as figure shows.&lt;br /&gt;
   [[File:E2121_S2.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. Choose a item and click &amp;quot;view suggestion&amp;quot; icon. In this example we use &amp;quot;Wiki textbook 2&amp;quot;:&lt;br /&gt;
   [[File:E2121_S3.png|700px]]&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;view&amp;quot; link in which tuple the Status is &amp;quot;Initiated&amp;quot;:&lt;br /&gt;
   [[File:E2121_S4.png|700px]]&lt;br /&gt;
&lt;br /&gt;
5. Now we can see the Suggestion page with &amp;quot;Approve suggestion&amp;quot; and &amp;quot;Reject suggestion&amp;quot; butttons: &lt;br /&gt;
   [[File:E2121_S5.png|700px]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/vyasrc/expertiza/tree/refactor_suggestion_controller GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://152.7.176.119:8080/  VCL link (will expire on Nov 24th 2022)] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145716</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145716"/>
		<updated>2022-10-25T10:56:44Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
* Increased the test coverage of the suggestion controller by adding 3 more tests: 'adds a participant is not successfull', 'rejecting a suggestion is not successfull', 'accept a suggestion is not successfull'&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactor the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 3''': Rename methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Renamed approve method to approve_suggestion and approve_suggestion to approve_suggestion_and_notify&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion_and_notify&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 4''': Move the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file and change its name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def send_email&lt;br /&gt;
    proposer = User.find_by(id: @user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      Mailer.suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{@suggestion.title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: @suggestion.title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Also changed the name of the method to notify_suggestion_approval.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notify_suggestion_approval(used_id, team_id, suggestion_title)&lt;br /&gt;
    proposer = User.find_by(id: user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{suggestion_title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: suggestion_title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Here is the VCL link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://152.7.176.119:8080/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password (Use this account for Testing)&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
1. After logging in as '''Instructor''', click &amp;quot;Manage instructor content&amp;quot; -&amp;gt; &amp;quot;Assignment&amp;quot;:&lt;br /&gt;
   [[File:E2121_S1.png|700px]]&lt;br /&gt;
&lt;br /&gt;
2. Select the &amp;quot;Assignment&amp;quot; tab, in this example we search &amp;quot;textbook&amp;quot; as figure shows.&lt;br /&gt;
   [[File:E2121_S2.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. Choose a item and click &amp;quot;view suggestion&amp;quot; icon. In this example we use &amp;quot;Wiki textbook 2&amp;quot;:&lt;br /&gt;
   [[File:E2121_S3.png|700px]]&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;view&amp;quot; link in which tuple the Status is &amp;quot;Initiated&amp;quot;:&lt;br /&gt;
   [[File:E2121_S4.png|700px]]&lt;br /&gt;
&lt;br /&gt;
5. Now we can see the Suggestion page with &amp;quot;Approve suggestion&amp;quot; and &amp;quot;Reject suggestion&amp;quot; butttons: &lt;br /&gt;
   [[File:E2121_S5.png|700px]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/vyasrc/expertiza/tree/refactor_suggestion_controller GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://152.7.176.119:8080/  VCL link (will expire on Nov 24th 2022)] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145710</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145710"/>
		<updated>2022-10-24T22:03:37Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactor the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 3''': Rename methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Renamed approve method to approve_suggestion and approve_suggestion to approve_suggestion_and_notify&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion_and_notify&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 4''': Move the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file and change its name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def send_email&lt;br /&gt;
    proposer = User.find_by(id: @user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      Mailer.suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{@suggestion.title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: @suggestion.title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Also changed the name of the method to notify_suggestion_approval.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notify_suggestion_approval(used_id, team_id, suggestion_title)&lt;br /&gt;
    proposer = User.find_by(id: user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{suggestion_title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: suggestion_title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Here is the VCL link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://152.7.176.119:8080/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password (Use this account for Testing)&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
1. After logging in as '''Instructor''', click &amp;quot;Manage instructor content&amp;quot; -&amp;gt; &amp;quot;Assignment&amp;quot;:&lt;br /&gt;
   [[File:E2121_S1.png|700px]]&lt;br /&gt;
&lt;br /&gt;
2. Select the &amp;quot;Assignment&amp;quot; tab, in this example we search &amp;quot;textbook&amp;quot; as figure shows.&lt;br /&gt;
   [[File:E2121_S2.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. Choose a item and click &amp;quot;view suggestion&amp;quot; icon. In this example we use &amp;quot;Wiki textbook 2&amp;quot;:&lt;br /&gt;
   [[File:E2121_S3.png|700px]]&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;view&amp;quot; link in which tuple the Status is &amp;quot;Initiated&amp;quot;:&lt;br /&gt;
   [[File:E2121_S4.png|700px]]&lt;br /&gt;
&lt;br /&gt;
5. Now we can see the Suggestion page with &amp;quot;Approve suggestion&amp;quot; and &amp;quot;Reject suggestion&amp;quot; butttons: &lt;br /&gt;
   [[File:E2121_S5.png|700px]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/vyasrc/expertiza/tree/refactor_suggestion_controller GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://152.7.176.119:8080/  VCL link (will expire on Nov 24th 2022)] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145709</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145709"/>
		<updated>2022-10-24T22:03:21Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactor the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 3''': Rename methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Renamed approve method to approve_suggestion and approve_suggestion to approve_suggestion_and_notify&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion_and_notify&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 4''': Move the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file and change its name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def send_email&lt;br /&gt;
    proposer = User.find_by(id: @user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      Mailer.suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{@suggestion.title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: @suggestion.title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Also changed the name of the method to notify_suggestion_approval.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notify_suggestion_approval(used_id, team_id, suggestion_title)&lt;br /&gt;
    proposer = User.find_by(id: user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{suggestion_title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: suggestion_title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Here is the VCL link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://152.7.176.62:8081/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password (Use this account for Testing)&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
1. After logging in as '''Instructor''', click &amp;quot;Manage instructor content&amp;quot; -&amp;gt; &amp;quot;Assignment&amp;quot;:&lt;br /&gt;
   [[File:E2121_S1.png|700px]]&lt;br /&gt;
&lt;br /&gt;
2. Select the &amp;quot;Assignment&amp;quot; tab, in this example we search &amp;quot;textbook&amp;quot; as figure shows.&lt;br /&gt;
   [[File:E2121_S2.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. Choose a item and click &amp;quot;view suggestion&amp;quot; icon. In this example we use &amp;quot;Wiki textbook 2&amp;quot;:&lt;br /&gt;
   [[File:E2121_S3.png|700px]]&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;view&amp;quot; link in which tuple the Status is &amp;quot;Initiated&amp;quot;:&lt;br /&gt;
   [[File:E2121_S4.png|700px]]&lt;br /&gt;
&lt;br /&gt;
5. Now we can see the Suggestion page with &amp;quot;Approve suggestion&amp;quot; and &amp;quot;Reject suggestion&amp;quot; butttons: &lt;br /&gt;
   [[File:E2121_S5.png|700px]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/vyasrc/expertiza/tree/refactor_suggestion_controller GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://152.7.176.119:8080/  VCL link (will expire on Nov 24th 2022)] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145708</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145708"/>
		<updated>2022-10-24T22:02:32Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactor the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 3''': Rename methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Renamed approve method to approve_suggestion and approve_suggestion to approve_suggestion_and_notify&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion_and_notify&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 4''': Move the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file and change its name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def send_email&lt;br /&gt;
    proposer = User.find_by(id: @user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      Mailer.suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{@suggestion.title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: @suggestion.title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Also changed the name of the method to notify_suggestion_approval.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notify_suggestion_approval(used_id, team_id, suggestion_title)&lt;br /&gt;
    proposer = User.find_by(id: user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{suggestion_title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: suggestion_title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password (Use this account for Testing)&lt;br /&gt;
* Student  login: username -&amp;gt; student4340,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student4405,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
1. After logging in as '''Instructor''', click &amp;quot;Manage instructor content&amp;quot; -&amp;gt; &amp;quot;Assignment&amp;quot;:&lt;br /&gt;
   [[File:E2121_S1.png|700px]]&lt;br /&gt;
&lt;br /&gt;
2. Select the &amp;quot;Assignment&amp;quot; tab, in this example we search &amp;quot;textbook&amp;quot; as figure shows.&lt;br /&gt;
   [[File:E2121_S2.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. Choose a item and click &amp;quot;view suggestion&amp;quot; icon. In this example we use &amp;quot;Wiki textbook 2&amp;quot;:&lt;br /&gt;
   [[File:E2121_S3.png|700px]]&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;view&amp;quot; link in which tuple the Status is &amp;quot;Initiated&amp;quot;:&lt;br /&gt;
   [[File:E2121_S4.png|700px]]&lt;br /&gt;
&lt;br /&gt;
5. Now we can see the Suggestion page with &amp;quot;Approve suggestion&amp;quot; and &amp;quot;Reject suggestion&amp;quot; butttons: &lt;br /&gt;
   [[File:E2121_S5.png|700px]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/vyasrc/expertiza/tree/refactor_suggestion_controller GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://152.7.176.119:8080/  VCL link (will expire on Nov 24th 2022)] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145707</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145707"/>
		<updated>2022-10-24T19:43:20Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactor the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 3''': Rename methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Renamed approve method to approve_suggestion and approve_suggestion to approve_suggestion_and_notify&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def approve_suggestion&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def approve_suggestion_and_notify&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Problem 4''': Move the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file and change its name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def send_email&lt;br /&gt;
    proposer = User.find_by(id: @user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      Mailer.suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{@suggestion.title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: @suggestion.title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Also changed the name of the method to notify_suggestion_approval.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notify_suggestion_approval(used_id, team_id, suggestion_title)&lt;br /&gt;
    proposer = User.find_by(id: user_id)&lt;br /&gt;
    if proposer&lt;br /&gt;
      teams_users = TeamsUser.where(team_id: team_id)&lt;br /&gt;
      cc_mail_list = []&lt;br /&gt;
      teams_users.each do |teams_user|&lt;br /&gt;
        cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
      end&lt;br /&gt;
      suggested_topic_approved_message(&lt;br /&gt;
        to: proposer.email,&lt;br /&gt;
        cc: cc_mail_list,&lt;br /&gt;
        subject: &amp;quot;Suggested topic '#{suggestion_title}' has been approved&amp;quot;,&lt;br /&gt;
        body: {&lt;br /&gt;
          approved_topic_name: suggestion_title,&lt;br /&gt;
          proposer: proposer.name&lt;br /&gt;
        }&lt;br /&gt;
      ).deliver_now!&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145706</id>
		<title>CSC/ECE 517 Fall 2022 - E2250. Refactor suggestion controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2250._Refactor_suggestion_controller.rb&amp;diff=145706"/>
		<updated>2022-10-24T19:33:17Z</updated>

		<summary type="html">&lt;p&gt;Vrcholay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Added more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
* Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
* Renamed methods approve and approve_suggestion to correctly reflect their functionalities.&lt;br /&gt;
* Moved the send_email method from suggestion_controller to Mailer class in app/Mailer/mailer.rb file. Renamed the method to notify_suggestion_approval.&lt;br /&gt;
* Merged views/suggestion/show.html.erb and views/suggestion/student_view.html.erb into one file to fix the DRY problem.&lt;br /&gt;
&lt;br /&gt;
===Problems and Solutions===&lt;br /&gt;
* '''Problem 1''': Add more comments to the controller, briefly explain the functionality of custom methods.&lt;br /&gt;
::For example for notification method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Solution''': The approach we have taken is to add comment lines to all methods present in the suggestion_controller.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#will provie notification/email based on the suggestion being approved or not&lt;br /&gt;
#will create and assign team if user is not in any team&lt;br /&gt;
def notification&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    method content&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''Problem 2''': Refactored the notification method to make it simpler by simplifying the control logic and reducing the function's complexity.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                         parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
        new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
      else&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          # clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Solution''': Remove the nested if-else structure and fit all the functionalities into one if-elsif-else-end structure&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y' and @team_id.nil?&lt;br /&gt;
      new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,&lt;br /&gt;
                                        parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
      new_team.create_new_team(@user_id, @signuptopic)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and @topic_id.nil?&lt;br /&gt;
      # clean waitlists&lt;br /&gt;
      SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
      SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
    elsif @suggestion.signup_preference == 'Y' and !@team_id.nil? and !@topic_id.nil?&lt;br /&gt;
      @signuptopic.private_to = @user_id&lt;br /&gt;
      @signuptopic.save&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    else&lt;br /&gt;
      # if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      Mailer.notify_suggestion_approval(@used_id, @team_id, @suggestion.title)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vrcholay</name></author>
	</entry>
</feed>