<?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=Sjha4</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=Sjha4"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Sjha4"/>
	<updated>2026-05-11T05:38:35Z</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_2016_E1703:_Logging_for_Expertiza&amp;diff=105730</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105730"/>
		<updated>2016-11-14T23:31:38Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Overall Process.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the '''ActiveSupport::Logger''' class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*'''UNKNOWN''' : An unknown message that should always be logged.&lt;br /&gt;
*'''FATAL'''   : A unhandleable error that results in a program crash&lt;br /&gt;
*'''ERROR'''   : A handleable error condition&lt;br /&gt;
*'''WARN'''    : Warnings&lt;br /&gt;
*'''INFO'''    : Useful info about system operation&lt;br /&gt;
*'''DEBUG'''   : Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Log Events.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
====UI Testing====&lt;br /&gt;
The new page which is accessible only to the admin should be used for the UI Testing.&lt;br /&gt;
Since this will be a new page, more details on UI testing will be added after implementation.&lt;br /&gt;
&lt;br /&gt;
====RSpec Testing====&lt;br /&gt;
New RSpecs will be written wherever required. Logging statements however need not be tested because testing debug statements is not standard practice.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105728</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105728"/>
		<updated>2016-11-14T23:26:18Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* What we plan to implement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Overall Process.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the '''ActiveSupport::Logger''' class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*'''UNKNOWN''' : An unknown message that should always be logged.&lt;br /&gt;
*'''FATAL'''   : A unhandleable error that results in a program crash&lt;br /&gt;
*'''ERROR'''   : A handleable error condition&lt;br /&gt;
*'''WARN'''    : Warnings&lt;br /&gt;
*'''INFO'''    : Useful info about system operation&lt;br /&gt;
*'''DEBUG'''   : Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Log Events.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105727</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105727"/>
		<updated>2016-11-14T23:23:56Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* What we plan to implement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Overall Process.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the '''ActiveSupport::Logger''' class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*'''UNKNOWN''' &lt;br /&gt;
An unknown message that should always be logged.&lt;br /&gt;
*'''FATAL'''   &lt;br /&gt;
A unhandleable error that results in a program crash&lt;br /&gt;
*'''ERROR'''   &lt;br /&gt;
A handleable error condition&lt;br /&gt;
*'''WARN'''    &lt;br /&gt;
Warnings&lt;br /&gt;
*'''INFO'''    &lt;br /&gt;
Useful info about system operation&lt;br /&gt;
*'''DEBUG'''   &lt;br /&gt;
Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Log Events.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105726</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105726"/>
		<updated>2016-11-14T23:22:42Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* What we plan to implement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Overall Process.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the ActiveSupport::Logger class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*'''UNKNOWN''' &lt;br /&gt;
An unknown message that should always be logged.&lt;br /&gt;
*'''FATAL'''   &lt;br /&gt;
A unhandleable error that results in a program crash&lt;br /&gt;
*'''ERROR'''   &lt;br /&gt;
A handleable error condition&lt;br /&gt;
*'''WARN'''    &lt;br /&gt;
Warnings&lt;br /&gt;
*'''INFO'''    &lt;br /&gt;
Useful info about system operation&lt;br /&gt;
*'''DEBUG'''   &lt;br /&gt;
Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Log Events.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105725</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105725"/>
		<updated>2016-11-14T23:22:04Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* What we plan to implement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Overall Process.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the ActiveSupport::Logger class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*'''UNKNOWN''' An unknown message that should always be logged.&lt;br /&gt;
*'''FATAL'''   A unhandleable error that results in a program crash&lt;br /&gt;
*'''ERROR'''   A handleable error condition&lt;br /&gt;
*'''WARN'''    Warnings&lt;br /&gt;
*'''INFO'''    Useful info about system operation&lt;br /&gt;
*'''DEBUG'''   Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Log Events.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105722</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105722"/>
		<updated>2016-11-14T23:18:37Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* What we plan to implement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Overall Process.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the ActiveSupport::Logger class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*UNKNOWN: An unknown message that should always be logged.&lt;br /&gt;
*FATAL: A unhandleable error that results in a program crash&lt;br /&gt;
*ERROR: A handleable error condition&lt;br /&gt;
*WARN: Warnings&lt;br /&gt;
*INFO: Useful info about system operation&lt;br /&gt;
*DEBUG: Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Log Events.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Overall_Process.png&amp;diff=105721</id>
		<title>File:Overall Process.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Overall_Process.png&amp;diff=105721"/>
		<updated>2016-11-14T23:18:10Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105720</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105720"/>
		<updated>2016-11-14T23:17:58Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Overall Process.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the ActiveSupport::Logger class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*UNKNOWN: An unknown message that should always be logged.&lt;br /&gt;
