<?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=Rmandav</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=Rmandav"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Rmandav"/>
	<updated>2026-07-06T10:45:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108957</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108957"/>
		<updated>2017-05-09T19:22:42Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Testing */&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Activity Logger == &lt;br /&gt;
&lt;br /&gt;
This same project was assigned to another team last semester and a lot of code was written to log the given accounts. A lot of additions were added to many controllers wherever the events are to be tracked. The code was not merged anyways. We came up with an idea that doesn't modify or add any code to controllers. Logging model shouldn't be a burden to the UI at all.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Public Activity Gem'''&lt;br /&gt;
The gem we used is &lt;br /&gt;
&amp;lt;pre&amp;gt; gem 'public_activity' &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
According to the documentation: &amp;lt;br&amp;gt;&lt;br /&gt;
Public_activity provides easy activity tracking for your ActiveRecord, Mongoid 3 and MongoMapper models in Rails 3. Simply put: it records what has been changed or created and gives you the ability to present those recorded activities to users - in a similar way to how GitHub does it.&lt;br /&gt;
&lt;br /&gt;
This gem perfectly solves our objectives in two ways. &lt;br /&gt;
* It tracks our events because every event type we need to address has some change or access models. &lt;br /&gt;
* No modifying or adding code in controllers. (Except some session logins and logouts need to be added)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We need to read the activities based on the search options added and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
====Changes to the database ====&lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for storing these activities. A new migration needs to be created to add the new table to the database.&lt;br /&gt;
====New model====&lt;br /&gt;
&lt;br /&gt;
A new model will be created to add each log to the activity. The model will contain fields pertaining to a model such as a user id, type of event, event description, timestamp etc.&lt;br /&gt;
&lt;br /&gt;
'''Table: Event logs'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| trackable_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| trackable_type&lt;br /&gt;
| varchar&lt;br /&gt;
|-&lt;br /&gt;
| owner_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| owner_type&lt;br /&gt;
| varchar&lt;br /&gt;
|-&lt;br /&gt;
| created_at&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| updated_at&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| parameters&lt;br /&gt;
| text&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''' Add Public Activity to Model '''&lt;br /&gt;
How to add to a model?&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
include PublicActivity::Model&lt;br /&gt;
tracked owner: -&amp;gt;(controller, _model) { controller &amp;amp;&amp;amp; controller.current_user }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This small piece of code ensures all the activities are noted when there is an entry made or changed or deleted&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We added to the following models:&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* assignment_due_date.rb&lt;br /&gt;
* assignment_participant.rb&lt;br /&gt;
* assignment_questionnaire.rb&lt;br /&gt;
* course.rb&lt;br /&gt;
* course_participant.rb&lt;br /&gt;
* invitation.rb&lt;br /&gt;
* join_team_request.rb&lt;br /&gt;
* participant.rb&lt;br /&gt;
* response.rb&lt;br /&gt;
* response_map.rb&lt;br /&gt;
* review_grade.rb&lt;br /&gt;
* sign_up_sheet.rb&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Controllers that were modified, since some activities don't have any effect on a model to enable public activity record those events.&lt;br /&gt;
* activities&lt;br /&gt;
* application&lt;br /&gt;
* auth&lt;br /&gt;
* course&lt;br /&gt;
* impersonate&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
====New Views====&lt;br /&gt;
&lt;br /&gt;
Public Activity records the events with a trackable id, the table on which the action took place but not any details or description. We add to the public activities views the required code to get the details with the trackable id, type, model taken as parameters. All the activity views specific to each event are added under public activity folder specific to each model.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We added the specific filters such as search by user name or any specific date to search for the events. By default, all the activities are shown up on the page accessed with the link &amp;quot;activities/index&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:ac12.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:ac22.png]]&lt;br /&gt;
&lt;br /&gt;
== Future Work - Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108956</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108956"/>
		<updated>2017-05-09T19:22:09Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* New Views */&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Activity Logger == &lt;br /&gt;
&lt;br /&gt;
This same project was assigned to another team last semester and a lot of code was written to log the given accounts. A lot of additions were added to many controllers wherever the events are to be tracked. The code was not merged anyways. We came up with an idea that doesn't modify or add any code to controllers. Logging model shouldn't be a burden to the UI at all.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Public Activity Gem'''&lt;br /&gt;
The gem we used is &lt;br /&gt;
&amp;lt;pre&amp;gt; gem 'public_activity' &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
According to the documentation: &amp;lt;br&amp;gt;&lt;br /&gt;
Public_activity provides easy activity tracking for your ActiveRecord, Mongoid 3 and MongoMapper models in Rails 3. Simply put: it records what has been changed or created and gives you the ability to present those recorded activities to users - in a similar way to how GitHub does it.&lt;br /&gt;
&lt;br /&gt;
This gem perfectly solves our objectives in two ways. &lt;br /&gt;
* It tracks our events because every event type we need to address has some change or access models. &lt;br /&gt;
* No modifying or adding code in controllers. (Except some session logins and logouts need to be added)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We need to read the activities based on the search options added and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
====Changes to the database ====&lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for storing these activities. A new migration needs to be created to add the new table to the database.&lt;br /&gt;
====New model====&lt;br /&gt;
&lt;br /&gt;
A new model will be created to add each log to the activity. The model will contain fields pertaining to a model such as a user id, type of event, event description, timestamp etc.&lt;br /&gt;
&lt;br /&gt;
'''Table: Event logs'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| trackable_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| trackable_type&lt;br /&gt;
| varchar&lt;br /&gt;
|-&lt;br /&gt;
| owner_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| owner_type&lt;br /&gt;
| varchar&lt;br /&gt;
|-&lt;br /&gt;
| created_at&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| updated_at&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| parameters&lt;br /&gt;
| text&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''' Add Public Activity to Model '''&lt;br /&gt;
How to add to a model?&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
include PublicActivity::Model&lt;br /&gt;
tracked owner: -&amp;gt;(controller, _model) { controller &amp;amp;&amp;amp; controller.current_user }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This small piece of code ensures all the activities are noted when there is an entry made or changed or deleted&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We added to the following models:&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* assignment_due_date.rb&lt;br /&gt;
* assignment_participant.rb&lt;br /&gt;
* assignment_questionnaire.rb&lt;br /&gt;
* course.rb&lt;br /&gt;
* course_participant.rb&lt;br /&gt;
* invitation.rb&lt;br /&gt;
* join_team_request.rb&lt;br /&gt;
* participant.rb&lt;br /&gt;
* response.rb&lt;br /&gt;
* response_map.rb&lt;br /&gt;
* review_grade.rb&lt;br /&gt;
* sign_up_sheet.rb&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Controllers that were modified, since some activities don't have any effect on a model to enable public activity record those events.&lt;br /&gt;
* activities&lt;br /&gt;
* application&lt;br /&gt;
* auth&lt;br /&gt;
* course&lt;br /&gt;
* impersonate&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
====New Views====&lt;br /&gt;
&lt;br /&gt;
Public Activity records the events with a trackable id, the table on which the action took place but not any details or description. We add to the public activities views the required code to get the details with the trackable id, type, model taken as parameters. All the activity views specific to each event are added under public activity folder specific to each model.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We added the specific filters such as search by user name or any specific date to search for the events. By default, all the activities are shown up on the page accessed with the link &amp;quot;activities/index&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:ac12.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:ac22.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ac22.png&amp;diff=108955</id>
		<title>File:Ac22.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ac22.png&amp;diff=108955"/>
		<updated>2017-05-09T19:21:47Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ac12.png&amp;diff=108954</id>
		<title>File:Ac12.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ac12.png&amp;diff=108954"/>
		<updated>2017-05-09T19:19:32Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ac2.jpg&amp;diff=108953</id>
		<title>File:Ac2.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ac2.jpg&amp;diff=108953"/>
		<updated>2017-05-09T19:10:54Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108952</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108952"/>
		<updated>2017-05-09T19:05:28Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Implementation of Task 2: UI */&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Activity Logger == &lt;br /&gt;