*FATAL: A unhandleable error that results in a program crash&lt;br /&gt;
*ERROR: A handleable error condition&lt;br /&gt;
*WARN: Warnings&lt;br /&gt;
*INFO: Useful info about system operation&lt;br /&gt;
*DEBUG: Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Log Events.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105719</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105719"/>
		<updated>2016-11-14T23:17:05Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* What we plan to implement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the ActiveSupport::Logger class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*UNKNOWN: An unknown message that should always be logged.&lt;br /&gt;
*FATAL: A unhandleable error that results in a program crash&lt;br /&gt;
*ERROR: A handleable error condition&lt;br /&gt;
*WARN: Warnings&lt;br /&gt;
*INFO: Useful info about system operation&lt;br /&gt;
*DEBUG: Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Log Events.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105716</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105716"/>
		<updated>2016-11-14T23:06:08Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* Interpreting the Logs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the ActiveSupport::Logger class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*UNKNOWN: An unknown message that should always be logged.&lt;br /&gt;
*FATAL: A unhandleable error that results in a program crash&lt;br /&gt;
*ERROR: A handleable error condition&lt;br /&gt;
*WARN: Warnings&lt;br /&gt;
*INFO: Useful info about system operation&lt;br /&gt;
*DEBUG: Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Log Events.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:LogToGUI.png&amp;diff=105714</id>
		<title>File:LogToGUI.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:LogToGUI.png&amp;diff=105714"/>
		<updated>2016-11-14T23:04:45Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105713</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105713"/>
		<updated>2016-11-14T23:04:29Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* Interpreting the Logs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the ActiveSupport::Logger class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*UNKNOWN: An unknown message that should always be logged.&lt;br /&gt;