&lt;br /&gt;
This same project was assigned to another team last semester and a lot of code was written to log the given accounts. A lot of additions were added to many controllers wherever the events are to be tracked. The code was not merged anyways. We came up with an idea that doesn't modify or add any code to controllers. Logging model shouldn't be a burden to the UI at all.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Public Activity Gem'''&lt;br /&gt;
The gem we used is &lt;br /&gt;
&amp;lt;pre&amp;gt; gem 'public_activity' &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
According to the documentation: &amp;lt;br&amp;gt;&lt;br /&gt;
Public_activity provides easy activity tracking for your ActiveRecord, Mongoid 3 and MongoMapper models in Rails 3. Simply put: it records what has been changed or created and gives you the ability to present those recorded activities to users - in a similar way to how GitHub does it.&lt;br /&gt;
&lt;br /&gt;
This gem perfectly solves our objectives in two ways. &lt;br /&gt;
* It tracks our events because every event type we need to address has some change or access models. &lt;br /&gt;
* No modifying or adding code in controllers. (Except some session logins and logouts need to be added)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We need to read the activities based on the search options added and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
====Changes to the database ====&lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for storing these activities. A new migration needs to be created to add the new table to the database.&lt;br /&gt;
====New model====&lt;br /&gt;
&lt;br /&gt;
A new model will be created to add each log to the activity. The model will contain fields pertaining to a model such as a user id, type of event, event description, timestamp etc.&lt;br /&gt;
&lt;br /&gt;
'''Table: Event logs'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| trackable_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| trackable_type&lt;br /&gt;
| varchar&lt;br /&gt;
|-&lt;br /&gt;
| owner_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| owner_type&lt;br /&gt;
| varchar&lt;br /&gt;
|-&lt;br /&gt;
| created_at&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| updated_at&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| parameters&lt;br /&gt;
| text&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''' Add Public Activity to Model '''&lt;br /&gt;
How to add to a model?&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
include PublicActivity::Model&lt;br /&gt;
tracked owner: -&amp;gt;(controller, _model) { controller &amp;amp;&amp;amp; controller.current_user }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This small piece of code ensures all the activities are noted when there is an entry made or changed or deleted&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We added to the following models:&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* assignment_due_date.rb&lt;br /&gt;
* assignment_participant.rb&lt;br /&gt;
* assignment_questionnaire.rb&lt;br /&gt;
* course.rb&lt;br /&gt;
* course_participant.rb&lt;br /&gt;
* invitation.rb&lt;br /&gt;
* join_team_request.rb&lt;br /&gt;
* participant.rb&lt;br /&gt;
* response.rb&lt;br /&gt;
* response_map.rb&lt;br /&gt;
* review_grade.rb&lt;br /&gt;
* sign_up_sheet.rb&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Controllers that were modified, since some activities don't have any effect on a model to enable public activity record those events.&lt;br /&gt;
* activities&lt;br /&gt;
* application&lt;br /&gt;
* auth&lt;br /&gt;
* course&lt;br /&gt;
* impersonate&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
====New Views====&lt;br /&gt;
&lt;br /&gt;
Public Activity records the events with a trackable id, the table on which the action took place but not any details or description. We add to the public activities views the required code to get the details with the trackable id, type, model taken as parameters. All the activity views specific to each event are added under public activity folder specific to each model.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We added the specific filters such as search by user name or any specific date to search for the events. By default, all the activities are shown up on the page accessed with the link &amp;quot;activities/index&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108951</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108951"/>
		<updated>2017-05-09T18:51:08Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: &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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Activity Logger == &lt;br /&gt;
&lt;br /&gt;
This same project was assigned to another team last semester and a lot of code was written to log the given accounts. A lot of additions were added to many controllers wherever the events are to be tracked. The code was not merged anyways. We came up with an idea that doesn't modify or add any code to controllers. Logging model shouldn't be a burden to the UI at all.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Public Activity Gem'''&lt;br /&gt;
The gem we used is &lt;br /&gt;
&amp;lt;pre&amp;gt; gem 'public_activity' &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
According to the documentation: &amp;lt;br&amp;gt;&lt;br /&gt;
Public_activity provides easy activity tracking for your ActiveRecord, Mongoid 3 and MongoMapper models in Rails 3. Simply put: it records what has been changed or created and gives you the ability to present those recorded activities to users - in a similar way to how GitHub does it.&lt;br /&gt;
&lt;br /&gt;
This gem perfectly solves our objectives in two ways. &lt;br /&gt;
* It tracks our events because every event type we need to address has some change or access models. &lt;br /&gt;
* No modifying or adding code in controllers. (Except some session logins and logouts need to be added)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We need to read the activities based on the search options added and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
====Changes to the database ====&lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for storing these activities. A new migration needs to be created to add the new table to the database.&lt;br /&gt;
====New model====&lt;br /&gt;
&lt;br /&gt;
A new model will be created to add each log to the activity. The model will contain fields pertaining to a model such as a user id, type of event, event description, timestamp etc.&lt;br /&gt;
&lt;br /&gt;
'''Table: Event logs'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| trackable_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| trackable_type&lt;br /&gt;
| varchar&lt;br /&gt;
|-&lt;br /&gt;
| owner_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| owner_type&lt;br /&gt;
| varchar&lt;br /&gt;
|-&lt;br /&gt;
| created_at&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| updated_at&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| parameters&lt;br /&gt;
| text&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
''' Add Public Activity to Model '''&lt;br /&gt;
How to add to a model?&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
include PublicActivity::Model&lt;br /&gt;
tracked owner: -&amp;gt;(controller, _model) { controller &amp;amp;&amp;amp; controller.current_user }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This small piece of code ensures all the activities are noted when there is an entry made or changed or deleted&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We added to the following models:&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* assignment_due_date.rb&lt;br /&gt;
* assignment_participant.rb&lt;br /&gt;
* assignment_questionnaire.rb&lt;br /&gt;
* course.rb&lt;br /&gt;
* course_participant.rb&lt;br /&gt;
* invitation.rb&lt;br /&gt;
* join_team_request.rb&lt;br /&gt;
* participant.rb&lt;br /&gt;
* response.rb&lt;br /&gt;
* response_map.rb&lt;br /&gt;
* review_grade.rb&lt;br /&gt;
* sign_up_sheet.rb&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Controllers that were modified, since some activities don't have any effect on a model to enable public activity record those events.&lt;br /&gt;
* activities&lt;br /&gt;
* application&lt;br /&gt;
* auth&lt;br /&gt;
* course&lt;br /&gt;
* impersonate&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
====New Views====&lt;br /&gt;
&lt;br /&gt;
A new view will be added which can be accessed only by the system admins which shows the admins the list of logs. A log entry will have a user id with whom the event is associated to, an event type, a description of the event and a timestamp. We will give the admin the option to filter the logs based on each of the mentioned values. Options to add multiple search criteria will also be provided.&lt;br /&gt;
&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108950</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108950"/>
		<updated>2017-05-09T16:08:23Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Implementation of Task 1: 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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Activity Logger == &lt;br /&gt;
&lt;br /&gt;
This same project was assigned to another team last semester and a lot of code was written to log the given accounts. A lot of additions were added to many controllers wherever the events are to be tracked. The code was not merged anyways. We came up with an idea that doesn't modify or add any code to controllers. Logging model shouldn't be a burden to the UI at all.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Public Activity Gem'''&lt;br /&gt;
The gem we used is &lt;br /&gt;
&amp;lt;pre&amp;gt; gem 'public_activity' &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
According to the documentation: &amp;lt;br&amp;gt;&lt;br /&gt;
Public_activity provides easy activity tracking for your ActiveRecord, Mongoid 3 and MongoMapper models in Rails 3. Simply put: it records what has been changed or created and gives you the ability to present those recorded activities to users - in a similar way to how GitHub does it.&lt;br /&gt;
&lt;br /&gt;
This gem perfectly solves our objectives in two ways. &lt;br /&gt;
* It tracks our events because every event type we need to address has some change or access models. &lt;br /&gt;
* No modifying or adding code in controllers. (Except some session logins and logouts need to be added)&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We need to read the activities based on the search options added and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
====Changes to the database ====&lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for storing these activities. A new migration needs to be created to add the new table to the database.&lt;br /&gt;
====New model====&lt;br /&gt;
&lt;br /&gt;
A new model will be created to add each log to the activity. The model will contain fields pertaining to a model such as a user id, type of event, event description, timestamp etc.&lt;br /&gt;
&lt;br /&gt;
'''Table: Event logs'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| trackable_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| trackable_type&lt;br /&gt;
| varchar&lt;br /&gt;
|-&lt;br /&gt;
| owner_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| owner_type&lt;br /&gt;
| varchar&lt;br /&gt;
|-&lt;br /&gt;
| created_at&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| updated_at&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| parameters&lt;br /&gt;
| text&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
====New Views====&lt;br /&gt;
&lt;br /&gt;
A new view will be added which can be accessed only by the system admins which shows the admins the list of logs. A log entry will have a user id with whom the event is associated to, an event type, a description of the event and a timestamp. We will give the admin the option to filter the logs based on each of the mentioned values. Options to add multiple search criteria will also be provided.&lt;br /&gt;
&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108949</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108949"/>
		<updated>2017-05-09T15:59:47Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Design of Task 2: UI Part */&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Activity Logger == &lt;br /&gt;
&lt;br /&gt;
This same project was assigned to another team last semester and a lot of code was written to log the given accounts. A lot of additions were added to many controllers wherever the events are to be tracked. The code was not merged anyways. We came up with an idea that doesn't modify or add any code to controllers. Logging model shouldn't be a burden to the UI at all.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Public Activity Gem'''&lt;br /&gt;
The gem we used is &lt;br /&gt;
&amp;lt;pre&amp;gt; gem 'public_activity' &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
According to the documentation: &amp;lt;br&amp;gt;&lt;br /&gt;
Public_activity provides easy activity tracking for your ActiveRecord, Mongoid 3 and MongoMapper models in Rails 3. Simply put: it records what has been changed or created and gives you the ability to present those recorded activities to users - in a similar way to how GitHub does it.&lt;br /&gt;
&lt;br /&gt;
This gem perfectly solves our objectives in two ways. &lt;br /&gt;
* It tracks our events because every event type we need to address has some change or access models. &lt;br /&gt;
* No modifying or adding code in controllers. (Except some session logins and logouts need to be added)&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We need to read the activities based on the search options added and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
====Changes to the database ====&lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for logging. A new migration needs to be created to add the new table to the database.&lt;br /&gt;
====New model====&lt;br /&gt;
&lt;br /&gt;
A new model will be created to add each log to the record. The model will contain fields pertaining to a model such as a user id, type of event, event description, timestamp etc.&lt;br /&gt;
&lt;br /&gt;
'''Table: Event logs'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| user_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| start_date&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| event_type&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| event_description&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| user_role&lt;br /&gt;
| Integer&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====New helpers====&lt;br /&gt;
&lt;br /&gt;
A new helper file will be created which will take care of what events to log. &lt;br /&gt;
[[File:UML AddEventLogger.png]]&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
====New Views====&lt;br /&gt;
&lt;br /&gt;
A new view will be added which can be accessed only by the system admins which shows the admins the list of logs. A log entry will have a user id with whom the event is associated to, an event type, a description of the event and a timestamp. We will give the admin the option to filter the logs based on each of the mentioned values. Options to add multiple search criteria will also be provided.&lt;br /&gt;
&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108948</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108948"/>
		<updated>2017-05-09T15:57:13Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Design of Task 1: Activity Logger */&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Activity Logger == &lt;br /&gt;
&lt;br /&gt;
This same project was assigned to another team last semester and a lot of code was written to log the given accounts. A lot of additions were added to many controllers wherever the events are to be tracked. The code was not merged anyways. We came up with an idea that doesn't modify or add any code to controllers. Logging model shouldn't be a burden to the UI at all.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Public Activity Gem'''&lt;br /&gt;
The gem we used is &lt;br /&gt;
&amp;lt;pre&amp;gt; gem 'public_activity' &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
According to the documentation: &amp;lt;br&amp;gt;&lt;br /&gt;
Public_activity provides easy activity tracking for your ActiveRecord, Mongoid 3 and MongoMapper models in Rails 3. Simply put: it records what has been changed or created and gives you the ability to present those recorded activities to users - in a similar way to how GitHub does it.&lt;br /&gt;
&lt;br /&gt;
This gem perfectly solves our objectives in two ways. &lt;br /&gt;
* It tracks our events because every event type we need to address has some change or access models. &lt;br /&gt;
* No modifying or adding code in controllers. (Except some session logins and logouts need to be added)&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We nee to read the log data and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, event type, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
* Event Type:  {Drop Down box}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
====Changes to the database ====&lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for logging. A new migration needs to be created to add the new table to the database.&lt;br /&gt;
====New model====&lt;br /&gt;
&lt;br /&gt;
A new model will be created to add each log to the record. The model will contain fields pertaining to a model such as a user id, type of event, event description, timestamp etc.&lt;br /&gt;
&lt;br /&gt;
'''Table: Event logs'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| user_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| start_date&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| event_type&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| event_description&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| user_role&lt;br /&gt;
| Integer&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====New helpers====&lt;br /&gt;
&lt;br /&gt;
A new helper file will be created which will take care of what events to log. &lt;br /&gt;
[[File:UML AddEventLogger.png]]&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
====New Views====&lt;br /&gt;
&lt;br /&gt;
A new view will be added which can be accessed only by the system admins which shows the admins the list of logs. A log entry will have a user id with whom the event is associated to, an event type, a description of the event and a timestamp. We will give the admin the option to filter the logs based on each of the mentioned values. Options to add multiple search criteria will also be provided.&lt;br /&gt;
&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108947</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108947"/>
		<updated>2017-05-09T15:56:45Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Design of Task 1: 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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Activity Logger == &lt;br /&gt;