*FATAL: A unhandleable error that results in a program crash&lt;br /&gt;
*ERROR: A handleable error condition&lt;br /&gt;
*WARN: Warnings&lt;br /&gt;
*INFO: Useful info about system operation&lt;br /&gt;
*DEBUG: Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Log Events.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
[[File:LogToGUI.png|frame]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105703</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105703"/>
		<updated>2016-11-14T22:58:16Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* Logging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the ActiveSupport::Logger class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*UNKNOWN: An unknown message that should always be logged.&lt;br /&gt;
*FATAL: A unhandleable error that results in a program crash&lt;br /&gt;
*ERROR: A handleable error condition&lt;br /&gt;
*WARN: Warnings&lt;br /&gt;
*INFO: Useful info about system operation&lt;br /&gt;
*DEBUG: Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Log Events.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
[[File:sketch.png|frame]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105699</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105699"/>
		<updated>2016-11-14T22:56:32Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* Logging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the ActiveSupport::Logger class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*UNKNOWN: An unknown message that should always be logged.&lt;br /&gt;
*FATAL: A unhandleable error that results in a program crash&lt;br /&gt;
*ERROR: A handleable error condition&lt;br /&gt;
*WARN: Warnings&lt;br /&gt;
*INFO: Useful info about system operation&lt;br /&gt;
*DEBUG: Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
[[File:Log Events.png|frame]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
[[File:sketch.png|frame]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105698</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105698"/>
		<updated>2016-11-14T22:55:55Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: Adding Design diagram&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the ActiveSupport::Logger class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*UNKNOWN: An unknown message that should always be logged.&lt;br /&gt;
*FATAL: A unhandleable error that results in a program crash&lt;br /&gt;
*ERROR: A handleable error condition&lt;br /&gt;
*WARN: Warnings&lt;br /&gt;
*INFO: Useful info about system operation&lt;br /&gt;
*DEBUG: Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
[[File:Log Events.png|frame]]&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
[[File:sketch.png|frame]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Log_Events.png&amp;diff=105697</id>
		<title>File:Log Events.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Log_Events.png&amp;diff=105697"/>
		<updated>2016-11-14T22:55:17Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105663</id>
		<title>CSC/ECE 517 Fall 2016 E1703: Logging for Expertiza</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1703:_Logging_for_Expertiza&amp;diff=105663"/>
		<updated>2016-11-14T22:21:41Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: Adding Design&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Currently, Expertiza doesn’t log anything, beyond the events in the console log.  But often we need to know when a student logged in, reserved a topic, dropped off a team, etc. This will help the admin/instructor verify claims made by the student saying that he had submitted something or did some other activity that but didnt get reflected in expertiza due to a bug, a network issue or something else that went wrong.&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
In a production environment, logs are the best way to debug the application when something goes wrong. In the absence of logs, it is very difficult for a developer/support technician to debug and analyze what went wrong.&lt;br /&gt;
&lt;br /&gt;
==Events to Log==&lt;br /&gt;
====Student Activity====&lt;br /&gt;
Logins, logouts, signups, submission of files/links (although there is already a log of when links are submitted), issuing invitations, joining teams, dropping off teams, requesting reviews, submitting reviews (or author feedback, or teammate reviews, or meta-reviews), undoing any of these operations.  &lt;br /&gt;
&lt;br /&gt;
====Instructor/TA/Admin Activity====&lt;br /&gt;
Creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
==What we plan to implement==&lt;br /&gt;
There are two parts to this project:&lt;br /&gt;
*Logging the events and other information that will help in debugging&lt;br /&gt;
*Creating a GUI to interpret the logs and show events for a particular user in a particular time frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are planning to use the logging framework that comes inbuilt with rails. Rails makes use of the ActiveSupport::Logger class to write log information. Each log statement in the program  has a level associated with it which indicates their importance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hierarchy of log messages is as below:&lt;br /&gt;
*UNKNOWN: An unknown message that should always be logged.&lt;br /&gt;
*FATAL: A unhandleable error that results in a program crash&lt;br /&gt;
*ERROR: A handleable error condition&lt;br /&gt;
*WARN: Warnings&lt;br /&gt;
*INFO: Useful info about system operation&lt;br /&gt;
*DEBUG: Low level info for developers to help with debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the config file, we can specify the level of logs to be printed. A log statement in the program will be printed only if its level is equal to or higher than the level set in the config file. &lt;br /&gt;
&lt;br /&gt;
Usually in production, we set the level to INFO or WARN and in in a development environment, we set it to debug which will print out all the finer details of the state of the system which helps in debugging.&lt;br /&gt;
&lt;br /&gt;
Currently, the expertiza code contains very little logging statement and it does not record student/instructor or TA activity. The current logs are also  of little or no help to a developer/ support technician trying to debug the code when something goes wrong. &lt;br /&gt;
&lt;br /&gt;
We plan on improving the current log statements by adding more information to it so that it becomes more useful to the person trying to debug the code and will also record all student, TA and instructor activities.  We will also be adding more log statements which will make it easier to track all student, TA and instructor activities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second part of the project, we will create a view that is accessible only to the admin from his console. This view will list out the events by interpreting the logs and give an option to filter it based on user and date.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
====Logging====&lt;br /&gt;
We are planning to standardize the log statements by giving them a predefined format. This will also help us in the second part of the project which is to interpret the logs and display student activities in a GUI.&lt;br /&gt;
This is the format we propose:&lt;br /&gt;
*INFO:&lt;br /&gt;
 [TimeStamp: | controller_name|method|  roleid| userid|event: {login|submission|.....}]&lt;br /&gt;
 We will use this to log entry into methods and to log events like login, submission, joining teams, leaving teams, creating assignments, inviting other user to team etc.&lt;br /&gt;
*DEBUG:&lt;br /&gt;
 [TimeStamp: controller_name| method_name|roleid| userid|{variable_name, variable_value}]&lt;br /&gt;
 We will use this to print out values of key variables which the developer/debugger can use for debugging.&lt;br /&gt;
&lt;br /&gt;
In the production environment, we will limit the logs to INFO mode, i.e it will print out only the errors and events.&lt;br /&gt;
&lt;br /&gt;
In development environment, we will set the logger mode to DEBUG. This will print out all the logs including errors, events and debug statements. This will help the developer in debugging the code when something goes wrong.&lt;br /&gt;
&lt;br /&gt;
====Interpreting the Logs====&lt;br /&gt;
This is the second part of the project. We will be creating a GUI to interpret and make sense of all the log data. The GUI will display the events for each user. We will also give an option to filter the event listing  based on date and events.&lt;br /&gt;
&lt;br /&gt;
This is a rough sketch of what the page will look like:&lt;br /&gt;
[[File:sketch.png|frame]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It will have a text field to specify the user ID, a drop down menu to select the event and two date picker fields to specify the begin and end dates for the logs&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104606</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104606"/>
		<updated>2016-11-05T02:53:45Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /*  UI Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_job is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class Review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineTypeClass = self.deadline_type.split(&amp;quot;_&amp;quot;).map { |n| n.capitalize}.join(&amp;quot;&amp;quot;).to_s&lt;br /&gt;
      deadlineObj =  Object.const_get(deadlineTypeClass).new&lt;br /&gt;
      emails = deadlineObj.email_list(self.assignment_id)&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.All the test cases pass for scheduled_task_spec.rb following our changes.[https://travis-ci.org/expertiza/expertiza/builds/172184541]&lt;br /&gt;
&lt;br /&gt;
== ''' UI Testing''' ==&lt;br /&gt;
&lt;br /&gt;
Installation for Reviewers&lt;br /&gt;
&lt;br /&gt;
Because asynchronous events require a daemon running in the background and the new Delayed::Job class for Rails 4 has additional fields, the following steps are recommended. &lt;br /&gt;
&lt;br /&gt;
1. Install Expertiza and execute 'bundle install'&lt;br /&gt;
&lt;br /&gt;
2. Create database and perform data migration using 'rake db:migrate'&lt;br /&gt;
&lt;br /&gt;
3. Execute 'rails generate delayed_job:active_record' at the prompt. This will create a delalyed_job file in /bin directory.&lt;br /&gt;
&lt;br /&gt;
4. Execute 'rails generate delayed:upgrade' if delayed_job has been created before.&lt;br /&gt;
&lt;br /&gt;
5. Enter your smtp server account settings in config/environments/production.rb file. You may find an example in config/environments/developments.rb file.&lt;br /&gt;
&lt;br /&gt;
6. Start the rails server by entering&lt;br /&gt;
&lt;br /&gt;
rails server &lt;br /&gt;
&lt;br /&gt;
5. Start the delayed_job server by executing&lt;br /&gt;
&lt;br /&gt;
RAILS_ENV=production bin/delayed_job start&lt;br /&gt;
&lt;br /&gt;
Please watch the video : [https://www.youtube.com/watch?v=d96A_9j2rng Here] to see how to test the use cases of the functionality that we have refactored.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104604</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104604"/>
		<updated>2016-11-05T02:53:13Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /*  UI Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_job is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class Review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineTypeClass = self.deadline_type.split(&amp;quot;_&amp;quot;).map { |n| n.capitalize}.join(&amp;quot;&amp;quot;).to_s&lt;br /&gt;
      deadlineObj =  Object.const_get(deadlineTypeClass).new&lt;br /&gt;
      emails = deadlineObj.email_list(self.assignment_id)&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.All the test cases pass for scheduled_task_spec.rb following our changes.[https://travis-ci.org/expertiza/expertiza/builds/172184541]&lt;br /&gt;
&lt;br /&gt;
== ''' UI Testing''' ==&lt;br /&gt;
&lt;br /&gt;
Installation for Reviewers&lt;br /&gt;
&lt;br /&gt;
Because asynchronous events require a daemon running in the background and the new Delayed::Job class for Rails 4 has additional fields, the following steps are recommended. &lt;br /&gt;
&lt;br /&gt;
1. Install Expertiza and execute 'bundle install'&lt;br /&gt;
&lt;br /&gt;
2. Create database and perform data migration using 'rake db:migrate'&lt;br /&gt;
&lt;br /&gt;
3. Execute 'rails generate delayed_job:active_record' at the prompt. This will create a delalyed_job file in /bin directory.&lt;br /&gt;
&lt;br /&gt;
4. Execute 'rails generate delayed:upgrade' if delayed_job has been created before.&lt;br /&gt;
&lt;br /&gt;
5. Enter your smtp server account settings in config/environments/production.rb file. You may find an example in config/environments/developments.rb file.&lt;br /&gt;
&lt;br /&gt;
6. Start the rails server by entering&lt;br /&gt;
&lt;br /&gt;
rails server &lt;br /&gt;
&lt;br /&gt;
5. Start the delayed_job server by executing&lt;br /&gt;
&lt;br /&gt;
RAILS_ENV=production bin/delayed_job start&lt;br /&gt;
&lt;br /&gt;
Please watch the video : Here[https://www.youtube.com/watch?v=d96A_9j2rng] to see how to test the use cases of the functionality that we have refactored.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104554</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104554"/>
		<updated>2016-11-04T23:23:07Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /*  UI Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_job is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class Review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineTypeClass = self.deadline_type.split(&amp;quot;_&amp;quot;).map { |n| n.capitalize}.join(&amp;quot;&amp;quot;).to_s&lt;br /&gt;
      deadlineObj =  Object.const_get(deadlineTypeClass).new&lt;br /&gt;
      emails = deadlineObj.email_list(self.assignment_id)&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.All the test cases pass for scheduled_task_spec.rb following our changes.[https://travis-ci.org/expertiza/expertiza/builds/172184541]&lt;br /&gt;
&lt;br /&gt;
== ''' UI Testing''' ==&lt;br /&gt;
&lt;br /&gt;
Installation for Reviewers&lt;br /&gt;
&lt;br /&gt;
Because asynchronous events require a daemon running in the background and the new Delayed::Job class for Rails 4 has additional fields, the following steps are recommended. &lt;br /&gt;
&lt;br /&gt;
1. Install Expertiza and execute 'bundle install'&lt;br /&gt;
&lt;br /&gt;
2. Create database and perform data migration using 'rake db:migrate'&lt;br /&gt;
&lt;br /&gt;
3. Execute 'rails generate delayed_job:active_record' at the prompt. This will create a delalyed_job file in /bin directory.&lt;br /&gt;
&lt;br /&gt;
4. Execute 'rails generate delayed:upgrade' if delayed_job has been created before.&lt;br /&gt;
&lt;br /&gt;
5. Enter your smtp server account settings in config/environments/production.rb file. You may find an example in config/environments/developments.rb file.&lt;br /&gt;
&lt;br /&gt;
6. Start the rails server by entering&lt;br /&gt;
&lt;br /&gt;
rails server &lt;br /&gt;
&lt;br /&gt;
5. Start the delayed_job server by executing&lt;br /&gt;
&lt;br /&gt;
RAILS_ENV=production bin/delayed_job start&lt;br /&gt;
&lt;br /&gt;
Please watch the video : Here[https://www.youtube.com/watch?v=d96A_9j2rng] to see how to test our use cases.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104553</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104553"/>
		<updated>2016-11-04T23:22:51Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /*  UI Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_job is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class Review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineTypeClass = self.deadline_type.split(&amp;quot;_&amp;quot;).map { |n| n.capitalize}.join(&amp;quot;&amp;quot;).to_s&lt;br /&gt;
      deadlineObj =  Object.const_get(deadlineTypeClass).new&lt;br /&gt;
      emails = deadlineObj.email_list(self.assignment_id)&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.All the test cases pass for scheduled_task_spec.rb following our changes.[https://travis-ci.org/expertiza/expertiza/builds/172184541]&lt;br /&gt;
&lt;br /&gt;
== ''' UI Testing''' ==&lt;br /&gt;
&lt;br /&gt;
Installation for Reviewers&lt;br /&gt;
&lt;br /&gt;
Because asynchronous events require a daemon running in the background and the new Delayed::Job class for Rails 4 has additional fields, the following steps are recommended. &lt;br /&gt;
&lt;br /&gt;
1. Install Expertiza and execute 'bundle install'&lt;br /&gt;
&lt;br /&gt;
2. Create database and perform data migration using 'rake db:migrate'&lt;br /&gt;
&lt;br /&gt;
3. Execute 'rails generate delayed_job:active_record' at the prompt. This will create a delalyed_job file in /bin directory.&lt;br /&gt;
&lt;br /&gt;
4. Execute 'rails generate delayed:upgrade' if delayed_job has been created before.&lt;br /&gt;
&lt;br /&gt;
5. Enter your smtp server account settings in config/environments/production.rb file. You may find an example in config/environments/developments.rb file.&lt;br /&gt;
&lt;br /&gt;
6. Start the rails server by entering&lt;br /&gt;
&lt;br /&gt;
rails server &lt;br /&gt;
&lt;br /&gt;
5. Start the delayed_job server by executing&lt;br /&gt;
&lt;br /&gt;
RAILS_ENV=production bin/delayed_job start&lt;br /&gt;
&lt;br /&gt;
Please watch the video : [https://www.youtube.com/watch?v=d96A_9j2rng] to see how to test our use cases.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104552</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104552"/>
		<updated>2016-11-04T23:20:18Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_job is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class Review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineTypeClass = self.deadline_type.split(&amp;quot;_&amp;quot;).map { |n| n.capitalize}.join(&amp;quot;&amp;quot;).to_s&lt;br /&gt;
      deadlineObj =  Object.const_get(deadlineTypeClass).new&lt;br /&gt;
      emails = deadlineObj.email_list(self.assignment_id)&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.All the test cases pass for scheduled_task_spec.rb following our changes.[https://travis-ci.org/expertiza/expertiza/builds/172184541]&lt;br /&gt;
&lt;br /&gt;
== ''' UI Testing''' ==&lt;br /&gt;
&lt;br /&gt;
Installation for Reviewers&lt;br /&gt;
&lt;br /&gt;
Because asynchronous events require a daemon running in the background and the new Delayed::Job class for Rails 4 has additional fields, the following steps are recommended. &lt;br /&gt;
&lt;br /&gt;
1. Install Expertiza and execute 'bundle install'&lt;br /&gt;
&lt;br /&gt;
2. Create database and perform data migration using 'rake db:migrate'&lt;br /&gt;
&lt;br /&gt;
3. Execute 'rails generate delayed_job:active_record' at the prompt. This will create a delalyed_job file in /bin directory.&lt;br /&gt;
&lt;br /&gt;
4. Execute 'rails generate delayed:upgrade' if delayed_job has been created before.&lt;br /&gt;
&lt;br /&gt;
5. Enter your smtp server account settings in config/environments/production.rb file. You may find an example in config/environments/developments.rb file.&lt;br /&gt;
&lt;br /&gt;
6. Start the rails server by entering&lt;br /&gt;
&lt;br /&gt;
rails server &lt;br /&gt;
&lt;br /&gt;
5. Start the delayed_job server by executing&lt;br /&gt;
&lt;br /&gt;
RAILS_ENV=production bin/delayed_job start&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104165</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104165"/>
		<updated>2016-11-01T03:06:33Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_job is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class Review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineTypeClass = self.deadline_type.split(&amp;quot;_&amp;quot;).map { |n| n.capitalize}.join(&amp;quot;&amp;quot;).to_s&lt;br /&gt;
      deadlineObj =  Object.const_get(deadlineTypeClass).new&lt;br /&gt;
      emails = deadlineObj.email_list(self.assignment_id)&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.All the test cases pass for scheduled_task_spec.rb following our changes.[https://travis-ci.org/expertiza/expertiza/builds/172184541]&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104164</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104164"/>
		<updated>2016-11-01T03:05:53Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_job is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class Review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineTypeClass = self.deadline_type.split(&amp;quot;_&amp;quot;).map { |n| n.capitalize}.join(&amp;quot;&amp;quot;).to_s&lt;br /&gt;
      deadlineObj =  Object.const_get(deadlineTypeClass).new&lt;br /&gt;
      emails = deadlineObj.email_list(self.assignment_id)&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.All the test cases pass for the test case.[https://travis-ci.org/expertiza/expertiza/builds/172184541]&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104163</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104163"/>
		<updated>2016-11-01T03:04:53Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* The perform method has been modified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_job is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class Review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineTypeClass = self.deadline_type.split(&amp;quot;_&amp;quot;).map { |n| n.capitalize}.join(&amp;quot;&amp;quot;).to_s&lt;br /&gt;
      deadlineObj =  Object.const_get(deadlineTypeClass).new&lt;br /&gt;
      emails = deadlineObj.email_list(self.assignment_id)&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104162</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104162"/>
		<updated>2016-11-01T03:03:58Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* Several new models have been added. All the deadline_type subclasses have been added as new models. */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_job is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class Review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineObj = self.deadline_type.new&lt;br /&gt;
      emails = deadlineObj.email_list&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104161</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104161"/>
		<updated>2016-11-01T03:03:09Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_job is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineObj = self.deadline_type.new&lt;br /&gt;
      emails = deadlineObj.email_list&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=104160</id>
		<title>E1632: Refactor delayed mailer.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_mailer.rb_and_scheduled_task.rb&amp;diff=104160"/>
		<updated>2016-11-01T03:01:52Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: moved E1632: Refactor delayed mailer.rb and scheduled task.rb to E1632: Refactor delayed job.rb and scheduled task.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[E1632: Refactor delayed job.rb and scheduled task.rb]]&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104159</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=104159"/>
		<updated>2016-11-01T03:01:52Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: moved E1632: Refactor delayed mailer.rb and scheduled task.rb to E1632: Refactor delayed job.rb and scheduled task.rb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_mailer.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_mailer is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineObj = self.deadline_type.new&lt;br /&gt;
      emails = deadlineObj.email_list&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103812</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103812"/>
		<updated>2016-10-29T03:41:02Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_mailer.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_mailer is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineObj = self.deadline_type.new&lt;br /&gt;
      emails = deadlineObj.email_list&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103807</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103807"/>
		<updated>2016-10-29T03:37:13Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: /* The perform method has been modified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_mailer is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI)[http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html] instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineObj = self.deadline_type.new&lt;br /&gt;
      emails = deadlineObj.email_list&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103802</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103802"/>
		<updated>2016-10-29T03:34:35Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_mailer is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI) instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineObj = self.deadline_type.new&lt;br /&gt;
      emails = deadlineObj.email_list&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103796</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103796"/>
		<updated>2016-10-29T03:28:12Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_mailer is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI) instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineObj = self.deadline_type.new&lt;br /&gt;
      emails = deadlineObj.email_list&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
&lt;br /&gt;
The scheduled_task_spec.rb is the test class for the above changes.&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103790</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103790"/>
		<updated>2016-10-29T03:23:42Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_mailer is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI) instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineObj = self.deadline_type.new&lt;br /&gt;
      emails = deadlineObj.email_list&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Sjha4&amp;diff=103783</id>
		<title>User:Sjha4</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Sjha4&amp;diff=103783"/>
		<updated>2016-10-29T03:20:12Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: moved User:Sjha4 to E1632: Refactor delayed mailer.rb and scheduled task.rb: OSS Project&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[E1632: Refactor delayed mailer.rb and scheduled task.rb]]&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103782</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103782"/>
		<updated>2016-10-29T03:20:12Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: moved User:Sjha4 to E1632: Refactor delayed mailer.rb and scheduled task.rb: OSS Project&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Problem Statement'''&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_mailer is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI) instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineObj = self.deadline_type.new&lt;br /&gt;
      emails = deadlineObj.email_list&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103780</id>
		<title>E1632: Refactor delayed job.rb and scheduled task.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1632:_Refactor_delayed_job.rb_and_scheduled_task.rb&amp;diff=103780"/>
		<updated>2016-10-29T03:18:07Z</updated>

		<summary type="html">&lt;p&gt;Sjha4: Adding wiki for OSS project 1&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Expertiza''' ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source type of project that has been undertaken by the National Science Foundation. Various articles, codes in multiple languages and links can be submitted using the platform. It is popularly used by students studying at NC State to submit assignments, review works and get feedback. It allows users to switch between multiple environments if an user is not satisfied with a particular environment.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Installation and Contribution''' ==&lt;br /&gt;
&lt;br /&gt;
The setup development can be done using OSX, Linux or Docker. While using the OSX method and Linux method (RHEL), shell access and root access is a prerequisite. Docker is another method to install Wikipedia. It is cross Operating System (OS) compatible. Docker pull is needed to pull the docker image. Docker run is then used on port number 3000.&lt;br /&gt;
Expertiza allows user to contribute to their project. The expertiza project needs to be forked and cloned to create a local directory. Changes can be pushed and committed to a new branch. Finally the code is reviewed and changes are possibly made after a pull request.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Problem Statement'''&lt;br /&gt;
The project is related to the class scheduled_class. The associated MVC framework relate to sending out reminder emails around the deadline of a task. The project objective includes-&lt;br /&gt;
*Removing duplicate code that is common in scheduled_task.rb and delayed_job.rb.&lt;br /&gt;
*Subclass Deadline_Type in the perform method.&lt;br /&gt;
*Refactoring mail_signed_up_users to multiple named methods and modifying it in a more elegant manner.&lt;br /&gt;
*Checks to the new refactored code.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
A task queue is implemented in expertiza for all the emails that need to be sent to the users. Delayed_mailer is used to send this task when the task is out of the queue. Scheduled_task provides information to the admin about the queue present at any given time. Scheduled_task uses assignment_id, deadline_type and due at to provide information for the admin. Current implementations include-&lt;br /&gt;
*Using the perform method linked to other methods mailing can be done for metareviewers, emails can be fetched and reminders can be sent to team members and mails can be sent to all signed up users.&lt;br /&gt;
*Implementation can be used for various types of deadlines. Deadline for team formation, sign-up and dropping outstanding reviews are also implemented.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks and Solutions'''&lt;br /&gt;
'''Problem 1:''' Perform is too big a method and is implemented in a complicated manner.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' Deadline_type is made a superclass with metareview, review, submission, drop_topic, sign_up, team_formation,drop_one_member_topic, drop_outstanding_reviews as the subclasses. The subclasses have a method email_list which contains the functionality. Thus, inheritance replaces the case structure. &lt;br /&gt;
 &lt;br /&gt;
'''Problem 2:''' mail_signed_up_users is a long method and contains duplicate code in its branches.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' The mail_signed_up users can be split to two different methods- mail_sign_up_topics_user and and mail_non_sign_up_topics_user.The functionality of the first one is also used by the drop_topic subclass and the submission subclass uses both- the mail_sign_up_topics_user and mail_non_sign_up_topics_user.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Code Modification''' ==&lt;br /&gt;
&lt;br /&gt;
== Several new models have been added. All the deadline_type subclasses have been added as new models. ==&lt;br /&gt;
One of them looks like:&lt;br /&gt;
&lt;br /&gt;
 class review &amp;lt; DeadlineType&lt;br /&gt;
  def email_list(assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    reviewer_tuples = ResponseMap.where(['reviewed_object_id = ? AND type = &amp;quot;ReviewResponseMap&amp;quot;', assignment_id])&lt;br /&gt;
    for reviewer in reviewer_tuples&lt;br /&gt;
      participant = Participant.where(['parent_id = ? AND id = ?', assignment_id, reviewer.reviewer_id])&lt;br /&gt;
      uid  = participant.first.user_id&lt;br /&gt;
      user = User.find(uid)&lt;br /&gt;
      emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
    end&lt;br /&gt;
    emails&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changes to the mail_signed_up_user ==&lt;br /&gt;
&lt;br /&gt;
This includes the splitting of the method to multiple methods to make it more elegant&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def mail_signed_up_users&lt;br /&gt;
    emails = []&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
    # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
    if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
      if assignment.team_assignment?&lt;br /&gt;
        teamMails = getTeamMembersMail&lt;br /&gt;
        for mail in teamMails&lt;br /&gt;
          emails &amp;lt;&amp;lt; mail&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      else&lt;br /&gt;
        mail_assignment_participants&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      for topic in sign_up_topics&lt;br /&gt;
        signedUpTeams = SignedUpTeam.where(['topic_id = ?', topic.id])&lt;br /&gt;
        unless assignment.team_assignment?&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            uid  = signedUser.team_id&lt;br /&gt;
            user = User.find(uid)&lt;br /&gt;
            emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          for signedUser in signedUpTeams&lt;br /&gt;
            teamid = signedUser.team_id&lt;br /&gt;
            team_members = TeamsUser.where(team_id: teamid)&lt;br /&gt;
            for team_member in team_members&lt;br /&gt;
              user = User.find(team_member.user_id)&lt;br /&gt;
              emails &amp;lt;&amp;lt; user.email&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def mail_signed_up_users&lt;br /&gt;
   sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
   # If there are sign_up topics for an assignement then send a mail toonly signed_up_teams else send a mail to all participants&lt;br /&gt;
   if (sign_up_topics.nil? || sign_up_topics.count == 0)&lt;br /&gt;
    emails = mail_non_sign_up_topic_users&lt;br /&gt;
   else&lt;br /&gt;
    emails = mail_sign_up_topic_users&lt;br /&gt;
   end&lt;br /&gt;
  emails&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
== The perform method has been modified ==&lt;br /&gt;
The perform method has been modified to a large extent as it now uses Single Table Inheritance (STI) instead of if-else cases statements.&lt;br /&gt;
&lt;br /&gt;
'''Earlier Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      if (self.deadline_type == &amp;quot;metareview&amp;quot;)&lt;br /&gt;
        mail_metareviewers&lt;br /&gt;
        if assignment.team_assignment?&lt;br /&gt;
          teamMails = getTeamMembersMail&lt;br /&gt;
          email_reminder(teamMails, &amp;quot;teammate review&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;review&amp;quot;)&lt;br /&gt;
        mail_reviewers # to all reviewers&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;submission&amp;quot;)&lt;br /&gt;
        mail_signed_up_users # to all signed up users&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_signed_up_users # reminder to signed_up users of the assignment&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;signup&amp;quot;)&lt;br /&gt;
        sign_up_topics = SignUpTopic.where(['assignment_id = ?', self.assignment_id])&lt;br /&gt;
        if (!sign_up_topics.nil? &amp;amp;&amp;amp; sign_up_topics.count != 0)&lt;br /&gt;
          mail_assignment_participants # reminder to all participants&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        if (assignment.team_assignment?)&lt;br /&gt;
          emails = get_one_member_team&lt;br /&gt;
          email_reminder(emails, self.deadline_type)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_one_member_topics&amp;quot;)&lt;br /&gt;
        assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
        drop_one_member_topics if (assignment.team_assignment?)&lt;br /&gt;
      end&lt;br /&gt;
      if (self.deadline_type == &amp;quot;drop_outstanding_reviews&amp;quot;)&lt;br /&gt;
        drop_outstanding_reviews&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
'''Modified Code:'''&lt;br /&gt;
&lt;br /&gt;
 def perform&lt;br /&gt;
    assignment = Assignment.find(self.assignment_id)&lt;br /&gt;
    emails = []&lt;br /&gt;
    if !assignment.nil? &amp;amp;&amp;amp; !assignment.id.nil?&lt;br /&gt;
      deadlineObj = self.deadline_type.new&lt;br /&gt;
      emails = deadlineObj.email_list&lt;br /&gt;
      email_reminder(emails, self.deadline_type) if emails.size &amp;gt; 0&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Sjha4</name></author>
	</entry>
</feed>