&lt;br /&gt;
This same project was assigned to another team last semester and a lot of code was written to log the given accounts. A lot of additions were added to many controllers wherever the events are to be tracked. The code was not merged anyways. We came up with an idea that doesn't modify or add any code to controllers. Logging model shouldn't be a burden to the UI at all.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Public Activity Gem'''&lt;br /&gt;
The gem we used is &lt;br /&gt;
&amp;lt;pre&amp;gt; gem 'public_activity' &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
According to the documentation: &amp;lt;br&amp;gt;&lt;br /&gt;
Public_activity provides easy activity tracking for your ActiveRecord, Mongoid 3 and MongoMapper models in Rails 3. Simply put: it records what has been changed or created and gives you the ability to present those recorded activities to users - in a similar way to how GitHub does it.&lt;br /&gt;
&lt;br /&gt;
This gem perfectly solves our objectives in two ways. &lt;br /&gt;
1) It tracks our events because every event type we need to address has some change or access models. &lt;br /&gt;
2) No modifying or adding code in controllers. (Except some session logins and logouts need to be added)&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We nee to read the log data and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, event type, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
* Event Type:  {Drop Down box}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
====Changes to the database ====&lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for logging. A new migration needs to be created to add the new table to the database.&lt;br /&gt;
====New model====&lt;br /&gt;
&lt;br /&gt;
A new model will be created to add each log to the record. The model will contain fields pertaining to a model such as a user id, type of event, event description, timestamp etc.&lt;br /&gt;
&lt;br /&gt;
'''Table: Event logs'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| user_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| start_date&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| event_type&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| event_description&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| user_role&lt;br /&gt;
| Integer&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====New helpers====&lt;br /&gt;
&lt;br /&gt;
A new helper file will be created which will take care of what events to log. &lt;br /&gt;
[[File:UML AddEventLogger.png]]&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
====New Views====&lt;br /&gt;
&lt;br /&gt;
A new view will be added which can be accessed only by the system admins which shows the admins the list of logs. A log entry will have a user id with whom the event is associated to, an event type, a description of the event and a timestamp. We will give the admin the option to filter the logs based on each of the mentioned values. Options to add multiple search criteria will also be provided.&lt;br /&gt;
&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108547</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108547"/>
		<updated>2017-04-13T03:44:46Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* New Views */&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
The Logger class in Rails has the following severity levels:&lt;br /&gt;
&lt;br /&gt;
* UNKNOWN - An unknown message that should always be logged.&lt;br /&gt;
* FATAL - A un-handleable error that results in a program crash.&lt;br /&gt;
* ERROR - A handleable error condition.&lt;br /&gt;
* WARN - A warning.&lt;br /&gt;
* INFO - Generic (useful) information about system operation.&lt;br /&gt;
* DEBUG - Low-level information for developers.&lt;br /&gt;
&lt;br /&gt;
Usually, in a production system Logger is set to INFO or WARN. For our project, we plan to use DEBUG level severity. For this, we first need to change the Formatter class to include DEBUG level severity to the log file. &lt;br /&gt;
&lt;br /&gt;
We plan to implement a new helper file which deals logging the events which we want. We plan on doing it this way to separate out the logging code from the controller code.&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We nee to read the log data and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, event type, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
* Event Type:  {Drop Down box}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
====Changes to the database ====&lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for logging. A new migration needs to be created to add the new table to the database.&lt;br /&gt;
====New model====&lt;br /&gt;
&lt;br /&gt;
A new model will be created to add each log to the record. The model will contain fields pertaining to a model such as a user id, type of event, event description, timestamp etc.&lt;br /&gt;
&lt;br /&gt;
'''Table: Event logs'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| user_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| start_date&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| event_type&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| event_description&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| user_role&lt;br /&gt;
| Integer&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====New helpers====&lt;br /&gt;
&lt;br /&gt;
A new helper file will be created which will take care of what events to log. &lt;br /&gt;
[[File:UML AddEventLogger.png]]&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
====New Views====&lt;br /&gt;
&lt;br /&gt;
A new view will be added which can be accessed only by the system admins which shows the admins the list of logs. A log entry will have a user id with whom the event is associated to, an event type, a description of the event and a timestamp. We will give the admin the option to filter the logs based on each of the mentioned values. Options to add multiple search criteria will also be provided.&lt;br /&gt;
&lt;br /&gt;
[[File:LogToGUI.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108546</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108546"/>
		<updated>2017-04-13T03:42:03Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: UML added&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
The Logger class in Rails has the following severity levels:&lt;br /&gt;
&lt;br /&gt;
* UNKNOWN - An unknown message that should always be logged.&lt;br /&gt;
* FATAL - A un-handleable error that results in a program crash.&lt;br /&gt;
* ERROR - A handleable error condition.&lt;br /&gt;
* WARN - A warning.&lt;br /&gt;
* INFO - Generic (useful) information about system operation.&lt;br /&gt;
* DEBUG - Low-level information for developers.&lt;br /&gt;
&lt;br /&gt;
Usually, in a production system Logger is set to INFO or WARN. For our project, we plan to use DEBUG level severity. For this, we first need to change the Formatter class to include DEBUG level severity to the log file. &lt;br /&gt;
&lt;br /&gt;
We plan to implement a new helper file which deals logging the events which we want. We plan on doing it this way to separate out the logging code from the controller code.&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We nee to read the log data and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, event type, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
* Event Type:  {Drop Down box}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
====Changes to the database ====&lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for logging. A new migration needs to be created to add the new table to the database.&lt;br /&gt;
====New model====&lt;br /&gt;
&lt;br /&gt;
A new model will be created to add each log to the record. The model will contain fields pertaining to a model such as a user id, type of event, event description, timestamp etc.&lt;br /&gt;
&lt;br /&gt;
'''Table: Event logs'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| user_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| start_date&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| event_type&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| event_description&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| user_role&lt;br /&gt;
| Integer&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====New helpers====&lt;br /&gt;
&lt;br /&gt;
A new helper file will be created which will take care of what events to log. &lt;br /&gt;
[[File:UML AddEventLogger.png]]&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
====New Views====&lt;br /&gt;
&lt;br /&gt;
A new view will be added which can be accessed only by the system admins which shows the admins the list of logs. A log entry will have a user id with whom the event is associated to, an event type, a description of the event and a timestamp. We will give the admin the option to filter the logs based on each of the mentioned values. Options to add multiple search criteria will also be provided.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:UML_AddEventLogger.png&amp;diff=108540</id>
		<title>File:UML AddEventLogger.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:UML_AddEventLogger.png&amp;diff=108540"/>
		<updated>2017-04-13T03:40:08Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108515</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108515"/>
		<updated>2017-04-13T02:46:15Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Changes to the database */&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
The Logger class in Rails has the following severity levels:&lt;br /&gt;
&lt;br /&gt;
* UNKNOWN - An unknown message that should always be logged.&lt;br /&gt;
* FATAL - A un-handleable error that results in a program crash.&lt;br /&gt;
* ERROR - A handleable error condition.&lt;br /&gt;
* WARN - A warning.&lt;br /&gt;
* INFO - Generic (useful) information about system operation.&lt;br /&gt;
* DEBUG - Low-level information for developers.&lt;br /&gt;
&lt;br /&gt;
Usually, in a production system Logger is set to INFO or WARN. For our project, we plan to use DEBUG level severity. For this, we first need to change the Formatter class to include DEBUG level severity to the log file. &lt;br /&gt;
&lt;br /&gt;
We plan to implement a new helper file which deals logging the events which we want. We plan on doing it this way to separate out the logging code from the controller code.&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We nee to read the log data and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, event type, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
* Event Type:  {Drop Down box}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
====Changes to the database ====&lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for logging. A new migration needs to be created to add the new table to the database.&lt;br /&gt;
====New model====&lt;br /&gt;
&lt;br /&gt;
A new model will be created to add each log to the record. The model will contain fields pertaining to a model such as a user id, type of event, event description, timestamp etc.&lt;br /&gt;
&lt;br /&gt;
'''Table: Event logs'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| user_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| start_date&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| event_type&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| event_description&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| user_role&lt;br /&gt;
| Integer&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====New helpers====&lt;br /&gt;
&lt;br /&gt;
A new helper file will be created which will take care of what events to log. &lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
====New Views====&lt;br /&gt;
&lt;br /&gt;
A new view will be added which can be accessed only by the system admins which shows the admins the list of logs. A log entry will have a user id with whom the event is associated to, an event type, a description of the event and a timestamp. We will give the admin the option to filter the logs based on each of the mentioned values. Options to add multiple search criteria will also be provided.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108513</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108513"/>
		<updated>2017-04-13T02:45:53Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* New models */&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
The Logger class in Rails has the following severity levels:&lt;br /&gt;
&lt;br /&gt;
* UNKNOWN - An unknown message that should always be logged.&lt;br /&gt;
* FATAL - A un-handleable error that results in a program crash.&lt;br /&gt;
* ERROR - A handleable error condition.&lt;br /&gt;
* WARN - A warning.&lt;br /&gt;
* INFO - Generic (useful) information about system operation.&lt;br /&gt;
* DEBUG - Low-level information for developers.&lt;br /&gt;
&lt;br /&gt;
Usually, in a production system Logger is set to INFO or WARN. For our project, we plan to use DEBUG level severity. For this, we first need to change the Formatter class to include DEBUG level severity to the log file. &lt;br /&gt;
&lt;br /&gt;
We plan to implement a new helper file which deals logging the events which we want. We plan on doing it this way to separate out the logging code from the controller code.&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We nee to read the log data and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, event type, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
* Event Type:  {Drop Down box}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
====Changes to the database ====&lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for logging. A new migration needs to be created to add the new table to the database.&lt;br /&gt;
&lt;br /&gt;
'''Table: Event logs'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| user_id&lt;br /&gt;
| Integer&lt;br /&gt;
|-&lt;br /&gt;
| start_date&lt;br /&gt;
| Datetime&lt;br /&gt;
|-&lt;br /&gt;
| event_type&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| event_description&lt;br /&gt;
| String&lt;br /&gt;
|-&lt;br /&gt;
| user_role&lt;br /&gt;
| Integer&lt;br /&gt;
|}&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
====New helpers====&lt;br /&gt;
&lt;br /&gt;
A new helper file will be created which will take care of what events to log. &lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
====New Views====&lt;br /&gt;
&lt;br /&gt;
A new view will be added which can be accessed only by the system admins which shows the admins the list of logs. A log entry will have a user id with whom the event is associated to, an event type, a description of the event and a timestamp. We will give the admin the option to filter the logs based on each of the mentioned values. Options to add multiple search criteria will also be provided.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108249</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108249"/>
		<updated>2017-04-08T03:53:21Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Testing */&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
The Logger class in Rails has the following severity levels:&lt;br /&gt;
&lt;br /&gt;
* UNKNOWN - An unknown message that should always be logged.&lt;br /&gt;
* FATAL - A un-handleable error that results in a program crash.&lt;br /&gt;
* ERROR - A handleable error condition.&lt;br /&gt;
* WARN - A warning.&lt;br /&gt;
* INFO - Generic (useful) information about system operation.&lt;br /&gt;
* DEBUG - Low-level information for developers.&lt;br /&gt;
&lt;br /&gt;
Usually, in a production system Logger is set to INFO or WARN. For our project, we plan to use DEBUG level severity. For this, we first need to change the Formatter class to include DEBUG level severity to the log file. &lt;br /&gt;
&lt;br /&gt;
We plan to implement a new helper file which deals logging the events which we want. We plan on doing it this way to separate out the logging code from the controller code.&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We nee to read the log data and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, event type, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
* Event Type:  {Drop Down box}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for logging. A new migration needs to be created to add the new table to the database. &lt;br /&gt;
&lt;br /&gt;
A new helper file will be created which will take care of what events to log. &lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
A new view will be added which can be accessed only by the system admins which shows the admins the list of logs with options to filter the logs based on the admin's needs.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108248</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108248"/>
		<updated>2017-04-08T03:52:51Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: Testing part added&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
The Logger class in Rails has the following severity levels:&lt;br /&gt;
&lt;br /&gt;
* UNKNOWN - An unknown message that should always be logged.&lt;br /&gt;
* FATAL - A un-handleable error that results in a program crash.&lt;br /&gt;
* ERROR - A handleable error condition.&lt;br /&gt;
* WARN - A warning.&lt;br /&gt;
* INFO - Generic (useful) information about system operation.&lt;br /&gt;
* DEBUG - Low-level information for developers.&lt;br /&gt;
&lt;br /&gt;
Usually, in a production system Logger is set to INFO or WARN. For our project, we plan to use DEBUG level severity. For this, we first need to change the Formatter class to include DEBUG level severity to the log file. &lt;br /&gt;
&lt;br /&gt;
We plan to implement a new helper file which deals logging the events which we want. We plan on doing it this way to separate out the logging code from the controller code.&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We nee to read the log data and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, event type, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
* Event Type:  {Drop Down box}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
We plan to create a new table in the database for logging. A new migration needs to be created to add the new table to the database. &lt;br /&gt;
&lt;br /&gt;
A new helper file will be created which will take care of what events to log. &lt;br /&gt;
&lt;br /&gt;
== Implementation of Task 2: UI ==&lt;br /&gt;
&lt;br /&gt;
A new view will be added which can be accessed only by the system admins which shows the admins the list of logs with options to filter the logs based on the admin's needs.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
Scenarios Designed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Model Testing''': Since we are adding a new database table, we need to test Rails model with Rspec that checks if the validations are working fine such as it &amp;quot;is valid with valid attributes&amp;quot;, it &amp;quot;is not valid without a user&amp;quot;, it &amp;quot;is not valid without an event&amp;quot;, it &amp;quot;is not valid without a timestamp&amp;quot;&lt;br /&gt;
* '''Controller Testing''': Design includes the addition of a controller that takes care of storing the logs and then loading them up to fill the views if queried which requires a lot of testing. The tests include&lt;br /&gt;
** For each event, check if the respective method in the respective controller is called&lt;br /&gt;
** For each event, an entry is being correctly stored in the database&lt;br /&gt;
** A feature test that checks the UI part of the flow that includes Capybara mocking the admin fills the query page and the testing whether the results are viewed correctly&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108235</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108235"/>
		<updated>2017-04-08T03:32:25Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Design of Task 2: UI Part */&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design of Task 1: Logging == &lt;br /&gt;
&lt;br /&gt;
The Logger class in Rails has the following severity levels:&lt;br /&gt;
&lt;br /&gt;
* UNKNOWN - An unknown message that should always be logged.&lt;br /&gt;
* FATAL - A un-handleable error that results in a program crash.&lt;br /&gt;
* ERROR - A handleable error condition.&lt;br /&gt;
* WARN - A warning.&lt;br /&gt;
* INFO - Generic (useful) information about system operation.&lt;br /&gt;
* DEBUG - Low-level information for developers.&lt;br /&gt;
&lt;br /&gt;
Usually, in a production system Logger is set to INFO or WARN. For our project, we plan to use DEBUG level severity. For this, we first need to change the Formatter class to include DEBUG level severity to the log file. &lt;br /&gt;
&lt;br /&gt;
We plan to implement a new helper file which deals logging the events which we want. We plan on doing it this way to separate out the logging code from the controller code.&lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We nee to read the log data and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, event type, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :   {Textbox}&lt;br /&gt;
* Date From:  {Date Filler}&lt;br /&gt;
* Date to:   {Date Filler}&lt;br /&gt;
* Event Type:  {Drop Down box}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108230</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108230"/>
		<updated>2017-04-08T03:28:11Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: Design of part 2 added&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;br /&gt;
&lt;br /&gt;
== What we plan to implement ==&lt;br /&gt;
&lt;br /&gt;
The project mainly consists of two parts:&lt;br /&gt;
&lt;br /&gt;
1. Logging the various students and instructors logs and process them accordingly.&lt;br /&gt;
&lt;br /&gt;
2. Extend the existing UI or create one separately if needed along with the required fields as described in the project description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same has been mentioned in terms of a flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:flow.jpg]]&lt;br /&gt;
&lt;br /&gt;
The Logger class in Rails has the following severity levels:&lt;br /&gt;
&lt;br /&gt;
* UNKNOWN - An unknown message that should always be logged.&lt;br /&gt;
* FATAL - A un-handleable error that results in a program crash.&lt;br /&gt;
* ERROR - A handleable error condition.&lt;br /&gt;
* WARN - A warning.&lt;br /&gt;
* INFO - Generic (useful) information about system operation.&lt;br /&gt;
* DEBUG - Low-level information for developers.&lt;br /&gt;
&lt;br /&gt;
Usually, in a production system Logger is set to INFO or WARN. For our project, we plan to use DEBUG level severity. For this, we first need to change the Formatter class to include DEBUG level severity to the log file. &lt;br /&gt;
&lt;br /&gt;
== Design of Task 2: UI Part ==&lt;br /&gt;
We nee to read the log data and put onto the user interface to make anyone view based on the filter they provide. Filters include user name, event type, from time and to time. &lt;br /&gt;
The look of the UI part would be a simple view that contains&lt;br /&gt;
* User :       [____]      {Textbox}&lt;br /&gt;
* Date From:   [____]      {Date Filler}&lt;br /&gt;
* Date to:     [____]      {Date Filler}&lt;br /&gt;
* Event Type:  [____]      {Drop Down box}&lt;br /&gt;
&lt;br /&gt;
The results after the querying would be populated in grid that makes it easy to observe&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html Severity level in Logger]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108163</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108163"/>
		<updated>2017-04-08T01:29:56Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* What to Log */&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&lt;br /&gt;
For Students &amp;lt;br&amp;gt;&lt;br /&gt;
* Logins, logouts, signups&lt;br /&gt;
* submission of files/links&lt;br /&gt;
* issuing invitations, joining teams, dropping off teams&lt;br /&gt;
* requesting reviews, submitting reviews &lt;br /&gt;
* undoing any of these operations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For Admin/ Instructor/ TA &amp;lt;br&amp;gt;&lt;br /&gt;
* creating/editing courses and assignments&lt;br /&gt;
* giving grades&lt;br /&gt;
* impersonating other users&lt;br /&gt;
* adding TAs, adding participants to courses or assignments&lt;br /&gt;
* assigning reviewers.&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108160</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108160"/>
		<updated>2017-04-08T01:25:54Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: What to log added&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;br /&gt;
&lt;br /&gt;
== What to Log ==&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 metareviews), undoing any of these operations.  Instructor/TA/admin events: creating/editing courses and assignments, giving grades, impersonating other users, adding TAs, adding participants to courses or assignments, assigning reviewers.&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108158</id>
		<title>CSC/ECE 517 Spring 2017/E1732 Additions to logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/E1732_Additions_to_logging&amp;diff=108158"/>
		<updated>2017-04-08T01:23:45Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: Introduction Added&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 there is a need to know when a student logged in, reserved a topic, dropped off a team, reviewed etc. In real time, logs are the first thing to start checking the performance and other metrics. But it is also important to describe which data to log and why. Users activity may not be used for testing or debugging purposes, but can help an evaluator or admin to make sure the authenticity of student submissions and check the timelines. It sure can be used in future to read those logs and report back to users about their action timeline if required.&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107854</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107854"/>
		<updated>2017-04-01T05:03:46Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
* JoinTeamRequest.find(params[:id]. This retrieval is common to five methods which are :show, :edit, :update, :destroy, :decline. Can be put into private before action&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code.&lt;br /&gt;
* POST route added to decline action in the routes file&lt;br /&gt;
* Common statement in show, edit, update, destroy, decline&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt; @join_team_request = JoinTeamRequest.find(params[:id]) &amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
added private method find_request&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def find_request&lt;br /&gt;
          @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
     end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Added before_action to the methods&lt;br /&gt;
&amp;lt;pre&amp;gt;  before_action :find_request, only: [:show, :edit, :update, :destroy, :decline] &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
The below test cases written can be found at spec/features/invitation_check_spec.rb.&lt;br /&gt;
&lt;br /&gt;
A student is initialised and an assignment is assigned to the student. This serves as a base for testing. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    @user1 = User.find_by(name: &amp;quot;student2064&amp;quot;)&lt;br /&gt;
    stub_current_user(@user1, @user1.role.name, @user1.role)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    # Assignment name&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Signup sheet'&lt;br /&gt;
    expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
    # click Signup check button&lt;br /&gt;
    @assignment_id = Assignment.first.id&lt;br /&gt;
    visit &amp;quot;/sign_up_sheet/sign_up?id=#{@assignment_id}&amp;amp;topic_id=1&amp;quot;&lt;br /&gt;
    expect(page).to have_content('Your topic(s): Hello world! ')&lt;br /&gt;
&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Your team'&lt;br /&gt;
    expect(page).to have_content('final2_Team1')&lt;br /&gt;
&lt;br /&gt;
    fill_in 'user_name', with: 'student2065'&lt;br /&gt;
    click_button 'Invite'&lt;br /&gt;
    expect(page).to have_content('Waiting for reply')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test Cases===&lt;br /&gt;
====To invite a student with no topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who signup for a topic should send an invitation to the other student who has no topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is able to accept the invitation and form team' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=0'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is not able to form team on rejecting' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('You no longer have a team!')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To invite a student with a topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who has a topic sends an invitation to other student who also has a topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'Signup sheet'&lt;br /&gt;
      expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
      visit '/sign_up_sheet/sign_up?assignment_id=1&amp;amp;id=2'&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'Student should accept the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=2'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'student should reject the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team2')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To retract an invitation====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student sends an invitation and retracts it' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
    it 'should remove entry from database' do&lt;br /&gt;
      before_count = Invitation.count&lt;br /&gt;
      click_link 'Retract'&lt;br /&gt;
      expect(Invitation.count).to eq(before_count - 1)&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Feature Test Scenarios===&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107837</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107837"/>
		<updated>2017-04-01T04:19:47Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
* JoinTeamRequest.find(params[:id]. This retrieval is common to five methods which are :show, :edit, :update, :destroy, :decline. Can be put into private before action&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code.&lt;br /&gt;
* POST route added to decline action in the routes file&lt;br /&gt;
* Common statement in show, edit, update, destroy, decline&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt; @join_team_request = JoinTeamRequest.find(params[:id]) &amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
added private method find_request&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def find_request&lt;br /&gt;
          @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
     end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Added before_action to the methods&lt;br /&gt;
&amp;lt;pre&amp;gt;  before_action :find_request, only: [:show, :edit, :update, :destroy, :decline] &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
The below test cases written can be found at spec/features/invitation_check_spec.rb. To run: $rspec spec/features/invitation_check_spec.rb&lt;br /&gt;
&lt;br /&gt;
A student is initialised and an assignment is assigned to the student. This serves as a base for testing. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    @user1 = User.find_by(name: &amp;quot;student2064&amp;quot;)&lt;br /&gt;
    stub_current_user(@user1, @user1.role.name, @user1.role)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    # Assignment name&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Signup sheet'&lt;br /&gt;
    expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
    # click Signup check button&lt;br /&gt;
    @assignment_id = Assignment.first.id&lt;br /&gt;
    visit &amp;quot;/sign_up_sheet/sign_up?id=#{@assignment_id}&amp;amp;topic_id=1&amp;quot;&lt;br /&gt;
    expect(page).to have_content('Your topic(s): Hello world! ')&lt;br /&gt;
&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
    expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'final2'&lt;br /&gt;
    expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
    click_link 'Your team'&lt;br /&gt;
    expect(page).to have_content('final2_Team1')&lt;br /&gt;
&lt;br /&gt;
    fill_in 'user_name', with: 'student2065'&lt;br /&gt;
    click_button 'Invite'&lt;br /&gt;
    expect(page).to have_content('Waiting for reply')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test Cases===&lt;br /&gt;
====To invite a student with no topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who signup for a topic should send an invitation to the other student who has no topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is able to accept the invitation and form team' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=0'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'is not able to form team on rejecting' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('You no longer have a team!')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To invite a student with a topic====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student who has a topic sends an invitation to other student who also has a topic' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      user = User.find_by(name: &amp;quot;student2065&amp;quot;)&lt;br /&gt;
      stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      expect(page).to have_content('final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
&lt;br /&gt;
      click_link 'Signup sheet'&lt;br /&gt;
      expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
&lt;br /&gt;
      visit '/sign_up_sheet/sign_up?assignment_id=1&amp;amp;id=2'&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'Student should accept the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=2'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'student should reject the invitation sent by the other student and both have topics' do&lt;br /&gt;
      visit '/invitations/decline?inv_id=1&amp;amp;student_id=1'&lt;br /&gt;
      visit '/student_teams/view?student_id=1'&lt;br /&gt;
      expect(page).to have_content('Team Name: final2_Team2')&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To retract an invitation====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 describe 'one student sends an invitation and retracts it' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      visit '/student_task/list'&lt;br /&gt;
      click_link 'final2'&lt;br /&gt;
      click_link 'Your team'&lt;br /&gt;
    end&lt;br /&gt;
    it 'should remove entry from database' do&lt;br /&gt;
      before_count = Invitation.count&lt;br /&gt;
      click_link 'Retract'&lt;br /&gt;
      expect(Invitation.count).to eq(before_count - 1)&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Feature Test Scenarios===&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107638</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107638"/>
		<updated>2017-03-31T06:40:08Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Join Team Requests Controller */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
* JoinTeamRequest.find(params[:id]. This retrieval is common to five methods which are :show, :edit, :update, :destroy, :decline. Can be put into private before action&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code.&lt;br /&gt;
* POST route added to decline action in the routes file&lt;br /&gt;
* Common statement in show, edit, update, destroy, decline&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt; @join_team_request = JoinTeamRequest.find(params[:id]) &amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
added private method find_request&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     def find_request&lt;br /&gt;
          @join_team_request = JoinTeamRequest.find(params[:id])&lt;br /&gt;
     end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Added before_action to the methods&lt;br /&gt;
&amp;lt;pre&amp;gt;  before_action :find_request, only: [:show, :edit, :update, :destroy, :decline] &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Feature Test Scenarios==&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107637</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107637"/>
		<updated>2017-03-31T06:36:11Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Tasks Identified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
* JoinTeamRequest.find(params[:id]. This retrieval is common to five methods which are :show, :edit, :update, :destroy, :decline. Can be put into private before action&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code.&lt;br /&gt;
* POST route added to decline action in the routes file&lt;br /&gt;
&lt;br /&gt;
==Feature Test Scenarios==&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107636</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107636"/>
		<updated>2017-03-31T06:33:33Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Join Team Requests Controller */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code.&lt;br /&gt;
* POST route added to decline action in the routes file&lt;br /&gt;
&lt;br /&gt;
==Feature Test Scenarios==&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107635</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107635"/>
		<updated>2017-03-31T06:30:42Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Tasks Identified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This project is part of an educational web application called Expertiza. This wiki gives the details on the refactoring tasks undertaken as part of continuous improvement of Expertiza.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
[[Expertiza_documentation|Expertiza]] is an open source project managed by the faculty and students of NCSU. It is a web application which offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
In the existing code the InvitationController and the JoinTeamRequestsController do the expected task but the there is a lot of redundancy and duplicity in the code, and the comments in the code are few and sparse. The aim of our project was to reduce the complexity of the controller by removing redundant code adding comments so that the code is easy to understand and all the variables used in the code are clearly explained.&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. Once a student decides to invite someone into his assignment team the controller performs some checks before sending out the invitations. These checks are performed in the create function. The current implementation has a lot of redundant code and many nested if statements. The ABC size of the method is also very high. The controller also has functions which take care of cases where an invitee accepts/declines an invitation. There is also an option to retract a sent invitation which is handled by the cancel function in the controller.&lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along by removing other nested if's in create and update_join_team_request methods.&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used.&lt;br /&gt;
* Pending invitations needs to be displayed in the same format as other tables.&lt;br /&gt;
* Feature tests need to be written for the controller &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team. Whenever a project team creates an advertisement for others to join their team, students can see a link to the advertisement in the signup sheet. Once the student clicks on the link to the advertisement the student can then request to join the team. The create function in the JoinTeamRequestsController handles the checks before sending out the request. Again, the ABC size for this method is very high as there a lot of nested if conditions. Also, there is duplicate code in some of the functions in this controller which can be moved to a separate function. &lt;br /&gt;
====Tasks Identified====&lt;br /&gt;
* Add comments on why some important variables are used.&lt;br /&gt;
* The ABC size for create method is too high.&lt;br /&gt;
* Nested if's need to be refactored.&lt;br /&gt;
* Duplicate code needs to be removed.&lt;br /&gt;
* Pending join team requests needs to be displayed in the same format as other tables&lt;br /&gt;
* Feature tests need to be written for the controller&lt;br /&gt;
* Decline request is not working: Post route is not defined&lt;br /&gt;
&lt;br /&gt;
==Change Specifics==&lt;br /&gt;
The tasks identified above were implemented and the details are given below.&lt;br /&gt;
===Invitations Controller===&lt;br /&gt;
* A new private function check_users was added which performs some basic checks before the create function is called. In the original implementation, there were a lot of nested if conditions which checked if a user is valid, is a participant in the project, and if the team has slots available. All these checks were the cause of the nested if statements because they needed to be checked before an invitation is sent out to a student. The nested if's were removed by moving all these checks into the private function thereby reducing the ABC size of the create method.&lt;br /&gt;
* Nested if statements in the update_join_team_request were removed by breaking the nested statements into separate conditions and using return when the condition fails. For example, when checking if the user is valid, instead of using a nested condition to check validity, if the user is not valid then we throw an error message and return from the function.&lt;br /&gt;
* Call to the method find_by_user_id_and_assignment_id has been replaced by find_by and passing the user_id and assignment_id as arguments to find_by. The code snippet showing the change made is shown below.&lt;br /&gt;
Before refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by_user_id_and_assignment_id(inviter_user_id, assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;AssignmentParticipant.find_by(user_id: inviter_user_id, parent_id: assignment_id)&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Styling was added to the pending invitations table in accordance with the existing tables so that the view is uniform across the entire page.&lt;br /&gt;
* The name of the controller was changed in accordance with the current naming convention and comments were added explaining why some important variables were used and also giving more clarity to whoever wants to modify the code in the future. There were very few comments earlier and they did not explain much about what was going on in the functions. &lt;br /&gt;
&lt;br /&gt;
===Join Team Requests Controller===&lt;br /&gt;
* A new private function check_team was added which takes most of the initial checks that are performed before a new join team request is successfully created. This significantly reduces the ABC size of the create method as almost all the conditional statements are moved to the private function which is called before the create function is called. The nested conditionals are also removed by making use of return statements just as in the invitations controller methods. &lt;br /&gt;
* The methods index, show and new all have code which is repeated. Another private function respond_after was written which makes the code DRYer.&lt;br /&gt;
* The view here too contained tables which did not follow the styling that is present throughout the other sections of the page. Styling was added to the pending join team requests table to make it same as the other tables.&lt;br /&gt;
* This controller had very comments and most of the variables were not explained, especially the codes used for reply_status which is used when a new request is sent and updated is not explained at all. The status codes 'A' - awaiting a reply etc. are clearly commented. Comments were also added explaining important pieces of code. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Feature Test Scenarios==&lt;br /&gt;
Some of the possible test cases which can be used for the controllers are given below. &lt;br /&gt;
&lt;br /&gt;
* Test for create method in invitations controller: Before sending out an invitation to another student there a lot of checks that need to be performed such as checking if the invitee is a valid user, if the student is a participant in the project etc. All these scenarios are tested and finally, we make sure that a new invitation has been created in the database. The image below gives a visual representation of all the checks performed before sending out an invitation.&lt;br /&gt;
[[File:InvitationCTest2.png | center]]&lt;br /&gt;
&lt;br /&gt;
* Test for create method in join teams request controller: Similar to the create method in the invitations controller we need to do a lot of checks before sending out a new join team request. The below flow chart explains all the checks that need to be asserted before sending out a new request.&lt;br /&gt;
[[File:Test1.png|center]]&lt;br /&gt;
&lt;br /&gt;
* Test for cancel method: The cancel method is called when the student who sends out an invitation wishes to retract the sent invitation. In this scenario the invitation is destroyed from the database and we assert that change by checking the change in the count of the database. The below diagram is attached for further clarity.&lt;br /&gt;
[[File:InvitationsCTest3.png | center ]]&lt;br /&gt;
&lt;br /&gt;
* Test for decline method: In this test, we assert the change of reply_status to 'D' in the database.&lt;br /&gt;
&lt;br /&gt;
Further improvements to this project would be to write feature tests for the scenarios discussed above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running project remotely ==&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;. To log in as a student, you can use 'student5425' with password 'password'&lt;br /&gt;
&lt;br /&gt;
http://152.46.20.227:3000&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/kira0992/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Screen_Shot_2017-03-26_at_12.20.40_AM.png&amp;diff=107477</id>
		<title>File:Screen Shot 2017-03-26 at 12.20.40 AM.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Screen_Shot_2017-03-26_at_12.20.40_AM.png&amp;diff=107477"/>
		<updated>2017-03-26T05:15:04Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: uploaded a new version of &amp;amp;quot;File:Screen Shot 2017-03-26 at 12.20.40 AM.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;create in invitations controller&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107476</id>
		<title>CSC/ECE 517 Spring 2017/oss E1712</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2017/oss_E1712&amp;diff=107476"/>
		<updated>2017-03-26T05:09:15Z</updated>

		<summary type="html">&lt;p&gt;Rmandav: /* Running project remotely */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
This project is part of an educational web application called Expertiza. Expertiza is an open source project managed by the faculty and students of NCSU. &lt;br /&gt;
&lt;br /&gt;
Expertiza offers a platform for assignments and allows learning through peer reviews. &lt;br /&gt;
&lt;br /&gt;
=== Description of project: ===&lt;br /&gt;
The project involves refactoring of  &amp;quot;join_team_requests_controller.rb&amp;quot; and &amp;quot;invitations_controller.rb&amp;quot;. The complexity of the methods is reduced and redundant code is removed. Comments are added to make the controllers easier to understand. &lt;br /&gt;
&lt;br /&gt;
Invitations controller handles the functions required to send invitations out to potential teammates for a project. &lt;br /&gt;
&lt;br /&gt;
JoinTeamRequests controller deals with the actions to be performed after a student comes across an advertisement to join a project team.&lt;br /&gt;
&lt;br /&gt;
=== Tasks Identified ===&lt;br /&gt;
InvitationController&lt;br /&gt;
* Rename to invitations_controller.rb, in accordance with current naming convention.&lt;br /&gt;
* The ABC size for create method is too high and needs to be refactored along with removal of other nested if's in some methods&lt;br /&gt;
* Use find_by instead of find_by_name and find_by_user_id_and_assignment_id.&lt;br /&gt;
* Add comments explaining what each method does, and comments on how important variables are used&lt;br /&gt;
JoinTeamRequestsController&lt;br /&gt;
* Add comments on why some important variables are used. &lt;br /&gt;
* The ABC size for create method is too high and other 'nested-if's are refactored.  &lt;br /&gt;
* Duplicacy in code is to be removed.&lt;br /&gt;
&lt;br /&gt;
* Fix UI to maintain consistency in displaying information about team members. &lt;br /&gt;
Feature tests for theses controllers have to be updated. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Running project remotely ===&lt;br /&gt;
VCL is used to host the project remotely. The login credentials as an instructor are &amp;quot;instructor6&amp;quot; with password &amp;quot;password&amp;quot;.&lt;br /&gt;
[152.46.20.227:3000]&lt;/div&gt;</summary>
		<author><name>Rmandav</name></author>
	</entry>
</feed>