<?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=Arattili</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=Arattili"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Arattili"/>
	<updated>2026-09-30T08:47:54Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105963</id>
		<title>CSC/ECE 517 Fall 2016 E1708: Improvements to staggered-deadline assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105963"/>
		<updated>2016-11-16T01:43:05Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Expertiza is a web based application which can be used by instructors to assign tasks to students. Expertiza also allows students to form teams among each other, perform peer reviews on assignments and projects. It gives flexibility to instructor to allow students to see other student's work with intended limitations and impose required restrictions on student access. Expertiza has been developed as an Open Source Software (OSS) on Ruby on Rails framework.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
Expertiza open source development program has fetched many contributions from faculties and students of different universities and thus, it incorporates a wide variety of Ruby coding styles, and this has been a reason why Expertiza project is kept as CSC/ECE 517 final project. The students have been given guidelines on Ruby coding styles and many problem statement includes tasks like refactoring and writing tests which can improve uniformity in coding style. The opportunity to work on an open source project like Expertiza is also expected to provide student an introductory experience of understanding larger programs and making required contributions to them. The writing assignment along with programming assignment is expected to provide project documentation experience to students.&lt;br /&gt;
&lt;br /&gt;
== Description of Project ==&lt;br /&gt;
The project numbered E1708 and titled ‘Improvements to staggered-deadline assignments’ is intended to make contributors or students understand the implementation of assignments and due dates models and tables, so that they can improve on the methodology which is used to assign the due dates to assignments and topics. A staggered-deadline assignment is an assignment in which different topics have different deadlines. It can be pretty useful if different topics within an assignment can have different deadlines for submission as well as reviews. The project has been divided into three problem statements and each of them is addressing an individual functional requirement related to the staggered deadline. The statements and the proposed approaches to meet the requirements are explained below as implementation.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The following issues can arise with a staggered-deadline assignment.&lt;br /&gt;
&lt;br /&gt;
''Problem 1: Staggered-deadline topic available for selection past its deadline''&lt;br /&gt;
&lt;br /&gt;
For a topic with multiple slots that is posted, if it is not selected in the first round, it is still available for selection in a later round. The team that selects the topic then is unable to submit their work as it is past deadline. A solution to this is to prohibit anyone from signing up for a topic whose submission deadline has passed.&lt;br /&gt;
&lt;br /&gt;
''Problem 2: Manual submission and review deadline entry required for all topics''&lt;br /&gt;
&lt;br /&gt;
Currently system requires instructor to enter submission and review deadlines for all topics. A probable solution to this is to allow the instructor to apply one deadline entry to a set of topics and also let the system calculate subsequent dates for subsequent project phases like review and resubmission, based on an initial deadline entry.&lt;br /&gt;
&lt;br /&gt;
''Problem 3: New submissions not identifiable among pool of already graded entries''&lt;br /&gt;
&lt;br /&gt;
Currently there is not way to identify new submissions among list of entries for which grading has already been done. There should some marker or way to distinguish new entries.&lt;br /&gt;
&lt;br /&gt;
==Analysis and Implementation==&lt;br /&gt;
'''For Problem 1''', the solution that we have chosen to implement is fix 1. We will prevent anyone from signing up for a topic whose submission deadline has passed. In order to do this we will have to modify the ‘list’ method in the sign_up_sheet_controller.rb class. In this method, currently we get the list of topics for a particular assignment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@sign_up_topics = SignUpTopic.where(assignment_id: @assignment_id, private_to: mil)&lt;br /&gt;
@num_of_topics = @sign_up_topics.size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then if the assignment is not a staggered deadline assignment and if its submission deadline has passed, then we prevent students from signing up for the assignment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unless assignment.due_dates.find_by_deadline_type_id(1).nil?&lt;br /&gt;
   if !assignment.staggered_deadline? and assignment.due_dates.find_by_deadline_type_id(1).due_at &amp;lt; Time.now&lt;br /&gt;
   @show_actions = false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will have to replicate a similar logic for staggered deadline assignments. The problem here is that for staggered deadline assignments, different topics might have different deadlines. In that case we will have to check if the deadline has passed for each individual topic. Deadlines for individual topics are stored in a table called due_dates with the parent_id as the identifier of the particular topic in place of the assignment identifier. A logic for getting the due dates of topics for staggered deadline assignments is found in the method check_topic_due_date_value in class SignUpSheetHelper.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
topic_due_date = TopicDueDate.where(parent_id: topic_id, deadline_type_id: deadline_type_id, round:review_round).first rescue nil&lt;br /&gt;
if !topic_due_date.nil?&lt;br /&gt;
   due_date = topic_due_date.due_at&lt;br /&gt;
else&lt;br /&gt;
   due_date = assignment_due_dates[review_round - 1].due_at.to_s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First we check if the topic has a specific different deadline and if not then its deadline will be the same as the deadline for the assignment. We will use a similar logic.&lt;br /&gt;
This way, we will filter out topics whose submission due dates have passed and for each of them, we will set the field @show_actions to false so then the user will not be able to sign up for these topics. &lt;br /&gt;
Possible Issues: We will have to confirm that the ‘list’ method is only method which is used for listing available topics to the user. If there is any other method being used, that will also have to be modified.&lt;br /&gt;
&lt;br /&gt;
[[File:ncsu_csc517_2016_e1708_decidingADeadline.png]]&lt;br /&gt;
&lt;br /&gt;
'''In Problem 2''', the current implementation of the system requires the instructor to manually enter deadlines for the three submission review rounds which can be a painstaking task. Our requirement is to provide the instructor with the option to select a relative date for the submission review deadlines based on the Round1 submission deadline. The instructor would however like the ability to manually enter a custom date according to his needs.&lt;br /&gt;
&lt;br /&gt;
One way of dealing with the above problem would be to provide an option for the other date fields for a given assignment to chose a relative date based on the initial submission date in addition to the ability to override and manually enter a custom date. Example: 3 days after Submission deadline, 6 days after re-submission deadline. This approach of implementation will only require changes to the _due_dates.html.erb view for the assignments controller.&lt;br /&gt;
&lt;br /&gt;
Changes will have to be made to the due_dates_table in the _due_dates.html.erb file. Changes have to be made to the datetime_picker_roundtype_roundnumber id. We could provide the user with a drop down menu listing a possible set of relative dates to chose from, in addition to the ability to manually enter a custom date. This could be done on the view side by modifying the date fields and adding the necessary JavaScript so that appropriate date responses are filled into the corresponding date fields when an option is chose from the dropdown menu.&lt;br /&gt;
&lt;br /&gt;
[[File:ncsu_csc517_2016_e1708_decidingADeadline2.png]]&lt;br /&gt;
&lt;br /&gt;
'''For Problem 3''', , the grader needs to know about the new reviews done by the author since the last time grading was done. Grades for reviews are stored in the grade_for_reviewer column in the participant table. Reviews done by a Reviewer for a particular reviewee are mapped in the response_maps table and the actual data regarding the reviews (round no, comments, date, etc.) are stored in the responses table with the map_id as the foreign key. In order to implement our solution, we will add a new date_last_graded column to the participant table to store when the grading was last done. If the grader changes the grade, then the date_last_graded will change to reflect the latest date. &lt;br /&gt;
&lt;br /&gt;
Now, when the grader views the review_report for a particular participant,&lt;br /&gt;
&lt;br /&gt;
# The code gets the date_last_graded for this participant&lt;br /&gt;
# Then it checks the responses table for all the reviews that this participant has done for that assignment and compares the updated_at date for those          reviews with the date_last_graded.&lt;br /&gt;
# If the updated_at date for any of those reviews is greater than the date_graded, we can change the colour of the link which is displayed for that reviewee to some different color to indicate that our author has entered a new review for that particular reviewee, and that it has not yet been graded.&lt;br /&gt;
&lt;br /&gt;
[[File:ncsu_csc517_2016_e1708_newReviews.png]]&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Use Case===&lt;br /&gt;
====Problem 1====&lt;br /&gt;
''Part1: All submission due dates are in the past, so no topic is available for signup''&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Impersonate student5695 &amp;lt;br&amp;gt;&lt;br /&gt;
# In the Assignments section, go to assignment Chapter 11-12 made up exercises &amp;lt;br&amp;gt;&lt;br /&gt;
# Click on Sign-up sheet &amp;lt;br&amp;gt;&lt;br /&gt;
# No topic should be displayed for signup &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Part2: Change due date to after today for a topic, now it should be available for signup''&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to Manage - -&amp;gt; Courses and select CSC/ECE 506, Spring 2015 &amp;lt;br&amp;gt;&lt;br /&gt;
# Edit the assignment Chapter 11-12 madeup exercises &amp;lt;br&amp;gt;&lt;br /&gt;
# Under the General tab, select Staggered deadline assignment &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to Topics tab and scroll down to the bottom and click on Show start/due date &amp;lt;br&amp;gt;&lt;br /&gt;
# Make the submission deadline for topic 11.2 as any date after today &amp;lt;br&amp;gt;&lt;br /&gt;
# Follow the steps in part 1 &amp;lt;br&amp;gt;&lt;br /&gt;
# Now this topic 11.2 should be available for signup. All others remain unavailable &amp;lt;br&amp;gt;&lt;br /&gt;
====Problem 2====&lt;br /&gt;
''Part1: Instructor wants to assign default deadlines to a staggered assignment''&lt;br /&gt;
&lt;br /&gt;
In this case, the default deadlines for the assignment will be filled automatically based on the submission date for Round 1. In this case no further input from the instructor is required apart from selecting the round 1 submission deadline&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline for round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be autopopulated. &amp;lt;br&amp;gt; &lt;br /&gt;
''Part2: Instructor wants to enter custom deadlines for a staggered assignment''&lt;br /&gt;
&lt;br /&gt;
In this case, the instructor has two options. He can either chose a deadline from a list of other relative deadlines from the dropdown menu for a particular round or all rounds, or he can decide to override the system enter a date manually by selecting the “Custom Date” option.&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline for round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be autopopulated. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change all the deadlines for the other rounds according to your requirements by choosing the &amp;quot;Custom Date&amp;quot; option &amp;lt;br&amp;gt;&lt;br /&gt;
''Part3: Instructor wants to enter a custom deadline only for a particular round''&lt;br /&gt;
&lt;br /&gt;
In this case, the instructor can set the submission deadline for round 1. This would result in all deadlines being populated relatively according to the pre-set values. The instructor can then, if need be, modify the deadline for a particular round by either selecting a different relative date or by entering a custom date manually.&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline for round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be autopopulated. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change all the deadlines for the necessary round by either entering a manual date or by choosing a different relative date from the dropdown.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Problem 3====&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6&lt;br /&gt;
# Go to courses tab&lt;br /&gt;
# For CSC/ECE 506, Spring 2015, go to edit assignments and choose Chapter 11-12 madeup exercises&lt;br /&gt;
# Edit this and make it a staggered deadline assignment. Also change the review due dates for the first round to any date beyond today&lt;br /&gt;
# Now impersonate student5695 (This user had selected one topic to be reviewed, but he never completed the review)&lt;br /&gt;
# Complete this review and submit it.&lt;br /&gt;
# Now revert back to instructor6 and go to view review report for this assignment&lt;br /&gt;
# Find user 5695. We should be able to see one review done by him (4383) and the colour should be blue (colour not yet decided) indicating that this is not yet graded.&lt;br /&gt;
# Now go ahead and grade this review&lt;br /&gt;
# The colour should change to the normal brownish colour.&lt;br /&gt;
# Now again impersonate student5695&lt;br /&gt;
# Go to this assignment and choose another topic for review  (There will be only 1 available)&lt;br /&gt;
# Submit some review for this topic&lt;br /&gt;
# Now revert back to instructor6&lt;br /&gt;
# View review report for this assignment&lt;br /&gt;
# For student5695, we can now see 2 review submissions. One will be brown (4383) indicating that this one has been graded. The new one (5678) will be blue, indicating this one is yet to be graded.&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
Testing for modification of dates in staggered deadlines.&amp;lt;br&amp;gt;&lt;br /&gt;
Case 1: Attempting to enter a date for a round that was before the previous round. The system should reject this deadline since it is not valid. &amp;lt;br&amp;gt;&lt;br /&gt;
Case 2: Attempting to enter a date for round1, round2 or round 3 that is out of invalid (Deadlines being before current date). The system should make sure that all dates being entered are valid and greater than or equal to current date. &amp;lt;br&amp;gt;&lt;br /&gt;
Case 3: Entering an incorrect date when manually entering a deadline for a particular round for a staggered deadline. When the user decides to enter a deadline manually rather than choosing the relative deadlines from the dropdown, care must be taken to ensure that the date is in the correct form. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza home page] &amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/GitHub Github Wikipedia Page]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/Ruby_on_Rails Ruby on Rails Wikipedia Page]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105962</id>
		<title>CSC/ECE 517 Fall 2016 E1708: Improvements to staggered-deadline assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105962"/>
		<updated>2016-11-16T01:42:42Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Expertiza is a web based application which can be used by instructors to assign tasks to students. Expertiza also allows students to form teams among each other, perform peer reviews on assignments and projects. It gives flexibility to instructor to allow students to see other student's work with intended limitations and impose required restrictions on student access. Expertiza has been developed as an Open Source Software (OSS) on Ruby on Rails framework.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
Expertiza open source development program has fetched many contributions from faculties and students of different universities and thus, it incorporates a wide variety of Ruby coding styles, and this has been a reason why Expertiza project is kept as CSC/ECE 517 final project. The students have been given guidelines on Ruby coding styles and many problem statement includes tasks like refactoring and writing tests which can improve uniformity in coding style. The opportunity to work on an open source project like Expertiza is also expected to provide student an introductory experience of understanding larger programs and making required contributions to them. The writing assignment along with programming assignment is expected to provide project documentation experience to students.&lt;br /&gt;
&lt;br /&gt;
== Description of Project ==&lt;br /&gt;
The project numbered E1708 and titled ‘Improvements to staggered-deadline assignments’ is intended to make contributors or students understand the implementation of assignments and due dates models and tables, so that they can improve on the methodology which is used to assign the due dates to assignments and topics. A staggered-deadline assignment is an assignment in which different topics have different deadlines. It can be pretty useful if different topics within an assignment can have different deadlines for submission as well as reviews. The project has been divided into three problem statements and each of them is addressing an individual functional requirement related to the staggered deadline. The statements and the proposed approaches to meet the requirements are explained below as implementation.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The following issues can arise with a staggered-deadline assignment.&lt;br /&gt;
&lt;br /&gt;
''Problem 1: Staggered-deadline topic available for selection past its deadline''&lt;br /&gt;
&lt;br /&gt;
For a topic with multiple slots that is posted, if it is not selected in the first round, it is still available for selection in a later round. The team that selects the topic then is unable to submit their work as it is past deadline. A solution to this is to prohibit anyone from signing up for a topic whose submission deadline has passed.&lt;br /&gt;
&lt;br /&gt;
''Problem 2: Manual submission and review deadline entry required for all topics''&lt;br /&gt;
&lt;br /&gt;
Currently system requires instructor to enter submission and review deadlines for all topics. A probable solution to this is to allow the instructor to apply one deadline entry to a set of topics and also let the system calculate subsequent dates for subsequent project phases like review and resubmission, based on an initial deadline entry.&lt;br /&gt;
&lt;br /&gt;
''Problem 3: New submissions not identifiable among pool of already graded entries''&lt;br /&gt;
&lt;br /&gt;
Currently there is not way to identify new submissions among list of entries for which grading has already been done. There should some marker or way to distinguish new entries.&lt;br /&gt;
&lt;br /&gt;
==Analysis and Implementation==&lt;br /&gt;
'''For Problem 1''', the solution that we have chosen to implement is fix 1. We will prevent anyone from signing up for a topic whose submission deadline has passed. In order to do this we will have to modify the ‘list’ method in the sign_up_sheet_controller.rb class. In this method, currently we get the list of topics for a particular assignment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@sign_up_topics = SignUpTopic.where(assignment_id: @assignment_id, private_to: mil)&lt;br /&gt;
@num_of_topics = @sign_up_topics.size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then if the assignment is not a staggered deadline assignment and if its submission deadline has passed, then we prevent students from signing up for the assignment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unless assignment.due_dates.find_by_deadline_type_id(1).nil?&lt;br /&gt;
   if !assignment.staggered_deadline? and assignment.due_dates.find_by_deadline_type_id(1).due_at &amp;lt; Time.now&lt;br /&gt;
   @show_actions = false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will have to replicate a similar logic for staggered deadline assignments. The problem here is that for staggered deadline assignments, different topics might have different deadlines. In that case we will have to check if the deadline has passed for each individual topic. Deadlines for individual topics are stored in a table called due_dates with the parent_id as the identifier of the particular topic in place of the assignment identifier. A logic for getting the due dates of topics for staggered deadline assignments is found in the method check_topic_due_date_value in class SignUpSheetHelper.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
topic_due_date = TopicDueDate.where(parent_id: topic_id, deadline_type_id: deadline_type_id, round:review_round).first rescue nil&lt;br /&gt;
if !topic_due_date.nil?&lt;br /&gt;
   due_date = topic_due_date.due_at&lt;br /&gt;
else&lt;br /&gt;
   due_date = assignment_due_dates[review_round - 1].due_at.to_s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First we check if the topic has a specific different deadline and if not then its deadline will be the same as the deadline for the assignment. We will use a similar logic.&lt;br /&gt;
This way, we will filter out topics whose submission due dates have passed and for each of them, we will set the field @show_actions to false so then the user will not be able to sign up for these topics. &lt;br /&gt;
Possible Issues: We will have to confirm that the ‘list’ method is only method which is used for listing available topics to the user. If there is any other method being used, that will also have to be modified.&lt;br /&gt;
&lt;br /&gt;
[[File:ncsu_csc517_2016_e1708_decidingADeadline.png]]&lt;br /&gt;
&lt;br /&gt;
'''In Problem 2''', the current implementation of the system requires the instructor to manually enter deadlines for the three submission review rounds which can be a painstaking task. Our requirement is to provide the instructor with the option to select a relative date for the submission review deadlines based on the Round1 submission deadline. The instructor would however like the ability to manually enter a custom date according to his needs.&lt;br /&gt;
&lt;br /&gt;
One way of dealing with the above problem would be to provide an option for the other date fields for a given assignment to chose a relative date based on the initial submission date in addition to the ability to override and manually enter a custom date. Example: 3 days after Submission deadline, 6 days after re-submission deadline. This approach of implementation will only require changes to the _due_dates.html.erb view for the assignments controller.&lt;br /&gt;
&lt;br /&gt;
Changes will have to be made to the due_dates_table in the _due_dates.html.erb file. Changes have to be made to the datetime_picker_roundtype_roundnumber id. We could provide the user with a drop down menu listing a possible set of relative dates to chose from, in addition to the ability to manually enter a custom date. This could be done on the view side by modifying the date fields and adding the necessary JavaScript so that appropriate date responses are filled into the corresponding date fields when an option is chose from the dropdown menu.&lt;br /&gt;
&lt;br /&gt;
[[File:ncsu_csc517_2016_e1708_decidingADeadline2.png]]&lt;br /&gt;
&lt;br /&gt;
'''For Problem 3''', , the grader needs to know about the new reviews done by the author since the last time grading was done. Grades for reviews are stored in the grade_for_reviewer column in the participant table. Reviews done by a Reviewer for a particular reviewee are mapped in the response_maps table and the actual data regarding the reviews (round no, comments, date, etc.) are stored in the responses table with the map_id as the foreign key. In order to implement our solution, we will add a new date_last_graded column to the participant table to store when the grading was last done. If the grader changes the grade, then the date_last_graded will change to reflect the latest date. &lt;br /&gt;
&lt;br /&gt;
Now, when the grader views the review_report for a particular participant,&lt;br /&gt;
&lt;br /&gt;
# The code gets the date_last_graded for this participant&lt;br /&gt;
# Then it checks the responses table for all the reviews that this participant has done for that assignment and compares the updated_at date for those          reviews with the date_last_graded.&lt;br /&gt;
# If the updated_at date for any of those reviews is greater than the date_graded, we can change the colour of the link which is displayed for that reviewee to some different color to indicate that our author has entered a new review for that particular reviewee, and that it has not yet been graded.&lt;br /&gt;
&lt;br /&gt;
[[File:ncsu_csc517_2016_e1708_newReviews.png]]&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Use Case===&lt;br /&gt;
====Problem 1====&lt;br /&gt;
''Part1: All submission due dates are in the past, so no topic is available for signup''&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Impersonate student5695 &amp;lt;br&amp;gt;&lt;br /&gt;
# In the Assignments section, go to assignment Chapter 11-12 made up exercises &amp;lt;br&amp;gt;&lt;br /&gt;
# Click on Sign-up sheet &amp;lt;br&amp;gt;&lt;br /&gt;
# No topic should be displayed for signup &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Part2: Change due date to after today for a topic, now it should be available for signup''&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to Manage - -&amp;gt; Courses and select CSC/ECE 506, Spring 2015 &amp;lt;br&amp;gt;&lt;br /&gt;
# Edit the assignment Chapter 11-12 madeup exercises &amp;lt;br&amp;gt;&lt;br /&gt;
# Under the General tab, select Staggered deadline assignment &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to Topics tab and scroll down to the bottom and click on Show start/due date &amp;lt;br&amp;gt;&lt;br /&gt;
# Make the submission deadline for topic 11.2 as any date after today &amp;lt;br&amp;gt;&lt;br /&gt;
# Follow the steps in part 1 &amp;lt;br&amp;gt;&lt;br /&gt;
# Now this topic 11.2 should be available for signup. All others remain unavailable &amp;lt;br&amp;gt;&lt;br /&gt;
====Problem 2====&lt;br /&gt;
''Part1: Instructor wants to assign default deadlines to a staggered assignment''&lt;br /&gt;
&lt;br /&gt;
In this case, the default deadlines for the assignment will be filled automatically based on the submission date for Round 1. In this case no further input from the instructor is required apart from selecting the round 1 submission deadline&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline for round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be autopopulated. &amp;lt;br&amp;gt; &lt;br /&gt;
''Part2: Instructor wants to enter custom deadlines for a staggered assignment''&lt;br /&gt;
&lt;br /&gt;
In this case, the instructor has two options. He can either chose a deadline from a list of other relative deadlines from the dropdown menu for a particular round or all rounds, or he can decide to override the system enter a date manually by selecting the “Custom Date” option.&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline for round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be autopopulated. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change all the deadlines for the other rounds according to your requirements by choosing the &amp;quot;Custom Date&amp;quot; option &amp;lt;br&amp;gt;&lt;br /&gt;
''Part3: Instructor wants to enter a custom deadline only for a particular round''&lt;br /&gt;
&lt;br /&gt;
In this case, the instructor can set the submission deadline for round 1. This would result in all deadlines being populated relatively according to the pre-set values. The instructor can then, if need be, modify the deadline for a particular round by either selecting a different relative date or by entering a custom date manually.&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline for round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be autopopulated. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change all the deadlines for the necessary round by either entering a manual date or by choosing a different relative date from the dropdown.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Problem 3====&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6&lt;br /&gt;
# Go to courses tab&lt;br /&gt;
# For CSC/ECE 506, Spring 2015, go to edit assignments and choose Chapter 11-12 madeup exercises&lt;br /&gt;
# Edit this and make it a staggered deadline assignment. Also change the review due dates for the first round to any date beyond today&lt;br /&gt;
# Now impersonate student5695 (This user had selected one topic to be reviewed, but he never completed the review)&lt;br /&gt;
# Complete this review and submit it.&lt;br /&gt;
# Now revert back to instructor6 and go to view review report for this assignment&lt;br /&gt;
# Find user 5695. We should be able to see one review done by him (4383) and the colour should be blue (colour not yet decided) indicating that this is not yet graded.&lt;br /&gt;
# Now go ahead and grade this review&lt;br /&gt;
# The colour should change to the normal brownish colour.&lt;br /&gt;
# Now again impersonate student5695&lt;br /&gt;
# Go to this assignment and choose another topic for review  (There will be only 1 available)&lt;br /&gt;
# Submit some review for this topic&lt;br /&gt;
# Now revert back to instructor6&lt;br /&gt;
# View review report for this assignment&lt;br /&gt;
# For student5695, we can now see 2 review submissions. One will be brown (4383) indicating that this one has been graded. The new one (5678) will be blue, indicating this one is yet to be graded.&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
Testing for modification of dates in staggered deadlines.&lt;br /&gt;
Case 1: Attempting to enter a date for a round that was before the previous round. The system should reject this deadline since it is not valid. &amp;lt;br&amp;gt;&lt;br /&gt;
Case 2: Attempting to enter a date for round1, round2 or round 3 that is out of invalid (Deadlines being before current date). The system should make sure that all dates being entered are valid and greater than or equal to current date. &amp;lt;br&amp;gt;&lt;br /&gt;
Case 3: Entering an incorrect date when manually entering a deadline for a particular round for a staggered deadline. When the user decides to enter a deadline manually rather than choosing the relative deadlines from the dropdown, care must be taken to ensure that the date is in the correct form. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza home page] &amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/GitHub Github Wikipedia Page]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/Ruby_on_Rails Ruby on Rails Wikipedia Page]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105961</id>
		<title>CSC/ECE 517 Fall 2016 E1708: Improvements to staggered-deadline assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105961"/>
		<updated>2016-11-16T01:42:07Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Expertiza is a web based application which can be used by instructors to assign tasks to students. Expertiza also allows students to form teams among each other, perform peer reviews on assignments and projects. It gives flexibility to instructor to allow students to see other student's work with intended limitations and impose required restrictions on student access. Expertiza has been developed as an Open Source Software (OSS) on Ruby on Rails framework.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
Expertiza open source development program has fetched many contributions from faculties and students of different universities and thus, it incorporates a wide variety of Ruby coding styles, and this has been a reason why Expertiza project is kept as CSC/ECE 517 final project. The students have been given guidelines on Ruby coding styles and many problem statement includes tasks like refactoring and writing tests which can improve uniformity in coding style. The opportunity to work on an open source project like Expertiza is also expected to provide student an introductory experience of understanding larger programs and making required contributions to them. The writing assignment along with programming assignment is expected to provide project documentation experience to students.&lt;br /&gt;
&lt;br /&gt;
== Description of Project ==&lt;br /&gt;
The project numbered E1708 and titled ‘Improvements to staggered-deadline assignments’ is intended to make contributors or students understand the implementation of assignments and due dates models and tables, so that they can improve on the methodology which is used to assign the due dates to assignments and topics. A staggered-deadline assignment is an assignment in which different topics have different deadlines. It can be pretty useful if different topics within an assignment can have different deadlines for submission as well as reviews. The project has been divided into three problem statements and each of them is addressing an individual functional requirement related to the staggered deadline. The statements and the proposed approaches to meet the requirements are explained below as implementation.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The following issues can arise with a staggered-deadline assignment.&lt;br /&gt;
&lt;br /&gt;
''Problem 1: Staggered-deadline topic available for selection past its deadline''&lt;br /&gt;
&lt;br /&gt;
For a topic with multiple slots that is posted, if it is not selected in the first round, it is still available for selection in a later round. The team that selects the topic then is unable to submit their work as it is past deadline. A solution to this is to prohibit anyone from signing up for a topic whose submission deadline has passed.&lt;br /&gt;
&lt;br /&gt;
''Problem 2: Manual submission and review deadline entry required for all topics''&lt;br /&gt;
&lt;br /&gt;
Currently system requires instructor to enter submission and review deadlines for all topics. A probable solution to this is to allow the instructor to apply one deadline entry to a set of topics and also let the system calculate subsequent dates for subsequent project phases like review and resubmission, based on an initial deadline entry.&lt;br /&gt;
&lt;br /&gt;
''Problem 3: New submissions not identifiable among pool of already graded entries''&lt;br /&gt;
&lt;br /&gt;
Currently there is not way to identify new submissions among list of entries for which grading has already been done. There should some marker or way to distinguish new entries.&lt;br /&gt;
&lt;br /&gt;
==Analysis and Implementation==&lt;br /&gt;
'''For Problem 1''', the solution that we have chosen to implement is fix 1. We will prevent anyone from signing up for a topic whose submission deadline has passed. In order to do this we will have to modify the ‘list’ method in the sign_up_sheet_controller.rb class. In this method, currently we get the list of topics for a particular assignment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@sign_up_topics = SignUpTopic.where(assignment_id: @assignment_id, private_to: mil)&lt;br /&gt;
@num_of_topics = @sign_up_topics.size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then if the assignment is not a staggered deadline assignment and if its submission deadline has passed, then we prevent students from signing up for the assignment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unless assignment.due_dates.find_by_deadline_type_id(1).nil?&lt;br /&gt;
   if !assignment.staggered_deadline? and assignment.due_dates.find_by_deadline_type_id(1).due_at &amp;lt; Time.now&lt;br /&gt;
   @show_actions = false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will have to replicate a similar logic for staggered deadline assignments. The problem here is that for staggered deadline assignments, different topics might have different deadlines. In that case we will have to check if the deadline has passed for each individual topic. Deadlines for individual topics are stored in a table called due_dates with the parent_id as the identifier of the particular topic in place of the assignment identifier. A logic for getting the due dates of topics for staggered deadline assignments is found in the method check_topic_due_date_value in class SignUpSheetHelper.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
topic_due_date = TopicDueDate.where(parent_id: topic_id, deadline_type_id: deadline_type_id, round:review_round).first rescue nil&lt;br /&gt;
if !topic_due_date.nil?&lt;br /&gt;
   due_date = topic_due_date.due_at&lt;br /&gt;
else&lt;br /&gt;
   due_date = assignment_due_dates[review_round - 1].due_at.to_s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First we check if the topic has a specific different deadline and if not then its deadline will be the same as the deadline for the assignment. We will use a similar logic.&lt;br /&gt;
This way, we will filter out topics whose submission due dates have passed and for each of them, we will set the field @show_actions to false so then the user will not be able to sign up for these topics. &lt;br /&gt;
Possible Issues: We will have to confirm that the ‘list’ method is only method which is used for listing available topics to the user. If there is any other method being used, that will also have to be modified.&lt;br /&gt;
&lt;br /&gt;
[[File:ncsu_csc517_2016_e1708_decidingADeadline.png]]&lt;br /&gt;
&lt;br /&gt;
'''In Problem 2''', the current implementation of the system requires the instructor to manually enter deadlines for the three submission review rounds which can be a painstaking task. Our requirement is to provide the instructor with the option to select a relative date for the submission review deadlines based on the Round1 submission deadline. The instructor would however like the ability to manually enter a custom date according to his needs.&lt;br /&gt;
&lt;br /&gt;
One way of dealing with the above problem would be to provide an option for the other date fields for a given assignment to chose a relative date based on the initial submission date in addition to the ability to override and manually enter a custom date. Example: 3 days after Submission deadline, 6 days after re-submission deadline. This approach of implementation will only require changes to the _due_dates.html.erb view for the assignments controller.&lt;br /&gt;
&lt;br /&gt;
Changes will have to be made to the due_dates_table in the _due_dates.html.erb file. Changes have to be made to the datetime_picker_roundtype_roundnumber id. We could provide the user with a drop down menu listing a possible set of relative dates to chose from, in addition to the ability to manually enter a custom date. This could be done on the view side by modifying the date fields and adding the necessary JavaScript so that appropriate date responses are filled into the corresponding date fields when an option is chose from the dropdown menu.&lt;br /&gt;
&lt;br /&gt;
[[File:ncsu_csc517_2016_e1708_decidingADeadline2.png]]&lt;br /&gt;
&lt;br /&gt;
'''For Problem 3''', , the grader needs to know about the new reviews done by the author since the last time grading was done. Grades for reviews are stored in the grade_for_reviewer column in the participant table. Reviews done by a Reviewer for a particular reviewee are mapped in the response_maps table and the actual data regarding the reviews (round no, comments, date, etc.) are stored in the responses table with the map_id as the foreign key. In order to implement our solution, we will add a new date_last_graded column to the participant table to store when the grading was last done. If the grader changes the grade, then the date_last_graded will change to reflect the latest date. &lt;br /&gt;
&lt;br /&gt;
Now, when the grader views the review_report for a particular participant,&lt;br /&gt;
&lt;br /&gt;
# The code gets the date_last_graded for this participant&lt;br /&gt;
# Then it checks the responses table for all the reviews that this participant has done for that assignment and compares the updated_at date for those          reviews with the date_last_graded.&lt;br /&gt;
# If the updated_at date for any of those reviews is greater than the date_graded, we can change the colour of the link which is displayed for that reviewee to some different color to indicate that our author has entered a new review for that particular reviewee, and that it has not yet been graded.&lt;br /&gt;
&lt;br /&gt;
[[File:ncsu_csc517_2016_e1708_newReviews.png]]&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Use Case===&lt;br /&gt;
====Problem 1====&lt;br /&gt;
''Part1: All submission due dates are in the past, so no topic is available for signup''&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Impersonate student5695 &amp;lt;br&amp;gt;&lt;br /&gt;
# In the Assignments section, go to assignment Chapter 11-12 made up exercises &amp;lt;br&amp;gt;&lt;br /&gt;
# Click on Sign-up sheet &amp;lt;br&amp;gt;&lt;br /&gt;
# No topic should be displayed for signup &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Part2: Change due date to after today for a topic, now it should be available for signup''&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to Manage - -&amp;gt; Courses and select CSC/ECE 506, Spring 2015 &amp;lt;br&amp;gt;&lt;br /&gt;
# Edit the assignment Chapter 11-12 madeup exercises &amp;lt;br&amp;gt;&lt;br /&gt;
# Under the General tab, select Staggered deadline assignment &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to Topics tab and scroll down to the bottom and click on Show start/due date &amp;lt;br&amp;gt;&lt;br /&gt;
# Make the submission deadline for topic 11.2 as any date after today &amp;lt;br&amp;gt;&lt;br /&gt;
# Follow the steps in part 1 &amp;lt;br&amp;gt;&lt;br /&gt;
# Now this topic 11.2 should be available for signup. All others remain unavailable &amp;lt;br&amp;gt;&lt;br /&gt;
====Problem 2====&lt;br /&gt;
''Part1: Instructor wants to assign default deadlines to a staggered assignment''&lt;br /&gt;
&lt;br /&gt;
In this case, the default deadlines for the assignment will be filled automatically based on the submission date for Round 1. In this case no further input from the instructor is required apart from selecting the round 1 submission deadline&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline for round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be autopopulated. &amp;lt;br&amp;gt; &lt;br /&gt;
''Part2: Instructor wants to enter custom deadlines for a staggered assignment''&lt;br /&gt;
&lt;br /&gt;
In this case, the instructor has two options. He can either chose a deadline from a list of other relative deadlines from the dropdown menu for a particular round or all rounds, or he can decide to override the system enter a date manually by selecting the “Custom Date” option.&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline for round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be autopopulated. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change all the deadlines for the other rounds according to your requirements by choosing the &amp;quot;Custom Date&amp;quot; option &amp;lt;br&amp;gt;&lt;br /&gt;
''Part3: Instructor wants to enter a custom deadline only for a particular round''&lt;br /&gt;
&lt;br /&gt;
In this case, the instructor can set the submission deadline for round 1. This would result in all deadlines being populated relatively according to the pre-set values. The instructor can then, if need be, modify the deadline for a particular round by either selecting a different relative date or by entering a custom date manually.&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline for round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be autopopulated. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change all the deadlines for the necessary round by either entering a manual date or by choosing a different relative date from the dropdown.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Problem 3====&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6&lt;br /&gt;
# Go to courses tab&lt;br /&gt;
# For CSC/ECE 506, Spring 2015, go to edit assignments and choose Chapter 11-12 madeup exercises&lt;br /&gt;
# Edit this and make it a staggered deadline assignment. Also change the review due dates for the first round to any date beyond today&lt;br /&gt;
# Now impersonate student5695 (This user had selected one topic to be reviewed, but he never completed the review)&lt;br /&gt;
# Complete this review and submit it.&lt;br /&gt;
# Now revert back to instructor6 and go to view review report for this assignment&lt;br /&gt;
# Find user 5695. We should be able to see one review done by him (4383) and the colour should be blue (colour not yet decided) indicating that this is not yet graded.&lt;br /&gt;
# Now go ahead and grade this review&lt;br /&gt;
# The colour should change to the normal brownish colour.&lt;br /&gt;
# Now again impersonate student5695&lt;br /&gt;
# Go to this assignment and choose another topic for review  (There will be only 1 available)&lt;br /&gt;
# Submit some review for this topic&lt;br /&gt;
# Now revert back to instructor6&lt;br /&gt;
# View review report for this assignment&lt;br /&gt;
# For student5695, we can now see 2 review submissions. One will be brown (4383) indicating that this one has been graded. The new one (5678) will be blue, indicating this one is yet to be graded.&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
Testing for modification of dates in staggered deadlines.&lt;br /&gt;
Case 1: Attempting to enter a date for a round that was before the previous round. The system should reject this deadline since it is not valid.&lt;br /&gt;
Case 2: Attempting to enter a date for round1, round2 or round 3 that is out of invalid (Deadlines being before current date). The system should make sure that all dates being entered are valid and greater than or equal to current date.&lt;br /&gt;
Case 3: Entering an incorrect date when manually entering a deadline for a particular round for a staggered deadline. When the user decides to enter a deadline manually rather than choosing the relative deadlines from the dropdown, care must be taken to ensure that the date is in the correct form.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza home page] &amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/GitHub Github Wikipedia Page]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/Ruby_on_Rails Ruby on Rails Wikipedia Page]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105774</id>
		<title>CSC/ECE 517 Fall 2016 E1708: Improvements to staggered-deadline assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105774"/>
		<updated>2016-11-15T01:07:26Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Expertiza is a web based application which can be used by instructors to assign tasks to students. Expertiza also allows students to form teams among each other, perform peer reviews on assignments and projects. It gives flexibility to instructor to allow students to see other student's work with intended limitations and impose required restrictions on student access. Expertiza has been developed as an Open Source Software (OSS) on Ruby on Rails framework.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
Expertiza open source development program has fetched many contributions from faculties and students of different universities and thus, it incorporates a wide variety of Ruby coding styles, and this has been a reason why Expertiza project is kept as CSC/ECE 517 final project. The students have been given guidelines on Ruby coding styles and many problem statement includes tasks like refactoring and writing tests which can improve uniformity in coding style. The opportunity to work on an open source project like Expertiza is also expected to provide student an introductory experience of understanding larger programs and making required contributions to them. The writing assignment along with programming assignment is expected to provide project documentation experience to students.&lt;br /&gt;
&lt;br /&gt;
== Description of Project ==&lt;br /&gt;
The project numbered E1708 and titled ‘Improvements to staggered-deadline assignments’ is intended to make contributors or students understand the implementation of assignments and due dates models and tables, so that they can improve on the methodology which is used to assign the due dates to assignments and topics. A staggered-deadline assignment is an assignment in which different topics have different deadlines. It can be pretty useful if different topics within an assignment can have different deadlines for submission as well as reviews. The project has been divided into three problem statements and each of them is addressing an individual functional requirement related to the staggered deadline. The statements and the proposed approaches to meet the requirements are explained below as implementation.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The following issues can arise with a staggered-deadline assignment.&lt;br /&gt;
&lt;br /&gt;
''Problem 1: Staggered-deadline topic available for selection past its deadline''&lt;br /&gt;
&lt;br /&gt;
For a topic with multiple slots that is posted, if it is not selected in the first round, it is still available for selection in a later round. The team that selects the topic then is unable to submit their work as it is past deadline. A solution to this is to prohibit anyone from signing up for a topic whose submission deadline has passed.&lt;br /&gt;
&lt;br /&gt;
''Problem 2: Manual submission and review deadline entry required for all topics''&lt;br /&gt;
&lt;br /&gt;
Currently system requires instructor to enter submission and review deadlines for all topics. A probable solution to this is to allow the instructor to apply one deadline entry to a set of topics and also let the system calculate subsequent dates for subsequent project phases like review and resubmission, based on an initial deadline entry.&lt;br /&gt;
&lt;br /&gt;
''Problem 3: New submissions not identifiable among pool of already graded entries''&lt;br /&gt;
&lt;br /&gt;
Currently there is not way to identify new submissions among list of entries for which grading has already been done. There should some marker or way to distinguish new entries.&lt;br /&gt;
&lt;br /&gt;
==Analysis and Implementation==&lt;br /&gt;
'''For Problem 1''', the solution that we have chosen to implement is fix 1. We will prevent anyone from signing up for a topic whose submission deadline has passed. In order to do this we will have to modify the ‘list’ method in the sign_up_sheet_controller.rb class. In this method, currently we get the list of topics for a particular assignment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@sign_up_topics = SignUpTopic.where(assignment_id: @assignment_id, private_to: mil)&lt;br /&gt;
@num_of_topics = @sign_up_topics.size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then if the assignment is not a staggered deadline assignment and if its submission deadline has passed, then we prevent students from signing up for the assignment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unless assignment.due_dates.find_by_deadline_type_id(1).nil?&lt;br /&gt;
   if !assignment.staggered_deadline? and assignment.due_dates.find_by_deadline_type_id(1).due_at &amp;lt; Time.now&lt;br /&gt;
   @show_actions = false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will have to replicate a similar logic for staggered deadline assignments. The problem here is that for staggered deadline assignments, different topics might have different deadlines. In that case we will have to check if the deadline has passed for each individual topic. Deadlines for individual topics are stored in a table called due_dates with the parent_id as the identifier of the particular topic in place of the assignment identifier. A logic for getting the due dates of topics for staggered deadline assignments is found in the method check_topic_due_date_value in class SignUpSheetHelper.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
topic_due_date = TopicDueDate.where(parent_id: topic_id, deadline_type_id: deadline_type_id, round:review_round).first rescue nil&lt;br /&gt;
if !topic_due_date.nil?&lt;br /&gt;
   due_date = topic_due_date.due_at&lt;br /&gt;
else&lt;br /&gt;
   due_date = assignment_due_dates[review_round - 1].due_at.to_s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First we check if the topic has a specific different deadline and if not then its deadline will be the same as the deadline for the assignment. We will use a similar logic.&lt;br /&gt;
This way, we will filter out topics whose submission due dates have passed and for each of them, we will set the field @show_actions to false so then the user will not be able to sign up for these topics. &lt;br /&gt;
Possible Issues: We will have to confirm that the ‘list’ method is only method which is used for listing available topics to the user. If there is any other method being used, that will also have to be modified.&lt;br /&gt;
&lt;br /&gt;
'''In Problem 2''', the current implementation of the system requires the instructor to manually enter deadlines for the three submission review rounds which can be a painstaking task. Our requirement is to provide the instructor with the option to select a relative date for the submission review deadlines based on the Round1 submission deadline. The instructor would however like the ability to manually enter a custom date according to his needs.&lt;br /&gt;
&lt;br /&gt;
One way of dealing with the above problem would be to provide an option for the other date fields for a given assignment to chose a relative date based on the initial submission date in addition to the ability to override and manually enter a custom date. Example: 3 days after Submission deadline, 6 days after re-submission deadline. This approach of implementation will only require changes to the _due_dates.html.erb view for the assignments controller.&lt;br /&gt;
&lt;br /&gt;
Changes will have to be made to the due_dates_table in the _due_dates.html.erb file. Changes have to be made to the datetime_picker_roundtype_roundnumber id. We could provide the user with a drop down menu listing a possible set of relative dates to chose from, in addition to the ability to manually enter a custom date. This could be done on the view side by modifying the date fields and adding the necessary JavaScript so that appropriate date responses are filled into the corresponding date fields when an option is chose from the dropdown menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''For Problem 3''', , the grader needs to know about the new reviews done by the author since the last time grading was done. Grades for reviews are stored in the grade_for_reviewer column in the participant table. Reviews done by a Reviewer for a particular reviewee are mapped in the response_maps table and the actual data regarding the reviews (round no, comments, date, etc.) are stored in the responses table with the map_id as the foreign key. In order to implement our solution, we will add a new date_last_graded column to the participant table to store when the grading was last done. If the grader changes the grade, then the date_last_graded will change to reflect the latest date. &lt;br /&gt;
&lt;br /&gt;
Now, when the grader views the review_report for a particular participant,&lt;br /&gt;
&lt;br /&gt;
# The code gets the date_last_graded for this participant&lt;br /&gt;
# Then it checks the responses table for all the reviews that this participant has done for that assignment and compares the updated_at date for those          reviews with the date_last_graded.&lt;br /&gt;
# If the updated_at date for any of those reviews is greater than the date_graded, we can change the colour of the link which is displayed for that reviewee to some different color to indicate that our author has entered a new review for that particular reviewee, and that it has not yet been graded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Use Case===&lt;br /&gt;
====Problem 1====&lt;br /&gt;
''Part1: All submission due dates are in the past, so no topic is available for signup''&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Impersonate student5695 &amp;lt;br&amp;gt;&lt;br /&gt;
# In the Assignments section, go to assignment Chapter 11-12 made up exercises &amp;lt;br&amp;gt;&lt;br /&gt;
# Click on Sign-up sheet &amp;lt;br&amp;gt;&lt;br /&gt;
# No topic should be displayed for signup &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Part2: Change due date to after today for a topic, now it should be available for signup''&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to Manage - -&amp;gt; Courses and select CSC/ECE 506, Spring 2015 &amp;lt;br&amp;gt;&lt;br /&gt;
# Edit the assignment Chapter 11-12 madeup exercises &amp;lt;br&amp;gt;&lt;br /&gt;
# Under the General tab, select Staggered deadline assignment &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to Topics tab and scroll down to the bottom and click on Show start/due date &amp;lt;br&amp;gt;&lt;br /&gt;
# Make the submission deadline for topic 11.2 as any date after today &amp;lt;br&amp;gt;&lt;br /&gt;
# Follow the steps in part 1 &amp;lt;br&amp;gt;&lt;br /&gt;
# Now this topic 11.2 should be available for signup. All others remain unavailable &amp;lt;br&amp;gt;&lt;br /&gt;
====Problem 2====&lt;br /&gt;
''Part1: Instructor wants to assign default deadlines to a staggered assignment''&lt;br /&gt;
&lt;br /&gt;
In this case, the default deadlines for the assignment will be filled automatically based on the submission date for Round 1. In this case no further input from the instructor is required apart from selecting the round 1 submission deadline&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline for round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be autopopulated. &amp;lt;br&amp;gt; &lt;br /&gt;
''Part2: Instructor wants to enter custom deadlines for a staggered assignment''&lt;br /&gt;
&lt;br /&gt;
In this case, the instructor has two options. He can either chose a deadline from a list of other relative deadlines from the dropdown menu for a particular round or all rounds, or he can decide to override the system enter a date manually by selecting the “Custom Date” option.&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline for round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be autopopulated. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change all the deadlines for the other rounds according to your requirements by choosing the &amp;quot;Custom Date&amp;quot; option &amp;lt;br&amp;gt;&lt;br /&gt;
''Part3: Instructor wants to enter a custom deadline only for a particular round''&lt;br /&gt;
&lt;br /&gt;
In this case, the instructor can set the submission deadline for round 1. This would result in all deadlines being populated relatively according to the pre-set values. The instructor can then, if need be, modify the deadline for a particular round by either selecting a different relative date or by entering a custom date manually.&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline for round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be autopopulated. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change all the deadlines for the necessary round by either entering a manual date or by choosing a different relative date from the dropdown.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Problem 3====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6&lt;br /&gt;
# Go to courses tab&lt;br /&gt;
# For CSC/ECE 506, Spring 2015, go to edit assignments and choose Chapter 11-12 madeup exercises&lt;br /&gt;
# Edit this and make it a staggered deadline assignment. Also change the review due dates for the first round to any date beyond today&lt;br /&gt;
# Now impersonate student5695 (This user had selected one topic to be reviewed, but he never completed the review)&lt;br /&gt;
# Complete this review and submit it.&lt;br /&gt;
# Now revert back to instructor6 and go to view review report for this assignment&lt;br /&gt;
# Find user 5695. We should be able to see one review done by him (4383) and the colour should be blue (colour not yet decided) indicating that this is not yet graded.&lt;br /&gt;
# Now go ahead and grade this review&lt;br /&gt;
# The colour should change to the normal brownish colour.&lt;br /&gt;
# Now again impersonate student5695&lt;br /&gt;
# Go to this assignment and choose another topic for review  (There will be only 1 available)&lt;br /&gt;
# Submit some review for this topic&lt;br /&gt;
# Now revert back to instructor6&lt;br /&gt;
# View review report for this assignment&lt;br /&gt;
# For student5695, we can now see 2 review submissions. One will be brown (4383) indicating that this one has been graded. The new one (5678) will be blue, indicating this one is yet to be graded.&lt;br /&gt;
&lt;br /&gt;
===FlowChart===&lt;br /&gt;
====Deciding a deadline for an assignment====&lt;br /&gt;
[[File:ncsu_csc517_2016_e1708_decidingADeadline.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:ncsu_csc517_2016_e1708_decidingADeadline2.png]]&lt;br /&gt;
&lt;br /&gt;
====Highlighting new reviews====&lt;br /&gt;
[[File:ncsu_csc517_2016_e1708_newReviews.png]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza home page] &amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/GitHub Github Wikipedia Page]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/Ruby_on_Rails Ruby on Rails Wikipedia Page]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105734</id>
		<title>CSC/ECE 517 Fall 2016 E1708: Improvements to staggered-deadline assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105734"/>
		<updated>2016-11-14T23:47:35Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Expertiza is a web based application which can be used by instructors to assign tasks to students. Expertiza also allows students to form teams among each other, perform peer reviews on assignments and projects. It gives flexibility to instructor to allow students to see other student's work with intended limitations and impose required restrictions on student access. Expertiza has been developed as an Open Source Software (OSS) on Ruby on Rails framework.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
Expertiza open source development program has fetched many contributions from faculties and students of different universities and thus, it incorporates a wide variety of Ruby coding styles, and this has been a reason why Expertiza project is kept as CSC/ECE 517 final project. The students have been given guidelines on Ruby coding styles and many problem statement includes tasks like refactoring and writing tests which can improve uniformity in coding style. The opportunity to work on an open source project like Expertiza is also expected to provide student an introductory experience of understanding larger programs and making required contributions to them. The writing assignment along with programming assignment is expected to provide project documentation experience to students.&lt;br /&gt;
&lt;br /&gt;
== Description of Project ==&lt;br /&gt;
The project numbered E1708 and titled ‘Improvements to staggered-deadline assignments’ is intended to make contributors or students understand the implementation of assignments and due dates models and tables, so that they can improve on the methodology which is used to assign the due dates to assignments and topics. A staggered-deadline assignment is an assignment in which different topics have different deadlines. It can be pretty useful if different topics within an assignment can have different deadlines for submission as well as reviews. The project has been divided into three problem statements and each of them is addressing an individual functional requirement related to the staggered deadline. The statements and the proposed approaches to meet the requirements are explained below as implementation.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The following issues can arise with a staggered-deadline assignment.&lt;br /&gt;
&lt;br /&gt;
''Problem 1: Staggered-deadline topic available for selection past its deadline''&lt;br /&gt;
&lt;br /&gt;
For a topic with multiple slots that is posted, if it is not selected in the first round, it is still available for selection in a later round. The team that selects the topic then is unable to submit their work as it is past deadline. A solution to this is to prohibit anyone from signing up for a topic whose submission deadline has passed.&lt;br /&gt;
&lt;br /&gt;
''Problem 2: Manual submission and review deadline entry required for all topics''&lt;br /&gt;
&lt;br /&gt;
Currently system requires instructor to enter submission and review deadlines for all topics. A probable solution to this is to allow the instructor to apply one deadline entry to a set of topics and also let the system calculate subsequent dates for subsequent project phases like review and resubmission, based on an initial deadline entry.&lt;br /&gt;
&lt;br /&gt;
''Problem 3: New submissions not identifiable among pool of already graded entries''&lt;br /&gt;
&lt;br /&gt;
Currently there is not way to identify new submissions among list of entries for which grading has already been done. There should some marker or way to distinguish new entries.&lt;br /&gt;
&lt;br /&gt;
==Analysis and Implementation==&lt;br /&gt;
'''For Problem 1''', the solution that we have chosen to implement is fix 1. We will prevent anyone from signing up for a topic whose submission deadline has passed. In order to do this we will have to modify the ‘list’ method in the sign_up_sheet_controller.rb class. In this method, currently we get the list of topics for a particular assignment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@sign_up_topics = SignUpTopic.where(assignment_id: @assignment_id, private_to: mil)&lt;br /&gt;
@num_of_topics = @sign_up_topics.size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then if the assignment is not a staggered deadline assignment and if its submission deadline has passed, then we prevent students from signing up for the assignment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unless assignment.due_dates.find_by_deadline_type_id(1).nil?&lt;br /&gt;
   if !assignment.staggered_deadline? and assignment.due_dates.find_by_deadline_type_id(1).due_at &amp;lt; Time.now&lt;br /&gt;
   @show_actions = false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will have to replicate a similar logic for staggered deadline assignments. The problem here is that for staggered deadline assignments, different topics might have different deadlines. In that case we will have to check if the deadline has passed for each individual topic. Deadlines for individual topics are stored in a table called due_dates with the parent_id as the identifier of the particular topic in place of the assignment identifier. A logic for getting the due dates of topics for staggered deadline assignments is found in the method check_topic_due_date_value in class SignUpSheetHelper.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
topic_due_date = TopicDueDate.where(parent_id: topic_id, deadline_type_id: deadline_type_id, round:review_round).first rescue nil&lt;br /&gt;
if !topic_due_date.nil?&lt;br /&gt;
   due_date = topic_due_date.due_at&lt;br /&gt;
else&lt;br /&gt;
   due_date = assignment_due_dates[review_round - 1].due_at.to_s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First we check if the topic has a specific different deadline and if not then its deadline will be the same as the deadline for the assignment. We will use a similar logic.&lt;br /&gt;
This way, we will filter out topics whose submission due dates have passed and for each of them, we will set the field @show_actions to false so then the user will not be able to sign up for these topics. &lt;br /&gt;
Possible Issues: We will have to confirm that the ‘list’ method is only method which is used for listing available topics to the user. If there is any other method being used, that will also have to be modified.&lt;br /&gt;
&lt;br /&gt;
'''In Problem 2''', the current implementation of the system requires the instructor to manually enter deadlines for the three submission review rounds which can be a painstaking task. Our requirement is to provide the instructor with the option to select a relative date for the submission review deadlines based on the Round1 submission deadline. The instructor would however like the ability to manually enter a custom date according to his needs.&lt;br /&gt;
&lt;br /&gt;
One way of dealing with the above problem would be to provide an option for the other date fields for a given assignment to chose a relative date based on the initial submission date in addition to the ability to override and manually enter a custom date. Example: 3 days after Submission deadline, 6 days after re-submission deadline. This approach of implementation will only require changes to the _due_dates.html.erb view for the assignments controller.&lt;br /&gt;
&lt;br /&gt;
Changes will have to be made to the due_dates_table in the _due_dates.html.erb file. Changes have to be made to the datetime_picker_roundtype_roundnumber id. We could provide the user with a drop down menu listing a possible set of relative dates to chose from, in addition to the ability to manually enter a custom date. This could be done on the view side by modifying the date fields and adding the necessary JavaScript so that appropriate date responses are filled into the corresponding date fields when an option is chose from the dropdown menu.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        html += '&amp;lt;td class=&amp;quot;due_date_name&amp;quot; width=&amp;quot;15%&amp;quot;&amp;gt;';&lt;br /&gt;
        if (round_no != 0) {&lt;br /&gt;
            html += 'Round ' + round_no + ': ' + capitalize(deadline_type);&lt;br /&gt;
        } else {&lt;br /&gt;
            html += capitalize(deadline_type.replace(&amp;quot;_&amp;quot;, &amp;quot; &amp;quot;));&lt;br /&gt;
        }&lt;br /&gt;
        html += '&amp;lt;/td&amp;gt;';&lt;br /&gt;
        var due_at = due_date.due_at;&lt;br /&gt;
        if (due_at == null) {&lt;br /&gt;
            due_at = '';&lt;br /&gt;
        }&lt;br /&gt;
        else{&lt;br /&gt;
            var tzone = due_at.substr(23,6);&lt;br /&gt;
            if(tzone=='Z'){&lt;br /&gt;
                tzone = '+00:00';&lt;br /&gt;
            }&lt;br /&gt;
            var timezone = &amp;quot;(UTC &amp;quot;+tzone.toString()+&amp;quot;)&amp;quot;;&lt;br /&gt;
            due_at = due_at.substr(0,4)+'/'+due_at.substr(5,2)+'/'+due_at.substr(8,2)+' '+due_at.substr(11,2)+':'+due_at.substr(14,2)+' '+timezone;&lt;br /&gt;
        }&lt;br /&gt;
        var due_name = due_date.deadline_name;&lt;br /&gt;
        if (due_name == null){&lt;br /&gt;
            due_name = '';&lt;br /&gt;
        }&lt;br /&gt;
        html += '&amp;lt;td align=&amp;quot;center&amp;quot; class=&amp;quot;due_date_due_at&amp;quot; width=&amp;quot;25%&amp;quot;&amp;gt;' +&lt;br /&gt;
        '&amp;lt;input id=&amp;quot;datetimepicker_' + element_id +&lt;br /&gt;
        '&amp;quot; name=&amp;quot;assignment_form[due_date][][due_at]&amp;quot; style=&amp;quot;width: 200px&amp;quot; type=&amp;quot;text&amp;quot; value=&amp;quot;' +&lt;br /&gt;
        due_at + '&amp;quot;&amp;gt;' + '&amp;lt;/td&amp;gt;';&lt;br /&gt;
        &lt;br /&gt;
        html += '&amp;lt;td align=&amp;quot;center&amp;quot; class=&amp;quot;due_date_due_at&amp;quot; width=&amp;quot;10%&amp;quot;&amp;gt;';&lt;br /&gt;
        // if(deadline_type == 'team_formation'){&lt;br /&gt;
        //     html += '&amp;lt;select id=&amp;quot;due_date_submission_allowed_id&amp;quot; name=&amp;quot;assignment_form[due_date][][submission_allowed_id]&amp;quot; disabled&amp;gt;'&lt;br /&gt;
        // }&lt;br /&gt;
        // else{&lt;br /&gt;
        html += '&amp;lt;select id=&amp;quot;due_date_submission_allowed_id&amp;quot; name=&amp;quot;assignment_form[due_date][][submission_allowed_id]&amp;quot;&amp;gt;'&lt;br /&gt;
        // }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''For Problem 3''', , the grader needs to know about the new reviews done by the author since the last time grading was done. Grades for reviews are stored in the grade_for_reviewer column in the participant table. Reviews done by a Reviewer for a particular reviewee are mapped in the response_maps table and the actual data regarding the reviews (round no, comments, date, etc.) are stored in the responses table with the map_id as the foreign key. In order to implement our solution, we will add a new date_last_graded column to the participant table to store when the grading was last done. If the grader changes the grade, then the date_last_graded will change to reflect the latest date. &lt;br /&gt;
&lt;br /&gt;
Now, when the grader views the review_report for a particular participant,&lt;br /&gt;
&lt;br /&gt;
# The code gets the date_last_graded for this participant&lt;br /&gt;
# Then it checks the responses table for all the reviews that this participant has done for that assignment and compares the updated_at date for those          reviews with the date_last_graded.&lt;br /&gt;
# If the updated_at date for any of those reviews is greater than the date_graded, we can change the colour of the link which is displayed for that reviewee to some different color to indicate that our author has entered a new review for that particular reviewee, and that it has not yet been graded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Use Case===&lt;br /&gt;
====Problem 1====&lt;br /&gt;
''Part1: All submission due dates are in the past, so no topic is available for signup''&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Impersonate student5695 &amp;lt;br&amp;gt;&lt;br /&gt;
# In the Assignments section, go to assignment Chapter 11-12 made up exercises &amp;lt;br&amp;gt;&lt;br /&gt;
# Click on Sign-up sheet &amp;lt;br&amp;gt;&lt;br /&gt;
# No topic should be displayed for signup &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Part2: Change due date to after today for a topic, now it should be available for signup''&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to Manage - -&amp;gt; Courses and select CSC/ECE 506, Spring 2015 &amp;lt;br&amp;gt;&lt;br /&gt;
# Edit the assignment Chapter 11-12 madeup exercises &amp;lt;br&amp;gt;&lt;br /&gt;
# Under the General tab, select Staggered deadline assignment &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to Topics tab and scroll down to the bottom and click on Show start/due date &amp;lt;br&amp;gt;&lt;br /&gt;
# Make the submission deadline for topic 11.2 as any date after today &amp;lt;br&amp;gt;&lt;br /&gt;
# Follow the steps in part 1 &amp;lt;br&amp;gt;&lt;br /&gt;
# Now this topic 11.2 should be available for signup. All others remain unavailable &amp;lt;br&amp;gt;&lt;br /&gt;
====Problem 2====&lt;br /&gt;
''Part1: Instructor wants to assign default deadlines to a staggered assignment''&lt;br /&gt;
&lt;br /&gt;
In this case, the default deadlines for the assignment will be filled automatically based on the submission date for Round 1. In this case no further input from the instructor is required apart from selecting the round 1 submission deadline&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline fr round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be prepopulated. &amp;lt;br&amp;gt; &lt;br /&gt;
''Part2: Instructor wants to enter custom deadlines for a staggered assignment''&lt;br /&gt;
&lt;br /&gt;
In this case, the instructor has two options. He can either chose a deadline from a list of other relative deadlines from the dropdown menu for a particular round or all rounds, or he can decide to override the system enter a date manually by selecting the “Custom Date” option.&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline fr round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be prepopulated. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change all the deadlines for the other rounds according to your requirements by choosing the &amp;quot;Custom Date&amp;quot; option &amp;lt;br&amp;gt;&lt;br /&gt;
''Part3: Instructor wants to enter a custom deadline only for a particular round''&lt;br /&gt;
&lt;br /&gt;
In this case, the instructor can set the submission deadline for round 1. This would result in all deadlines being populated relatively according to the pre-set values. The instructor can then, if need be, modify the deadline for a particular round by either selecting a different relative date or by entering a custom date manually.&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
# Go to assignments and either create a new one or edit a pre-existing one. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change assignment type to staggered. &amp;lt;br&amp;gt;&lt;br /&gt;
# Chose a submission deadline fr round 1. &amp;lt;br&amp;gt;&lt;br /&gt;
# Deadlines for all other rounds will be prepopulated. &amp;lt;br&amp;gt;&lt;br /&gt;
# Change all the deadlines for the necessary round by either entering a manual date or by choosing a different relative date from the dropdown.&amp;lt;br&amp;gt;&lt;br /&gt;
====Problem 3====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Login as instructor6&lt;br /&gt;
# Go to courses tab&lt;br /&gt;
# For CSC/ECE 506, Spring 2015, go to edit assignments and choose Chapter 11-12 madeup exercises&lt;br /&gt;
# Edit this and make it a staggered deadline assignment. Also change the review due dates for the first round to any date beyond today&lt;br /&gt;
# Now impersonate student5695 (This user had selected one topic to be reviewed, but he never completed the review)&lt;br /&gt;
# Complete this review and submit it.&lt;br /&gt;
# Now revert back to instructor6 and go to view review report for this assignment&lt;br /&gt;
# Find user 5695. We should be able to see one review done by him (4383) and the colour should be blue (colour not yet decided) indicating that this is not yet graded.&lt;br /&gt;
# Now go ahead and grade this review&lt;br /&gt;
# The colour should change to the normal brownish colour.&lt;br /&gt;
# Now again impersonate student5695&lt;br /&gt;
# Go to this assignment and choose another topic for review  (There will be only 1 available)&lt;br /&gt;
# Submit some review for this topic&lt;br /&gt;
# Now revert back to instructor6&lt;br /&gt;
# View review report for this assignment&lt;br /&gt;
# For student5695, we can now see 2 review submissions. One will be brown (4383) indicating that this one has been graded. The new one (5678) will be blue, indicating this one is yet to be graded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza home page] &amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/GitHub Github Wikipedia Page]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/Ruby_on_Rails Ruby on Rails Wikipedia Page]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105298</id>
		<title>CSC/ECE 517 Fall 2016 E1708: Improvements to staggered-deadline assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105298"/>
		<updated>2016-11-10T04:14:10Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Expertiza is a web based application which can be used by instructors to assign tasks to students. Expertiza also allows students to form teams among each other, perform peer reviews on assignments and projects. It gives flexibility to instructor to allow students to see other student's work with intended limitations and impose required restrictions on student access. Expertiza has been developed as an Open Source Software (OSS) on Ruby on Rails framework.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
Expertiza open source development program has fetched many contributions from faculties and students of different universities and thus, it incorporates a wide variety of Ruby coding styles, and this has been a reason why Expertiza project is kept as CSC/ECE 517 final project. The students have been given guidelines on Ruby coding styles and many problem statement includes tasks like refactoring and writing tests which can improve uniformity in coding style. The opportunity to work on an open source project like Expertiza is also expected to provide student an introductory experience of understanding larger programs and making required contributions to them. The writing assignment along with programming assignment is expected to provide project documentation experience to students.&lt;br /&gt;
&lt;br /&gt;
== Description of Project ==&lt;br /&gt;
The project numbered E1708 and titled ‘Improvements to staggered-deadline assignments’ is intended to make contributors or students understand the implementation of assignments and due dates models and tables, so that they can improve on the methodology which is used to assign the due dates to assignments and topics. A staggered-deadline assignment is an assignment in which different topics have different deadlines. It can be pretty useful if different topics within an assignment can have different deadlines for submission as well as reviews. The project has been divided into three problem statements and each of them is addressing an individual functional requirement related to the staggered deadline. The statements and the proposed approaches to meet the requirements are explained below as implementation.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The following issues can arise with a staggered-deadline assignment.&lt;br /&gt;
&lt;br /&gt;
===Problem 1: Staggered-deadline topic available for selection past its deadline===&lt;br /&gt;
For a topic with multiple slots that is posted, if it is not selected in the first round, it is still available for selection in a later round. The team that selects the topic then is unable to submit their work as it is past deadline. A solution to this is to prohibit anyone from signing up for a topic whose submission deadline has passed.&lt;br /&gt;
&lt;br /&gt;
===Problem 2: Manual submission and review deadline entry required for all topics===&lt;br /&gt;
Currently system requires instructor to enter submission and review deadlines for all topics. A probable solution to this is to allow the instructor to apply one deadline entry to a set of topics and also let the system calculate subsequent dates for subsequent project phases like review and resubmission, based on an initial deadline entry.&lt;br /&gt;
&lt;br /&gt;
===Problem 3: New submissions not identifiable among pool of already graded entries===&lt;br /&gt;
Currently there is not way to identify new submissions among list of entries for which grading has already been done. There should some marker or way to distinguish new entries.&lt;br /&gt;
&lt;br /&gt;
==Analysis==&lt;br /&gt;
For Problem 1, the solution that we have chosen to implement is fix 1. We will prevent anyone from signing up for a topic whose submission deadline has passed. In order to do this we will have to modify the ‘list’ method in the sign_up_sheet_controller.rb class. In this method, currently we get the list of topics for a particular assignment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@sign_up_topics = SignUpTopic.where(assignment_id: @assignment_id, private_to: mil)&lt;br /&gt;
@num_of_topics = @sign_up_topics.size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then if the assignment is not a staggered deadline assignment and if its submission deadline has passed, then we prevent students from signing up for the assignment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unless assignment.due_dates.find_by_deadline_type_id(1).nil?&lt;br /&gt;
   if !assignment.staggered_deadline? and assignment.due_dates.find_by_deadline_type_id(1).due_at &amp;lt; Time.now&lt;br /&gt;
   @show_actions = false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will have to replicate a similar logic for staggered deadline assignments. The problem here is that for staggered deadline assignments, different topics might have different deadlines. In that case we will have to check if the deadline has passed for each individual topic. Deadlines for individual topics are stored in a table called due_dates with the parent_id as the identifier of the particular topic in place of the assignment identifier. A logic for getting the due dates of topics for staggered deadline assignments is found in the method check_topic_due_date_value in class SignUpSheetHelper.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
topic_due_date = TopicDueDate.where(parent_id: topic_id, deadline_type_id: deadline_type_id, round:review_round).first rescue nil&lt;br /&gt;
if !topic_due_date.nil?&lt;br /&gt;
   due_date = topic_due_date.due_at&lt;br /&gt;
else&lt;br /&gt;
   due_date = assignment_due_dates[review_round - 1].due_at.to_s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First we check if the topic has a specific different deadline and if not then its deadline will be the same as the deadline for the assignment. We will use a similar logic.&lt;br /&gt;
This way, we will filter out topics whose submission due dates have passed and for each of them, we will set the field @show_actions to false so then the user will not be able to sign up for these topics. &lt;br /&gt;
Possible Issues: We will have to confirm that the ‘list’ method is only method which is used for listing available topics to the user. If there is any other method being used, that will also have to be modified.&lt;br /&gt;
&lt;br /&gt;
For Problem 3, we can display the hyperlinks of submitted reviews already graded by the instructor with a different colour.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Use Case===&lt;br /&gt;
&lt;br /&gt;
''Part1: All submission due dates are in the past, so no topic is available for signup''&lt;br /&gt;
&lt;br /&gt;
1. Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
2. Impersonate student5695 &amp;lt;br&amp;gt;&lt;br /&gt;
3. In the Assignments section, go to assignment Chapter 11-12 made up exercises &amp;lt;br&amp;gt;&lt;br /&gt;
4. Click on Sign-up sheet &amp;lt;br&amp;gt;&lt;br /&gt;
5. No topic should be displayed for signup &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Part2: Change due date to after today for a topic, now it should be available for signup''&lt;br /&gt;
&lt;br /&gt;
1. Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
2. Go to Manage - -&amp;gt; Courses and select CSC/ECE 506, Spring 2015 &amp;lt;br&amp;gt;&lt;br /&gt;
3. Edit the assignment Chapter 11-12 madeup exercises &amp;lt;br&amp;gt;&lt;br /&gt;
4. Under the General tab, select Staggered deadline assignment &amp;lt;br&amp;gt;&lt;br /&gt;
5. Go to Topics tab and scroll down to the bottom and click on Show start/due date &amp;lt;br&amp;gt;&lt;br /&gt;
6. Make the submission deadline for topic 11.2 as any date after today &amp;lt;br&amp;gt;&lt;br /&gt;
7. Follow the steps in part 1 &amp;lt;br&amp;gt;&lt;br /&gt;
8. Now this topic 11.2 should be available for signup. All others remain unavailable &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem 2==&lt;br /&gt;
=== Relative Deadlines For Staggered Assignments===&lt;br /&gt;
The current implementation of the system requires the instructor to manually enter deadlines for the three submission review rounds which can be a painstaking task. Our requirement is to provide the instructor with the option to select a relative date for the submission review deadlines based on the Round1 submission deadline. The instructor would however like the ability to manually enter a custom date according to his needs.&lt;br /&gt;
&lt;br /&gt;
One way of dealing with the above problem would be to provide an option for the other date fields for a given assignment to chose a relative date based on the initial submission date in addition to the ability to override and manually enter a custom date. Example: 3 days after Submission deadline, 6 days after re-submission deadline. This approach of implementation will only require changes to the _due_dates.html.erb view for the assignments controller.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
Changes will have to be made to the due_dates_table in the _due_dates.html.erb file. Changes have to be made to the datetime_picker_roundtype_roundnumber id. We could provide the user with a drop down menu listing a possible set of relative dates to chose from, in addition to the ability to manually enter a custom date. This could be done on the view side by modifying the date fields and adding the necessary JavaScript so that appropriate date responses are filled into the corresponding date fields when an option is chose from the dropdown menu.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        html += '&amp;lt;td class=&amp;quot;due_date_name&amp;quot; width=&amp;quot;15%&amp;quot;&amp;gt;';&lt;br /&gt;
        if (round_no != 0) {&lt;br /&gt;
            html += 'Round ' + round_no + ': ' + capitalize(deadline_type);&lt;br /&gt;
        } else {&lt;br /&gt;
            html += capitalize(deadline_type.replace(&amp;quot;_&amp;quot;, &amp;quot; &amp;quot;));&lt;br /&gt;
        }&lt;br /&gt;
        html += '&amp;lt;/td&amp;gt;';&lt;br /&gt;
        var due_at = due_date.due_at;&lt;br /&gt;
        if (due_at == null) {&lt;br /&gt;
            due_at = '';&lt;br /&gt;
        }&lt;br /&gt;
        else{&lt;br /&gt;
            var tzone = due_at.substr(23,6);&lt;br /&gt;
            if(tzone=='Z'){&lt;br /&gt;
                tzone = '+00:00';&lt;br /&gt;
            }&lt;br /&gt;
            var timezone = &amp;quot;(UTC &amp;quot;+tzone.toString()+&amp;quot;)&amp;quot;;&lt;br /&gt;
            due_at = due_at.substr(0,4)+'/'+due_at.substr(5,2)+'/'+due_at.substr(8,2)+' '+due_at.substr(11,2)+':'+due_at.substr(14,2)+' '+timezone;&lt;br /&gt;
        }&lt;br /&gt;
        var due_name = due_date.deadline_name;&lt;br /&gt;
        if (due_name == null){&lt;br /&gt;
            due_name = '';&lt;br /&gt;
        }&lt;br /&gt;
        html += '&amp;lt;td align=&amp;quot;center&amp;quot; class=&amp;quot;due_date_due_at&amp;quot; width=&amp;quot;25%&amp;quot;&amp;gt;' +&lt;br /&gt;
        '&amp;lt;input id=&amp;quot;datetimepicker_' + element_id +&lt;br /&gt;
        '&amp;quot; name=&amp;quot;assignment_form[due_date][][due_at]&amp;quot; style=&amp;quot;width: 200px&amp;quot; type=&amp;quot;text&amp;quot; value=&amp;quot;' +&lt;br /&gt;
        due_at + '&amp;quot;&amp;gt;' + '&amp;lt;/td&amp;gt;';&lt;br /&gt;
        &lt;br /&gt;
        html += '&amp;lt;td align=&amp;quot;center&amp;quot; class=&amp;quot;due_date_due_at&amp;quot; width=&amp;quot;10%&amp;quot;&amp;gt;';&lt;br /&gt;
        // if(deadline_type == 'team_formation'){&lt;br /&gt;
        //     html += '&amp;lt;select id=&amp;quot;due_date_submission_allowed_id&amp;quot; name=&amp;quot;assignment_form[due_date][][submission_allowed_id]&amp;quot; disabled&amp;gt;'&lt;br /&gt;
        // }&lt;br /&gt;
        // else{&lt;br /&gt;
        html += '&amp;lt;select id=&amp;quot;due_date_submission_allowed_id&amp;quot; name=&amp;quot;assignment_form[due_date][][submission_allowed_id]&amp;quot;&amp;gt;'&lt;br /&gt;
        // }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza home page] &amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/GitHub Github Wikipedia Page]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/Ruby_on_Rails Ruby on Rails Wikipedia Page]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105288</id>
		<title>CSC/ECE 517 Fall 2016 E1708: Improvements to staggered-deadline assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105288"/>
		<updated>2016-11-10T04:09:55Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Expertiza is a web based application which can be used by instructors to assign tasks to students. Expertiza also allows students to form teams among each other, perform peer reviews on assignments and projects. It gives flexibility to instructor to allow students to see other student's work with intended limitations and impose required restrictions on student access. Expertiza has been developed as an Open Source Software (OSS) on Ruby on Rails framework.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
Expertiza open source development program has fetched many contributions from faculties and students of different universities and thus, it incorporates a wide variety of Ruby coding styles, and this has been a reason why Expertiza project is kept as CSC/ECE 517 final project. The students have been given guidelines on Ruby coding styles and many problem statement includes tasks like refactoring and writing tests which can improve uniformity in coding style. The opportunity to work on an open source project like Expertiza is also expected to provide student an introductory experience of understanding larger programs and making required contributions to them. The writing assignment along with programming assignment is expected to provide project documentation experience to students.&lt;br /&gt;
&lt;br /&gt;
== Description of Project ==&lt;br /&gt;
The project numbered E1708 and titled ‘Improvements to staggered-deadline assignments’ is intended to make contributors or students understand the implementation of assignments and due dates models and tables, so that they can improve on the methodology which is used to assign the due dates to assignments and topics. A staggered-deadline assignment is an assignment in which different topics have different deadlines. It can be pretty useful if different topics within an assignment can have different deadlines for submission as well as reviews. The project has been divided into three problem statements and each of them is addressing an individual functional requirement related to the staggered deadline. The statements and the proposed approaches to meet the requirements are explained below as implementation.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The following issues can arise with a staggered-deadline assignment.&lt;br /&gt;
&lt;br /&gt;
===Problem 1: Staggered-deadline topic available for selection past its deadline===&lt;br /&gt;
For a topic with multiple slots that is posted, if it is not selected in the first round, it is still available for selection in a later round. The team that selects the topic then is unable to submit their work as it is past deadline. A solution to this is to prohibit anyone from signing up for a topic whose submission deadline has passed.&lt;br /&gt;
&lt;br /&gt;
===Problem 2: Manual submission and review deadline entry required for all topics===&lt;br /&gt;
Currently system requires instructor to enter submission and review deadlines for all topics. A probable solution to this is to allow the instructor to apply one deadline entry to a set of topics and also let the system calculate subsequent dates for subsequent project phases like review and resubmission, based on an initial deadline entry.&lt;br /&gt;
&lt;br /&gt;
===Problem 3: New submissions not identifiable among pool of already graded entries===&lt;br /&gt;
Currently there is not way to identify new submissions among list of entries for which grading has already been done. There should some marker or way to distinguish new entries.&lt;br /&gt;
&lt;br /&gt;
==Analysis==&lt;br /&gt;
For Problem 1, the solution that we have chosen to implement is fix 1. We will prevent anyone from signing up for a topic whose submission deadline has passed. In order to do this we will have to modify the ‘list’ method in the sign_up_sheet_controller.rb class. In this method, currently we get the list of topics for a particular assignment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@sign_up_topics = SignUpTopic.where(assignment_id: @assignment_id, private_to: mil)&lt;br /&gt;
@num_of_topics = @sign_up_topics.size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then if the assignment is not a staggered deadline assignment and if its submission deadline has passed, then we prevent students from signing up for the assignment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unless assignment.due_dates.find_by_deadline_type_id(1).nil?&lt;br /&gt;
   if !assignment.staggered_deadline? and assignment.due_dates.find_by_deadline_type_id(1).due_at &amp;lt; Time.now&lt;br /&gt;
   @show_actions = false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will have to replicate a similar logic for staggered deadline assignments. The problem here is that for staggered deadline assignments, different topics might have different deadlines. In that case we will have to check if the deadline has passed for each individual topic. Deadlines for individual topics are stored in a table called due_dates with the parent_id as the identifier of the particular topic in place of the assignment identifier. A logic for getting the due dates of topics for staggered deadline assignments is found in the method check_topic_due_date_value in class SignUpSheetHelper.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
topic_due_date = TopicDueDate.where(parent_id: topic_id, deadline_type_id: deadline_type_id, round:review_round).first rescue nil&lt;br /&gt;
if !topic_due_date.nil?&lt;br /&gt;
   due_date = topic_due_date.due_at&lt;br /&gt;
else&lt;br /&gt;
   due_date = assignment_due_dates[review_round - 1].due_at.to_s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First we check if the topic has a specific different deadline and if not then its deadline will be the same as the deadline for the assignment. We will use a similar logic.&lt;br /&gt;
This way, we will filter out topics whose submission due dates have passed and for each of them, we will set the field @show_actions to false so then the user will not be able to sign up for these topics. &lt;br /&gt;
Possible Issues: We will have to confirm that the ‘list’ method is only method which is used for listing available topics to the user. If there is any other method being used, that will also have to be modified.&lt;br /&gt;
&lt;br /&gt;
For Problem 3, we can display the hyperlinks of submitted reviews already graded by the instructor with a different colour.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Use Case===&lt;br /&gt;
&lt;br /&gt;
''Part1: All submission due dates are in the past, so no topic is available for signup''&lt;br /&gt;
&lt;br /&gt;
1. Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
2. Impersonate student5695 &amp;lt;br&amp;gt;&lt;br /&gt;
3. In the Assignments section, go to assignment Chapter 11-12 made up exercises &amp;lt;br&amp;gt;&lt;br /&gt;
4. Click on Sign-up sheet &amp;lt;br&amp;gt;&lt;br /&gt;
5. No topic should be displayed for signup &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Part2: Change due date to after today for a topic, now it should be available for signup''&lt;br /&gt;
&lt;br /&gt;
1. Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
2. Go to Manage - -&amp;gt; Courses and select CSC/ECE 506, Spring 2015 &amp;lt;br&amp;gt;&lt;br /&gt;
3. Edit the assignment Chapter 11-12 madeup exercises &amp;lt;br&amp;gt;&lt;br /&gt;
4. Under the General tab, select Staggered deadline assignment &amp;lt;br&amp;gt;&lt;br /&gt;
5. Go to Topics tab and scroll down to the bottom and click on Show start/due date &amp;lt;br&amp;gt;&lt;br /&gt;
6. Make the submission deadline for topic 11.2 as any date after today &amp;lt;br&amp;gt;&lt;br /&gt;
7. Follow the steps in part 1 &amp;lt;br&amp;gt;&lt;br /&gt;
8. Now this topic 11.2 should be available for signup. All others remain unavailable &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem 2==&lt;br /&gt;
=== Relative Deadlines For Staggered Assignments===&lt;br /&gt;
The current implementation of the system requires the instructor to manually enter deadlines for the three submission review rounds which can be a painstaking task. Our requirement is to provide the instructor with the option to select a relative date for the submission review deadlines based on the Round1 submission deadline. The instructor would however like the ability to manually enter a custom date according to his needs.&lt;br /&gt;
&lt;br /&gt;
One way of dealing with the above problem would be to provide an option for the other date fields for a given assignment to chose a relative date based on the initial submission date in addition to the ability to override and manually enter a custom date. Example: 3 days after Submission deadline, 6 days after re-submission deadline. This approach of implementation will only require changes to the _due_dates.html.erb view for the assignments controller.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
Changes will have to be made to the due_dates_table in the _due_dates.html.erb file. Changes have to be made to the datetime_picker_roundtype_roundnumber id. We could provide the user with a drop down menu listing a possible set of relative dates to chose from, in addition to the ability to manually enter a custom date. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        html += '&amp;lt;td class=&amp;quot;due_date_name&amp;quot; width=&amp;quot;15%&amp;quot;&amp;gt;';&lt;br /&gt;
        if (round_no != 0) {&lt;br /&gt;
            html += 'Round ' + round_no + ': ' + capitalize(deadline_type);&lt;br /&gt;
        } else {&lt;br /&gt;
            html += capitalize(deadline_type.replace(&amp;quot;_&amp;quot;, &amp;quot; &amp;quot;));&lt;br /&gt;
        }&lt;br /&gt;
        html += '&amp;lt;/td&amp;gt;';&lt;br /&gt;
        var due_at = due_date.due_at;&lt;br /&gt;
        if (due_at == null) {&lt;br /&gt;
            due_at = '';&lt;br /&gt;
        }&lt;br /&gt;
        else{&lt;br /&gt;
            var tzone = due_at.substr(23,6);&lt;br /&gt;
            if(tzone=='Z'){&lt;br /&gt;
                tzone = '+00:00';&lt;br /&gt;
            }&lt;br /&gt;
            var timezone = &amp;quot;(UTC &amp;quot;+tzone.toString()+&amp;quot;)&amp;quot;;&lt;br /&gt;
            due_at = due_at.substr(0,4)+'/'+due_at.substr(5,2)+'/'+due_at.substr(8,2)+' '+due_at.substr(11,2)+':'+due_at.substr(14,2)+' '+timezone;&lt;br /&gt;
        }&lt;br /&gt;
        var due_name = due_date.deadline_name;&lt;br /&gt;
        if (due_name == null){&lt;br /&gt;
            due_name = '';&lt;br /&gt;
        }&lt;br /&gt;
        html += '&amp;lt;td align=&amp;quot;center&amp;quot; class=&amp;quot;due_date_due_at&amp;quot; width=&amp;quot;25%&amp;quot;&amp;gt;' +&lt;br /&gt;
        '&amp;lt;input id=&amp;quot;datetimepicker_' + element_id +&lt;br /&gt;
        '&amp;quot; name=&amp;quot;assignment_form[due_date][][due_at]&amp;quot; style=&amp;quot;width: 200px&amp;quot; type=&amp;quot;text&amp;quot; value=&amp;quot;' +&lt;br /&gt;
        due_at + '&amp;quot;&amp;gt;' + '&amp;lt;/td&amp;gt;';&lt;br /&gt;
        &lt;br /&gt;
        html += '&amp;lt;td align=&amp;quot;center&amp;quot; class=&amp;quot;due_date_due_at&amp;quot; width=&amp;quot;10%&amp;quot;&amp;gt;';&lt;br /&gt;
        // if(deadline_type == 'team_formation'){&lt;br /&gt;
        //     html += '&amp;lt;select id=&amp;quot;due_date_submission_allowed_id&amp;quot; name=&amp;quot;assignment_form[due_date][][submission_allowed_id]&amp;quot; disabled&amp;gt;'&lt;br /&gt;
        // }&lt;br /&gt;
        // else{&lt;br /&gt;
        html += '&amp;lt;select id=&amp;quot;due_date_submission_allowed_id&amp;quot; name=&amp;quot;assignment_form[due_date][][submission_allowed_id]&amp;quot;&amp;gt;'&lt;br /&gt;
        // }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza home page] &amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/GitHub Github Wikipedia Page]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/Ruby_on_Rails Ruby on Rails Wikipedia Page]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105286</id>
		<title>CSC/ECE 517 Fall 2016 E1708: Improvements to staggered-deadline assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105286"/>
		<updated>2016-11-10T04:06:54Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Expertiza is a web based application which can be used by instructors to assign tasks to students. Expertiza also allows students to form teams among each other, perform peer reviews on assignments and projects. It gives flexibility to instructor to allow students to see other student's work with intended limitations and impose required restrictions on student access. Expertiza has been developed as an Open Source Software (OSS) on Ruby on Rails framework.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
Expertiza open source development program has fetched many contributions from faculties and students of different universities and thus, it incorporates a wide variety of Ruby coding styles, and this has been a reason why Expertiza project is kept as CSC/ECE 517 final project. The students have been given guidelines on Ruby coding styles and many problem statement includes tasks like refactoring and writing tests which can improve uniformity in coding style. The opportunity to work on an open source project like Expertiza is also expected to provide student an introductory experience of understanding larger programs and making required contributions to them. The writing assignment along with programming assignment is expected to provide project documentation experience to students.&lt;br /&gt;
&lt;br /&gt;
== Description of Project ==&lt;br /&gt;
The project numbered E1708 and titled ‘Improvements to staggered-deadline assignments’ is intended to make contributors or students understand the implementation of assignments and due dates models and tables, so that they can improve on the methodology which is used to assign the due dates to assignments and topics. A staggered-deadline assignment is an assignment in which different topics have different deadlines. It can be pretty useful if different topics within an assignment can have different deadlines for submission as well as reviews. The project has been divided into three problem statements and each of them is addressing an individual functional requirement related to the staggered deadline. The statements and the proposed approaches to meet the requirements are explained below as implementation.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The following issues can arise with a staggered-deadline assignment.&lt;br /&gt;
&lt;br /&gt;
===Problem 1: Staggered-deadline topic available for selection past its deadline===&lt;br /&gt;
For a topic with multiple slots that is posted, if it is not selected in the first round, it is still available for selection in a later round. The team that selects the topic then is unable to submit their work as it is past deadline. A solution to this is to prohibit anyone from signing up for a topic whose submission deadline has passed.&lt;br /&gt;
&lt;br /&gt;
===Problem 2: Manual submission and review deadline entry required for all topics===&lt;br /&gt;
Currently system requires instructor to enter submission and review deadlines for all topics. A probable solution to this is to allow the instructor to apply one deadline entry to a set of topics and also let the system calculate subsequent dates for subsequent project phases like review and resubmission, based on an initial deadline entry.&lt;br /&gt;
&lt;br /&gt;
===Problem 3: New submissions not identifiable among pool of already graded entries===&lt;br /&gt;
Currently there is not way to identify new submissions among list of entries for which grading has already been done. There should some marker or way to distinguish new entries.&lt;br /&gt;
&lt;br /&gt;
==Analysis==&lt;br /&gt;
For Problem 1, the solution that we have chosen to implement is fix 1. We will prevent anyone from signing up for a topic whose submission deadline has passed. In order to do this we will have to modify the ‘list’ method in the sign_up_sheet_controller.rb class. In this method, currently we get the list of topics for a particular assignment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@sign_up_topics = SignUpTopic.where(assignment_id: @assignment_id, private_to: mil)&lt;br /&gt;
@num_of_topics = @sign_up_topics.size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then if the assignment is not a staggered deadline assignment and if its submission deadline has passed, then we prevent students from signing up for the assignment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unless assignment.due_dates.find_by_deadline_type_id(1).nil?&lt;br /&gt;
   if !assignment.staggered_deadline? and assignment.due_dates.find_by_deadline_type_id(1).due_at &amp;lt; Time.now&lt;br /&gt;
   @show_actions = false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will have to replicate a similar logic for staggered deadline assignments. The problem here is that for staggered deadline assignments, different topics might have different deadlines. In that case we will have to check if the deadline has passed for each individual topic. Deadlines for individual topics are stored in a table called due_dates with the parent_id as the identifier of the particular topic in place of the assignment identifier. A logic for getting the due dates of topics for staggered deadline assignments is found in the method check_topic_due_date_value in class SignUpSheetHelper.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
topic_due_date = TopicDueDate.where(parent_id: topic_id, deadline_type_id: deadline_type_id, round:review_round).first rescue nil&lt;br /&gt;
if !topic_due_date.nil?&lt;br /&gt;
   due_date = topic_due_date.due_at&lt;br /&gt;
else&lt;br /&gt;
   due_date = assignment_due_dates[review_round - 1].due_at.to_s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First we check if the topic has a specific different deadline and if not then its deadline will be the same as the deadline for the assignment. We will use a similar logic.&lt;br /&gt;
This way, we will filter out topics whose submission due dates have passed and for each of them, we will set the field @show_actions to false so then the user will not be able to sign up for these topics. &lt;br /&gt;
Possible Issues: We will have to confirm that the ‘list’ method is only method which is used for listing available topics to the user. If there is any other method being used, that will also have to be modified.&lt;br /&gt;
&lt;br /&gt;
For Problem 3, we can display the hyperlinks of submitted reviews already graded by the instructor with a different colour.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Use Case===&lt;br /&gt;
&lt;br /&gt;
''Part1: All submission due dates are in the past, so no topic is available for signup''&lt;br /&gt;
&lt;br /&gt;
1. Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
2. Impersonate student5695 &amp;lt;br&amp;gt;&lt;br /&gt;
3. In the Assignments section, go to assignment Chapter 11-12 made up exercises &amp;lt;br&amp;gt;&lt;br /&gt;
4. Click on Sign-up sheet &amp;lt;br&amp;gt;&lt;br /&gt;
5. No topic should be displayed for signup &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Part2: Change due date to after today for a topic, now it should be available for signup''&lt;br /&gt;
&lt;br /&gt;
1. Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
2. Go to Manage - -&amp;gt; Courses and select CSC/ECE 506, Spring 2015 &amp;lt;br&amp;gt;&lt;br /&gt;
3. Edit the assignment Chapter 11-12 madeup exercises &amp;lt;br&amp;gt;&lt;br /&gt;
4. Under the General tab, select Staggered deadline assignment &amp;lt;br&amp;gt;&lt;br /&gt;
5. Go to Topics tab and scroll down to the bottom and click on Show start/due date &amp;lt;br&amp;gt;&lt;br /&gt;
6. Make the submission deadline for topic 11.2 as any date after today &amp;lt;br&amp;gt;&lt;br /&gt;
7. Follow the steps in part 1 &amp;lt;br&amp;gt;&lt;br /&gt;
8. Now this topic 11.2 should be available for signup. All others remain unavailable &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem 2==&lt;br /&gt;
=== Relative Deadlines For Staggered Assignments===&lt;br /&gt;
The current implementation of the system requires the instructor to manually enter deadlines for the three submission review rounds which can be a painstaking task. Our requirement is to provide the instructor with the option to select a relative date for the submission review deadlines based on the Round1 submission deadline. The instructor would however like the ability to manually enter a custom date according to his needs.&lt;br /&gt;
&lt;br /&gt;
One way of dealing with the above problem would be to provide an option for the other date fields for a given assignment to chose a relative date based on the initial submission date in addition to the ability to override and manually enter a custom date. Example: 3 days after Submission deadline, 6 days after re-submission deadline. This approach of implementation will only require changes to the _due_dates.html.erb view for the assignments controller.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
Changes will have to be made to the due_dates_table in the _due_dates.html.erb file. From the below code, it can be noted that modifications have to be made to the way in which the datefield for each of the rounds gets it's default values. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        html += '&amp;lt;td class=&amp;quot;due_date_name&amp;quot; width=&amp;quot;15%&amp;quot;&amp;gt;';&lt;br /&gt;
        if (round_no != 0) {&lt;br /&gt;
            html += 'Round ' + round_no + ': ' + capitalize(deadline_type);&lt;br /&gt;
        } else {&lt;br /&gt;
            html += capitalize(deadline_type.replace(&amp;quot;_&amp;quot;, &amp;quot; &amp;quot;));&lt;br /&gt;
        }&lt;br /&gt;
        html += '&amp;lt;/td&amp;gt;';&lt;br /&gt;
        var due_at = due_date.due_at;&lt;br /&gt;
        if (due_at == null) {&lt;br /&gt;
            due_at = '';&lt;br /&gt;
        }&lt;br /&gt;
        else{&lt;br /&gt;
            var tzone = due_at.substr(23,6);&lt;br /&gt;
            if(tzone=='Z'){&lt;br /&gt;
                tzone = '+00:00';&lt;br /&gt;
            }&lt;br /&gt;
            var timezone = &amp;quot;(UTC &amp;quot;+tzone.toString()+&amp;quot;)&amp;quot;;&lt;br /&gt;
            due_at = due_at.substr(0,4)+'/'+due_at.substr(5,2)+'/'+due_at.substr(8,2)+' '+due_at.substr(11,2)+':'+due_at.substr(14,2)+' '+timezone;&lt;br /&gt;
        }&lt;br /&gt;
        var due_name = due_date.deadline_name;&lt;br /&gt;
        if (due_name == null){&lt;br /&gt;
            due_name = '';&lt;br /&gt;
        }&lt;br /&gt;
        html += '&amp;lt;td align=&amp;quot;center&amp;quot; class=&amp;quot;due_date_due_at&amp;quot; width=&amp;quot;25%&amp;quot;&amp;gt;' +&lt;br /&gt;
        '&amp;lt;input id=&amp;quot;datetimepicker_' + element_id +&lt;br /&gt;
        '&amp;quot; name=&amp;quot;assignment_form[due_date][][due_at]&amp;quot; style=&amp;quot;width: 200px&amp;quot; type=&amp;quot;text&amp;quot; value=&amp;quot;' +&lt;br /&gt;
        due_at + '&amp;quot;&amp;gt;' + '&amp;lt;/td&amp;gt;';&lt;br /&gt;
        &lt;br /&gt;
        html += '&amp;lt;td align=&amp;quot;center&amp;quot; class=&amp;quot;due_date_due_at&amp;quot; width=&amp;quot;10%&amp;quot;&amp;gt;';&lt;br /&gt;
        // if(deadline_type == 'team_formation'){&lt;br /&gt;
        //     html += '&amp;lt;select id=&amp;quot;due_date_submission_allowed_id&amp;quot; name=&amp;quot;assignment_form[due_date][][submission_allowed_id]&amp;quot; disabled&amp;gt;'&lt;br /&gt;
        // }&lt;br /&gt;
        // else{&lt;br /&gt;
        html += '&amp;lt;select id=&amp;quot;due_date_submission_allowed_id&amp;quot; name=&amp;quot;assignment_form[due_date][][submission_allowed_id]&amp;quot;&amp;gt;'&lt;br /&gt;
        // }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza home page] &amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/GitHub Github Wikipedia Page]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/Ruby_on_Rails Ruby on Rails Wikipedia Page]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105284</id>
		<title>CSC/ECE 517 Fall 2016 E1708: Improvements to staggered-deadline assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105284"/>
		<updated>2016-11-10T04:06:25Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Expertiza is a web based application which can be used by instructors to assign tasks to students. Expertiza also allows students to form teams among each other, perform peer reviews on assignments and projects. It gives flexibility to instructor to allow students to see other student's work with intended limitations and impose required restrictions on student access. Expertiza has been developed as an Open Source Software (OSS) on Ruby on Rails framework.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
Expertiza open source development program has fetched many contributions from faculties and students of different universities and thus, it incorporates a wide variety of Ruby coding styles, and this has been a reason why Expertiza project is kept as CSC/ECE 517 final project. The students have been given guidelines on Ruby coding styles and many problem statement includes tasks like refactoring and writing tests which can improve uniformity in coding style. The opportunity to work on an open source project like Expertiza is also expected to provide student an introductory experience of understanding larger programs and making required contributions to them. The writing assignment along with programming assignment is expected to provide project documentation experience to students.&lt;br /&gt;
&lt;br /&gt;
== Description of Project ==&lt;br /&gt;
The project numbered E1708 and titled ‘Improvements to staggered-deadline assignments’ is intended to make contributors or students understand the implementation of assignments and due dates models and tables, so that they can improve on the methodology which is used to assign the due dates to assignments and topics. A staggered-deadline assignment is an assignment in which different topics have different deadlines. It can be pretty useful if different topics within an assignment can have different deadlines for submission as well as reviews. The project has been divided into three problem statements and each of them is addressing an individual functional requirement related to the staggered deadline. The statements and the proposed approaches to meet the requirements are explained below as implementation.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The following issues can arise with a staggered-deadline assignment.&lt;br /&gt;
&lt;br /&gt;
===Problem 1: Staggered-deadline topic available for selection past its deadline===&lt;br /&gt;
For a topic with multiple slots that is posted, if it is not selected in the first round, it is still available for selection in a later round. The team that selects the topic then is unable to submit their work as it is past deadline. A solution to this is to prohibit anyone from signing up for a topic whose submission deadline has passed.&lt;br /&gt;
&lt;br /&gt;
===Problem 2: Manual submission and review deadline entry required for all topics===&lt;br /&gt;
Currently system requires instructor to enter submission and review deadlines for all topics. A probable solution to this is to allow the instructor to apply one deadline entry to a set of topics and also let the system calculate subsequent dates for subsequent project phases like review and resubmission, based on an initial deadline entry.&lt;br /&gt;
&lt;br /&gt;
===Problem 3: New submissions not identifiable among pool of already graded entries===&lt;br /&gt;
Currently there is not way to identify new submissions among list of entries for which grading has already been done. There should some marker or way to distinguish new entries.&lt;br /&gt;
&lt;br /&gt;
==Analysis==&lt;br /&gt;
For Problem 1, the solution that we have chosen to implement is fix 1. We will prevent anyone from signing up for a topic whose submission deadline has passed. In order to do this we will have to modify the ‘list’ method in the sign_up_sheet_controller.rb class. In this method, currently we get the list of topics for a particular assignment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@sign_up_topics = SignUpTopic.where(assignment_id: @assignment_id, private_to: mil)&lt;br /&gt;
@num_of_topics = @sign_up_topics.size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then if the assignment is not a staggered deadline assignment and if its submission deadline has passed, then we prevent students from signing up for the assignment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unless assignment.due_dates.find_by_deadline_type_id(1).nil?&lt;br /&gt;
   if !assignment.staggered_deadline? and assignment.due_dates.find_by_deadline_type_id(1).due_at &amp;lt; Time.now&lt;br /&gt;
   @show_actions = false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will have to replicate a similar logic for staggered deadline assignments. The problem here is that for staggered deadline assignments, different topics might have different deadlines. In that case we will have to check if the deadline has passed for each individual topic. Deadlines for individual topics are stored in a table called due_dates with the parent_id as the identifier of the particular topic in place of the assignment identifier. A logic for getting the due dates of topics for staggered deadline assignments is found in the method check_topic_due_date_value in class SignUpSheetHelper.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
topic_due_date = TopicDueDate.where(parent_id: topic_id, deadline_type_id: deadline_type_id, round:review_round).first rescue nil&lt;br /&gt;
if !topic_due_date.nil?&lt;br /&gt;
   due_date = topic_due_date.due_at&lt;br /&gt;
else&lt;br /&gt;
   due_date = assignment_due_dates[review_round - 1].due_at.to_s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First we check if the topic has a specific different deadline and if not then its deadline will be the same as the deadline for the assignment. We will use a similar logic.&lt;br /&gt;
This way, we will filter out topics whose submission due dates have passed and for each of them, we will set the field @show_actions to false so then the user will not be able to sign up for these topics. &lt;br /&gt;
Possible Issues: We will have to confirm that the ‘list’ method is only method which is used for listing available topics to the user. If there is any other method being used, that will also have to be modified.&lt;br /&gt;
&lt;br /&gt;
For Problem 3, we can display the hyperlinks of submitted reviews already graded by the instructor with a different colour.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Use Case===&lt;br /&gt;
&lt;br /&gt;
''Part1: All submission due dates are in the past, so no topic is available for signup''&lt;br /&gt;
&lt;br /&gt;
1. Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
2. Impersonate student5695 &amp;lt;br&amp;gt;&lt;br /&gt;
3. In the Assignments section, go to assignment Chapter 11-12 made up exercises &amp;lt;br&amp;gt;&lt;br /&gt;
4. Click on Sign-up sheet &amp;lt;br&amp;gt;&lt;br /&gt;
5. No topic should be displayed for signup &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Part2: Change due date to after today for a topic, now it should be available for signup''&lt;br /&gt;
&lt;br /&gt;
1. Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
2. Go to Manage - -&amp;gt; Courses and select CSC/ECE 506, Spring 2015 &amp;lt;br&amp;gt;&lt;br /&gt;
3. Edit the assignment Chapter 11-12 madeup exercises &amp;lt;br&amp;gt;&lt;br /&gt;
4. Under the General tab, select Staggered deadline assignment &amp;lt;br&amp;gt;&lt;br /&gt;
5. Go to Topics tab and scroll down to the bottom and click on Show start/due date &amp;lt;br&amp;gt;&lt;br /&gt;
6. Make the submission deadline for topic 11.2 as any date after today &amp;lt;br&amp;gt;&lt;br /&gt;
7. Follow the steps in part 1 &amp;lt;br&amp;gt;&lt;br /&gt;
8. Now this topic 11.2 should be available for signup. All others remain unavailable &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem 2==&lt;br /&gt;
=== Relative Deadlines For Staggered Assignments===&lt;br /&gt;
The current implementation of the system requires the instructor to manually enter deadlines for the three submission review rounds which can be a painstaking task. Our requirement is to provide the instructor with the option to select a relative date for the submission review deadlines based on the Round1 submission deadline. The instructor would however like the ability to manually enter a custom date according to his needs.&lt;br /&gt;
&lt;br /&gt;
One way of dealing with the above problem would be to provide an option for the other date fields for a given assignment to chose a relative date based on the initial submission date in addition to the ability to override and manually enter a custom date. Example: 3 days after Submission deadline, 6 days after re-submission deadline. This approach of implementation will only require changes to the _due_dates.html.erb view for the assignments controller.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
Changes will have to be made to the due_dates_table in the _due_dates.html.erb file. From the below code, it can be noted that modifications have to be made to the way in which the datefield for each of the rounds gets it's default values. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        html += '&amp;lt;td class=&amp;quot;due_date_name&amp;quot; width=&amp;quot;15%&amp;quot;&amp;gt;';&lt;br /&gt;
        if (round_no != 0) {&lt;br /&gt;
            html += 'Round ' + round_no + ': ' + capitalize(deadline_type);&lt;br /&gt;
        } else {&lt;br /&gt;
            html += capitalize(deadline_type.replace(&amp;quot;_&amp;quot;, &amp;quot; &amp;quot;));&lt;br /&gt;
        }&lt;br /&gt;
        html += '&amp;lt;/td&amp;gt;';&lt;br /&gt;
        var due_at = due_date.due_at;&lt;br /&gt;
        if (due_at == null) {&lt;br /&gt;
            due_at = '';&lt;br /&gt;
        }&lt;br /&gt;
        else{&lt;br /&gt;
            var tzone = due_at.substr(23,6);&lt;br /&gt;
            if(tzone=='Z'){&lt;br /&gt;
                tzone = '+00:00';&lt;br /&gt;
            }&lt;br /&gt;
            var timezone = &amp;quot;(UTC &amp;quot;+tzone.toString()+&amp;quot;)&amp;quot;;&lt;br /&gt;
            due_at = due_at.substr(0,4)+'/'+due_at.substr(5,2)+'/'+due_at.substr(8,2)+' '+due_at.substr(11,2)+':'+due_at.substr(14,2)+' '+timezone;&lt;br /&gt;
        }&lt;br /&gt;
        var due_name = due_date.deadline_name;&lt;br /&gt;
        if (due_name == null){&lt;br /&gt;
            due_name = '';&lt;br /&gt;
        }&lt;br /&gt;
        html += '&amp;lt;td align=&amp;quot;center&amp;quot; class=&amp;quot;due_date_due_at&amp;quot; width=&amp;quot;25%&amp;quot;&amp;gt;' +&lt;br /&gt;
        '&amp;lt;input id=&amp;quot;datetimepicker_' + element_id +&lt;br /&gt;
        '&amp;quot; name=&amp;quot;assignment_form[due_date][][due_at]&amp;quot; style=&amp;quot;width: 200px&amp;quot; type=&amp;quot;text&amp;quot; value=&amp;quot;' +&lt;br /&gt;
        due_at + '&amp;quot;&amp;gt;' + '&amp;lt;/td&amp;gt;';&lt;br /&gt;
        &lt;br /&gt;
        html += '&amp;lt;td align=&amp;quot;center&amp;quot; class=&amp;quot;due_date_due_at&amp;quot; width=&amp;quot;10%&amp;quot;&amp;gt;';&lt;br /&gt;
        // if(deadline_type == 'team_formation'){&lt;br /&gt;
        //     html += '&amp;lt;select id=&amp;quot;due_date_submission_allowed_id&amp;quot; name=&amp;quot;assignment_form[due_date][][submission_allowed_id]&amp;quot; disabled&amp;gt;'&lt;br /&gt;
        // }&lt;br /&gt;
        // else{&lt;br /&gt;
        html += '&amp;lt;select id=&amp;quot;due_date_submission_allowed_id&amp;quot; name=&amp;quot;assignment_form[due_date][][submission_allowed_id]&amp;quot;&amp;gt;'&lt;br /&gt;
        // }&lt;br /&gt;
        html +=&lt;br /&gt;
        '&amp;lt;option value=&amp;quot;1&amp;quot;&amp;gt;No&amp;lt;/option&amp;gt;' +&lt;br /&gt;
        '&amp;lt;option value=&amp;quot;2&amp;quot;&amp;gt;Late&amp;lt;/option&amp;gt;' +&lt;br /&gt;
        '&amp;lt;option value=&amp;quot;3&amp;quot;&amp;gt;Yes&amp;lt;/option&amp;gt;' +&lt;br /&gt;
        '&amp;lt;/select&amp;gt;&amp;lt;/td&amp;gt;';&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza home page] &amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/GitHub Github Wikipedia Page]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/Ruby_on_Rails Ruby on Rails Wikipedia Page]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105281</id>
		<title>CSC/ECE 517 Fall 2016 E1708: Improvements to staggered-deadline assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1708:_Improvements_to_staggered-deadline_assignments&amp;diff=105281"/>
		<updated>2016-11-10T04:01:45Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Expertiza is a web based application which can be used by instructors to assign tasks to students. Expertiza also allows students to form teams among each other, perform peer reviews on assignments and projects. It gives flexibility to instructor to allow students to see other student's work with intended limitations and impose required restrictions on student access. Expertiza has been developed as an Open Source Software (OSS) on Ruby on Rails framework.&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
Expertiza open source development program has fetched many contributions from faculties and students of different universities and thus, it incorporates a wide variety of Ruby coding styles, and this has been a reason why Expertiza project is kept as CSC/ECE 517 final project. The students have been given guidelines on Ruby coding styles and many problem statement includes tasks like refactoring and writing tests which can improve uniformity in coding style. The opportunity to work on an open source project like Expertiza is also expected to provide student an introductory experience of understanding larger programs and making required contributions to them. The writing assignment along with programming assignment is expected to provide project documentation experience to students.&lt;br /&gt;
&lt;br /&gt;
== Description of Project ==&lt;br /&gt;
The project numbered E1708 and titled ‘Improvements to staggered-deadline assignments’ is intended to make contributors or students understand the implementation of assignments and due dates models and tables, so that they can improve on the methodology which is used to assign the due dates to assignments and topics. A staggered-deadline assignment is an assignment in which different topics have different deadlines. It can be pretty useful if different topics within an assignment can have different deadlines for submission as well as reviews. The project has been divided into three problem statements and each of them is addressing an individual functional requirement related to the staggered deadline. The statements and the proposed approaches to meet the requirements are explained below as implementation.&lt;br /&gt;
&lt;br /&gt;
== Project Requirements ==&lt;br /&gt;
The following issues can arise with a staggered-deadline assignment.&lt;br /&gt;
&lt;br /&gt;
===Problem 1: Staggered-deadline topic available for selection past its deadline===&lt;br /&gt;
For a topic with multiple slots that is posted, if it is not selected in the first round, it is still available for selection in a later round. The team that selects the topic then is unable to submit their work as it is past deadline. A solution to this is to prohibit anyone from signing up for a topic whose submission deadline has passed.&lt;br /&gt;
&lt;br /&gt;
===Problem 2: Manual submission and review deadline entry required for all topics===&lt;br /&gt;
Currently system requires instructor to enter submission and review deadlines for all topics. A probable solution to this is to allow the instructor to apply one deadline entry to a set of topics and also let the system calculate subsequent dates for subsequent project phases like review and resubmission, based on an initial deadline entry.&lt;br /&gt;
&lt;br /&gt;
===Problem 3: New submissions not identifiable among pool of already graded entries===&lt;br /&gt;
Currently there is not way to identify new submissions among list of entries for which grading has already been done. There should some marker or way to distinguish new entries.&lt;br /&gt;
&lt;br /&gt;
==Analysis==&lt;br /&gt;
For Problem 1, the solution that we have chosen to implement is fix 1. We will prevent anyone from signing up for a topic whose submission deadline has passed. In order to do this we will have to modify the ‘list’ method in the sign_up_sheet_controller.rb class. In this method, currently we get the list of topics for a particular assignment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@sign_up_topics = SignUpTopic.where(assignment_id: @assignment_id, private_to: mil)&lt;br /&gt;
@num_of_topics = @sign_up_topics.size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then if the assignment is not a staggered deadline assignment and if its submission deadline has passed, then we prevent students from signing up for the assignment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unless assignment.due_dates.find_by_deadline_type_id(1).nil?&lt;br /&gt;
   if !assignment.staggered_deadline? and assignment.due_dates.find_by_deadline_type_id(1).due_at &amp;lt; Time.now&lt;br /&gt;
   @show_actions = false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will have to replicate a similar logic for staggered deadline assignments. The problem here is that for staggered deadline assignments, different topics might have different deadlines. In that case we will have to check if the deadline has passed for each individual topic. Deadlines for individual topics are stored in a table called due_dates with the parent_id as the identifier of the particular topic in place of the assignment identifier. A logic for getting the due dates of topics for staggered deadline assignments is found in the method check_topic_due_date_value in class SignUpSheetHelper.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
topic_due_date = TopicDueDate.where(parent_id: topic_id, deadline_type_id: deadline_type_id, round:review_round).first rescue nil&lt;br /&gt;
if !topic_due_date.nil?&lt;br /&gt;
   due_date = topic_due_date.due_at&lt;br /&gt;
else&lt;br /&gt;
   due_date = assignment_due_dates[review_round - 1].due_at.to_s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First we check if the topic has a specific different deadline and if not then its deadline will be the same as the deadline for the assignment. We will use a similar logic.&lt;br /&gt;
This way, we will filter out topics whose submission due dates have passed and for each of them, we will set the field @show_actions to false so then the user will not be able to sign up for these topics. &lt;br /&gt;
Possible Issues: We will have to confirm that the ‘list’ method is only method which is used for listing available topics to the user. If there is any other method being used, that will also have to be modified.&lt;br /&gt;
&lt;br /&gt;
For Problem 3, we can display the hyperlinks of submitted reviews already graded by the instructor with a different colour.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
===Use Case===&lt;br /&gt;
&lt;br /&gt;
''Part1: All submission due dates are in the past, so no topic is available for signup''&lt;br /&gt;
&lt;br /&gt;
1. Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
2. Impersonate student5695 &amp;lt;br&amp;gt;&lt;br /&gt;
3. In the Assignments section, go to assignment Chapter 11-12 made up exercises &amp;lt;br&amp;gt;&lt;br /&gt;
4. Click on Sign-up sheet &amp;lt;br&amp;gt;&lt;br /&gt;
5. No topic should be displayed for signup &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Part2: Change due date to after today for a topic, now it should be available for signup''&lt;br /&gt;
&lt;br /&gt;
1. Login as instructor6 &amp;lt;br&amp;gt;&lt;br /&gt;
2. Go to Manage - -&amp;gt; Courses and select CSC/ECE 506, Spring 2015 &amp;lt;br&amp;gt;&lt;br /&gt;
3. Edit the assignment Chapter 11-12 madeup exercises &amp;lt;br&amp;gt;&lt;br /&gt;
4. Under the General tab, select Staggered deadline assignment &amp;lt;br&amp;gt;&lt;br /&gt;
5. Go to Topics tab and scroll down to the bottom and click on Show start/due date &amp;lt;br&amp;gt;&lt;br /&gt;
6. Make the submission deadline for topic 11.2 as any date after today &amp;lt;br&amp;gt;&lt;br /&gt;
7. Follow the steps in part 1 &amp;lt;br&amp;gt;&lt;br /&gt;
8. Now this topic 11.2 should be available for signup. All others remain unavailable &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem 2==&lt;br /&gt;
=== Relative Deadlines For Staggered Assignments===&lt;br /&gt;
The current implementation of the system requires the instructor to manually enter deadlines for the three submission review rounds which can be a painstaking task. Our requirement is to provide the instructor with the option to select a relative date for the submission review deadlines based on the Round1 submission deadline. The instructor would however like the ability to manually enter a custom date according to his needs.&lt;br /&gt;
&lt;br /&gt;
One way of dealing with the above problem would be to provide an option for the other date fields for a given assignment to chose a relative date based on the initial submission date in addition to the ability to override and manually enter a custom date. Example: 3 days after Submission deadline, 6 days after re-submission deadline. This approach of implementation will only require changes to the _due_dates.html.erb view for the assignments controller.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza home page] &amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/GitHub Github Wikipedia Page]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/Ruby_on_Rails Ruby on Rails Wikipedia Page]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1670._Unit_tests_for_answers.rb&amp;diff=103407</id>
		<title>CSC/ECE 517 Fall 2016/E1670. Unit tests for answers.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1670._Unit_tests_for_answers.rb&amp;diff=103407"/>
		<updated>2016-10-29T00:18:40Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1670 . Unit tests for answers.rb==&lt;br /&gt;
&lt;br /&gt;
This wiki page is for the description of changes made under E1670 OSS assignment for Fall 2016, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
&lt;br /&gt;
Expertiza is an Open Source web application developed on Ruby On Rails platform. It is a platform which allows students to take assignments posted by the course instructors. Expertiza allows students to select assignment topics, form teams and submit their work. It also allows them to review other students' submissions and improve their work based on this feedback.&lt;br /&gt;
&lt;br /&gt;
===Project Description===&lt;br /&gt;
&lt;br /&gt;
In Expertiza, each questionnaire contains many questions, those question may have different types (e.g. checkbox, criterion, etc). When a user fills in a rubric, the responses for each question will become an answer record. The responses of rubrics are stored in answers table in DB. The answer.rb is the model for the answers table in DB. Answer.rb model does not have any test cases and the aim of the project is to write fast, effective and flexible unit test cases that offer maximum code coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Created/Modified===&lt;br /&gt;
*answer_spec.rb&lt;br /&gt;
*factories.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===RSpec===&lt;br /&gt;
====RSpec Introduction====&lt;br /&gt;
RSpec is a testing framework for Ruby for behavior-driven development (BDD) licensed under MIT. It is inspired by JBehave and contains fully integrated JMock based framework which has a very rich and powerful DSL (domain-specific language) which resembles a natural language specification.&lt;br /&gt;
Composed of multiple libraries structured to work together, RSpec provides encapsulated testing via the describe block to specify the behavior of the class and the context for the unit test case.&lt;br /&gt;
&lt;br /&gt;
==== Why RSpec? ====&lt;br /&gt;
RSpec is easy to learn and implement and can be used with other testing tools like Cucumber and Minitest independently. It is extremely powerful for testing states with complicated setup and also helps in tearing down complex code to access the objects required for testing&lt;br /&gt;
RSpec semantics encourage agile thinking and practice and it structures the tests in a more intuitive way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Functions in answers.rb===&lt;br /&gt;
&lt;br /&gt;
'''Function Name : Compute_scores'''&lt;br /&gt;
&lt;br /&gt;
Compute_scores is a function in model answer.rb which gives the average, maximum and minimum scores obtained in a series a responses/assessments. It has two input parameters: List of assessments and questions. The function iterates over each assessment to get the total score of that assessment. If the response or review is invalid, that assessment won’t be considered in the calculation of the score average. After iterating over all assessments, Max score, and Min scores are calculated along with the average score based on the number of valid assessments. Their scores are returned by the function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : Compute_scores'''&lt;br /&gt;
&lt;br /&gt;
Following scenarios are tested:&lt;br /&gt;
&lt;br /&gt;
* To return scores as nil if the input list of assessments is nil. This is to make sure no Null Pointer exceptions are thrown by the code&lt;br /&gt;
*To return a particular score when a single valid assessment is given as an input.&lt;br /&gt;
*To return a particular score when multiple valid assessments are given as an input. This is to test the looping functionality of the method.&lt;br /&gt;
*To return a particular score when invalid assessments are given as an input. The validity and total scores are returned by a mock and not by the actual functions. This is to make the test cases less rigid so that failure of dependent functions do not disrupt the functionality of interface level tests.&lt;br /&gt;
*To return a particular score when invalid flag is nil. Invalid flag can either be 0,1 or nil. Nil situation is tested to prevent NullPointer Exceptions&lt;br /&gt;
*To check if the method get_total_score is called with the right parameters.&lt;br /&gt;
&lt;br /&gt;
This unit test uses a stub and returns a mock value.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Answer.stub(:get_total_score)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is to eliminate tight coupling between compute_scores and get_total_scores. Failure in get_total_scores wouldn't break the compute_scores test cases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Function Name : Get_total_scores'''&lt;br /&gt;
&lt;br /&gt;
This function is called by the Compute_scores method of the answer.rb model to compute the total score of an assessment. The input consists of assessment for which the total score is being calculated and the list of questions being evaluated in the assessment. The method uses questionnaire id from the questions and response id to obtain a score view questionnaire data. This score view is a read-only record. The questionnaire data mainly consists of q1_max_question_score, sum_of_weights and weighted_score. Before calculating the score, the function performs two crucial tasks. &lt;br /&gt;
*Checks if the answer for a scored question is nil. If it is nil or unanswered, the question will be ignored and not counted towards the score of this response.&lt;br /&gt;
* Calls the submission_valid function by passing the response record to set the @invalid flag based on the validity of the response.&lt;br /&gt;
The total score is calculated using the below formula&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(weighted_score / (sum_of_weights * max_question_score)) * 100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any edge cases would return -1 indicating no score&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : Get_total_scores'''&lt;br /&gt;
&lt;br /&gt;
Following scenarios are tested:&lt;br /&gt;
&lt;br /&gt;
*To return an anticipated total score of a single response without any edge cases. Since this function will be called only on one response at a time, there is no need to test for multiple responses at the same time.&lt;br /&gt;
*To return an anticipated total score of a response where nil answer is for a scored question. This is to check if its weight gets removed from the sum_of_weights.&lt;br /&gt;
*To return -1 when the sum of weights becomes 0. This can happen when all the scored questions are unanswered. Return value of -1 is checked at the calling function to ensure if a score is returned or not.&lt;br /&gt;
*To return -1 when weighted_score of questionnaireData is nil&lt;br /&gt;
* To check if submission_valid is called. This method is called to set invalid flag to indicate whether the response entered is valid or not. The validity criteria is explained in the submission_valid? Function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This unit test uses two stubs and returns mock results&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ScoreView.stub(:find_by_sql)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Answer.stub(:where)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is to reduce the outcome of the test to depend on DB calls. For example, in case the connection to DB fails, this unit test would still pass making it less rigid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Function Name : submission_valid?'''&lt;br /&gt;
&lt;br /&gt;
This purpose of this function is to verify the validity of a review based on a deadline.  This function obtains a list of AssignmentDueDate objects  in descending order which is then compared against the current time to determine which deadlines are valid and which ones are not. The flag variable is used to represent whether or not a deadline was available in the previous iteration of the loop. If the flag is set to TRUE and the deadline is less than the current date, then latest_review_phase_start_time is set to this deadline. A list of ResubmissionTime objects is also retrieved from the controller. These objects are then compared against the then latest_review_phase_start_time variable to determine a response. &lt;br /&gt;
&lt;br /&gt;
Observations: The current implementation of the function is bugged. It retrieves a list of sorted AssignmentDueDate objects and proceeds to check if this list is empty. However, instead of exiting if the function if the list is empty, it carries on execution and raises an exception on hitting the for loop. &lt;br /&gt;
&lt;br /&gt;
*Checks if a review is valid or not by comparing its date with a list of deadlines.&lt;br /&gt;
*Returns 1 or 0 depending on validity&lt;br /&gt;
*Current implementation is bugged. Throws an exception if no AssignmentDueDate objects are passed, returns nil if any objects are passed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : submission_valid?'''&lt;br /&gt;
&lt;br /&gt;
Following scenarios are tested:&lt;br /&gt;
&lt;br /&gt;
*Passing valid AssignmentDueDate objects&lt;br /&gt;
*Not passing any AssignmentDueDate objects&lt;br /&gt;
&lt;br /&gt;
When valid AssignmentDueDate objects are passed, stubs are used to create fake AssignmentDueDate Objects and ResubmissionTime objects. These objects are then populated with valid deadline dates and deadline_type values. These values are then supplied when requested by the submission_valid? Function rather than actually calling the function.  The current implementation of this test case expects the program to throw an error when it reaches the for loop. Once this bug is fixed, this test case may be re-written to test a more legitimate test case.&lt;br /&gt;
&lt;br /&gt;
In case an empty list of AssignmentDueDate objects is passed back to the submission_valid?() method. This would cause the function to return nil. When this function is fixed, the following test case may be re-written to test for a more legitimate test-case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This unit test uses two stubs and returns mock results&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AssignmentDueDate.stub_chain(:where, :order)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above stub returns two AssignmentDueDate objects whenever the where() and order() method are chained on AssignmentDueDate.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ResubmissionTime.stub_chain(:where, :order)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above stub returns two ResubmissionTime objects whenever the where() and order() method are chained on ResubmissionTime.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AssignmentDueDate.stub_chain(:where, :order)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This stub is used in the second test case to return nil objects.&lt;br /&gt;
&lt;br /&gt;
the stub_chain method can be used to create stubs where chained methods are expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Function Name : answers_by_question, answers_by_question_for_reviewee,answers_by_question_for_reviewee_in_round'''&lt;br /&gt;
&lt;br /&gt;
These three functions are sql queries that hit the DB to get a output record after a series of selections and joins. SQL queries that hit DB often do not have a high priority when it comes to testing, so the project does not aggressively test these functions. However, these functions are tested to make sure the queries are able to find the right column names and tables successfully. Any change in the table schema would be detected in these test cases. The functionality of these queries are not tested but instead existence of an output is tested. This ensures that answer.rb is able to make a successful db connection and is sync with the latest db schema. Since the function actually hits the DB, mocks can no longer be used, instead active records were created and saved in test db using FactoryGirl gem from the factories.rb. These records are cleared after every test case.&lt;br /&gt;
&lt;br /&gt;
Following factories were used to create records in the table&lt;br /&gt;
*question&lt;br /&gt;
*response_record&lt;br /&gt;
*response_map&lt;br /&gt;
*answer&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : answers_by_question, answers_by_question_for_reviewee,answers_by_question_for_reviewee_in_round'''&lt;br /&gt;
&lt;br /&gt;
The factories are created such a way that the query would return an output and the tests will pass if the query returns a non nil record. The functionality of these functions would be tested by the integration tests of the controller&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Validation and Dependency  Rspec Test'''&lt;br /&gt;
&lt;br /&gt;
Apart from testing functions, the models are also tested for validations and external dependencies. Model answer.rb does not have any validations but does have a dependency on question.rb. Answer belongs_to question and this was tested using a simple dependency rspec test.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it { should belong_to(:question) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Running Rspec===&lt;br /&gt;
*To run the test suite for a particular file only( answer_spec.rb):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@ubuntu:~/expertiza$ rspec spec/models/answer_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*To run the entire suite of test cases:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@ubuntu:~/expertiza$ rspec spec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rspec Test Results===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1 deprecation warning total&lt;br /&gt;
&lt;br /&gt;
Finished in 12.39 seconds (files took 11.25 seconds to load)&lt;br /&gt;
17 examples, 0 failures&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 37447&lt;br /&gt;
&lt;br /&gt;
Coverage report generated for RSpec to /home/root/expertiza/coverage. 998 / 3919 LOC (25.47%) covered.&lt;br /&gt;
[Coveralls] Outside the CI environment, not sending data.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1670._Unit_tests_for_answers.rb&amp;diff=103399</id>
		<title>CSC/ECE 517 Fall 2016/E1670. Unit tests for answers.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1670._Unit_tests_for_answers.rb&amp;diff=103399"/>
		<updated>2016-10-29T00:14:06Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1670 . Unit tests for answers.rb==&lt;br /&gt;
&lt;br /&gt;
This wiki page is for the description of changes made under E1670 OSS assignment for Fall 2016, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
&lt;br /&gt;
Expertiza is an Open Source web application developed on Ruby On Rails platform. It is a platform which allows students to take assignments posted by the course instructors. Expertiza allows students to select assignment topics, form teams and submit their work. It also allows them to review other students' submissions and improve their work based on this feedback.&lt;br /&gt;
&lt;br /&gt;
===Project Description===&lt;br /&gt;
&lt;br /&gt;
In Expertiza, each questionnaire contains many questions, those question may have different types (e.g. checkbox, criterion, etc). When a user fills in a rubric, the responses for each question will become an answer record. The responses of rubrics are stored in answers table in DB. The answer.rb is the model for the answers table in DB. Answer.rb model does not have any test cases and the aim of the project is to write fast, effective and flexible unit test cases that offer maximum code coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Created/Modified===&lt;br /&gt;
*answer_spec.rb&lt;br /&gt;
*factories.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===RSpec===&lt;br /&gt;
====RSpec Introduction====&lt;br /&gt;
RSpec is a testing framework for Ruby for behavior-driven development (BDD) licensed under MIT. It is inspired by JBehave and contains fully integrated JMock based framework which has a very rich and powerful DSL (domain-specific language) which resembles a natural language specification.&lt;br /&gt;
Composed of multiple libraries structured to work together, RSpec provides encapsulated testing via the describe block to specify the behavior of the class and the context for the unit test case.&lt;br /&gt;
&lt;br /&gt;
==== Why RSpec? ====&lt;br /&gt;
RSpec is easy to learn and implement and can be used with other testing tools like Cucumber and Minitest independently. It is extremely powerful for testing states with complicated setup and also helps in tearing down complex code to access the objects required for testing&lt;br /&gt;
RSpec semantics encourage agile thinking and practice and it structures the tests in a more intuitive way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Functions in answers.rb===&lt;br /&gt;
&lt;br /&gt;
'''Function Name : Compute_scores'''&lt;br /&gt;
&lt;br /&gt;
Compute_scores is a function in model answer.rb which gives the average, maximum and minimum scores obtained in a series a responses/assessments. It has two input parameters: List of assessments and questions. The function iterates over each assessment to get the total score of that assessment. If the response or review is invalid, that assessment won’t be considered in the calculation of the score average. After iterating over all assessments, Max score, and Min scores are calculated along with the average score based on the number of valid assessments. Their scores are returned by the function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : Compute_scores'''&lt;br /&gt;
&lt;br /&gt;
Following scenarios are tested:&lt;br /&gt;
&lt;br /&gt;
* To return scores as nil if the input list of assessments is nil. This is to make sure no Null Pointer exceptions are thrown by the code&lt;br /&gt;
*To return a particular score when a single valid assessment is given as an input.&lt;br /&gt;
*To return a particular score when multiple valid assessments are given as an input. This is to test the looping functionality of the method.&lt;br /&gt;
*To return a particular score when invalid assessments are given as an input. The validity and total scores are returned by a mock and not by the actual functions. This is to make the test cases less rigid so that failure of dependent functions do not disrupt the functionality of interface level tests.&lt;br /&gt;
*To return a particular score when invalid flag is nil. Invalid flag can either be 0,1 or nil. Nil situation is tested to prevent NullPointer Exceptions&lt;br /&gt;
*To check if the method get_total_score is called with the right parameters.&lt;br /&gt;
&lt;br /&gt;
This unit test uses a stub and returns a mock value.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Answer.stub(:get_total_score)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is to eliminate tight coupling between compute_scores and get_total_scores. Failure in get_total_scores wouldn't break the compute_scores test cases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Function Name : Get_total_scores'''&lt;br /&gt;
&lt;br /&gt;
This function is called by the Compute_scores method of the answer.rb model to compute the total score of an assessment. The input consists of assessment for which the total score is being calculated and the list of questions being evaluated in the assessment. The method uses questionnaire id from the questions and response id to obtain a score view questionnaire data. This score view is a read-only record. The questionnaire data mainly consists of q1_max_question_score, sum_of_weights and weighted_score. Before calculating the score, the function performs two crucial tasks. &lt;br /&gt;
*Checks if the answer for a scored question is nil. If it is nil or unanswered, the question will be ignored and not counted towards the score of this response.&lt;br /&gt;
* Calls the submission_valid function by passing the response record to set the @invalid flag based on the validity of the response.&lt;br /&gt;
The total score is calculated using the below formula&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(weighted_score / (sum_of_weights * max_question_score)) * 100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any edge cases would return -1 indicating no score&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : Get_total_scores'''&lt;br /&gt;
&lt;br /&gt;
Following scenarios are tested:&lt;br /&gt;
&lt;br /&gt;
*To return an anticipated total score of a single response without any edge cases. Since this function will be called only on one response at a time, there is no need to test for multiple responses at the same time.&lt;br /&gt;
*To return an anticipated total score of a response where nil answer is for a scored question. This is to check if its weight gets removed from the sum_of_weights.&lt;br /&gt;
*To return -1 when the sum of weights becomes 0. This can happen when all the scored questions are unanswered. Return value of -1 is checked at the calling function to ensure if a score is returned or not.&lt;br /&gt;
*To return -1 when weighted_score of questionnaireData is nil&lt;br /&gt;
* To check if submission_valid is called. This method is called to set invalid flag to indicate whether the response entered is valid or not. The validity criteria is explained in the submission_valid? Function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This unit test uses two stubs and returns mock results&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ScoreView.stub(:find_by_sql)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Answer.stub(:where)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is to reduce the outcome of the test to depend on DB calls. For example, in case the connection to DB fails, this unit test would still pass making it less rigid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Function Name : submission_valid?'''&lt;br /&gt;
&lt;br /&gt;
This purpose of this function is to verify the validity of a review based on a deadline.  This function obtains a list of AssignmentDueDate objects  in descending order which is then compared against the current time to determine which deadlines are valid and which ones are not. The flag variable is used to represent whether or not a deadline was available in the previous iteration of the loop. If the flag is set to TRUE and the deadline is less than the current date, then latest_review_phase_start_time is set to this deadline. A list of ResubmissionTime objects is also retrieved from the controller. These objects are then compared against the then latest_review_phase_start_time variable to determine a response. &lt;br /&gt;
&lt;br /&gt;
Observations: The current implementation of the function is bugged. It retrieves a list of sorted AssignmentDueDate objects and proceeds to check if this list is empty. However, instead of exiting if the function if the list is empty, it carries on execution and raises an exception on hitting the for loop. &lt;br /&gt;
&lt;br /&gt;
*Checks if a review is valid or not by comparing its date with a list of deadlines.&lt;br /&gt;
*Returns 1 or 0 depending on validity&lt;br /&gt;
*Current implementation is bugged. Throws an exception if no AssignmentDueDate objects are passed, returns nil if any objects are passed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : submission_valid?'''&lt;br /&gt;
&lt;br /&gt;
Following scenarios are tested:&lt;br /&gt;
&lt;br /&gt;
*Passing valid AssignmentDueDate objects&lt;br /&gt;
*Not passing any AssignmentDueDate objects&lt;br /&gt;
&lt;br /&gt;
When valid AssignmentDueDate objects are passed, stubs are used to create fake AssignmentDueDate Objects and ResubmissionTime objects. These objects are then populated with valid deadline dates and deadline_type values. These values are then supplied when requested by the submission_valid? Function rather than actually calling the function.  The current implementation of this test case expects the program to throw an error when it reaches the for loop. Once this bug is fixed, this test case may be re-written to test a more legitimate test case.&lt;br /&gt;
&lt;br /&gt;
In case an empty list of AssignmentDueDate objects is passed back to the submission_valid?() method. This would cause the function to return nil. When this function is fixed, the following test case may be re-written to test for a more legitimate test-case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This unit test uses two stubs and returns mock results&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AssignmentDueDate.stub_chain(:where, :order)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above stub returns two AssignmentDueDate objects whenever the where() and order() method are chained on AssignmentDueDate.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ResubmissionTime.stub_chain(:where, :order)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above stub returns two ResubmissionTime objects whenever the where() and order() method are chained on ResubmissionTime.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AssignmentDueDate.stub_chain(:where, :order)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This stub is used in the second test case to return nil objects.&lt;br /&gt;
&lt;br /&gt;
the stub_chain method can be used to create stubs where chained methods are expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Function Name : answers_by_question, answers_by_question_for_reviewee,answers_by_question_for_reviewee_in_round'''&lt;br /&gt;
&lt;br /&gt;
These three functions are sql queries that hit the DB to get a output record after a series of selections and joins. SQL queries that hit DB often do not have a high priority when it comes to testing, so the project does not aggressively test these functions. However, these functions are tested to make sure the queries are able to find the right column names and tables successfully. Any change in the table schema would be detected in these test cases. The functionality of these queries are not tested but instead existence of an output is tested. This ensures that answer.rb is able to make a successful db connection and is sync with the latest db schema. Since the function actually hits the DB, mocks can no longer be used, instead active records were created and saved in test db using FactoryGirl gem from the factories.rb. These records are cleared after every test case.&lt;br /&gt;
&lt;br /&gt;
Following factories were used to create records in the table&lt;br /&gt;
*question&lt;br /&gt;
*response_record&lt;br /&gt;
*response_map&lt;br /&gt;
*answer&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : answers_by_question, answers_by_question_for_reviewee,answers_by_question_for_reviewee_in_round'''&lt;br /&gt;
&lt;br /&gt;
The factories are created such a way that the query would return an output and the tests will pass if the query returns a non nil record. The functionality of these functions would be tested by the integration tests of the controller&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Validation and Dependency  Rspec Test'''&lt;br /&gt;
&lt;br /&gt;
Apart from testing functions, the models are also tested for validations and external dependencies. Model answer.rb does not have any validations but does have a dependency on question.rb. Answer belongs_to question and this was tested using a simple dependency rspec test.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it { should belong_to(:question) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Rspec Test Results'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1 deprecation warning total&lt;br /&gt;
&lt;br /&gt;
Finished in 12.39 seconds (files took 11.25 seconds to load)&lt;br /&gt;
17 examples, 0 failures&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 37447&lt;br /&gt;
&lt;br /&gt;
Coverage report generated for RSpec to /home/root/expertiza/coverage. 998 / 3919 LOC (25.47%) covered.&lt;br /&gt;
[Coveralls] Outside the CI environment, not sending data.&lt;br /&gt;
root@ubuntu:~/expertiza$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1670._Unit_tests_for_answers.rb&amp;diff=103396</id>
		<title>CSC/ECE 517 Fall 2016/E1670. Unit tests for answers.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1670._Unit_tests_for_answers.rb&amp;diff=103396"/>
		<updated>2016-10-29T00:12:56Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1670 . Unit tests for answers.rb==&lt;br /&gt;
&lt;br /&gt;
This wiki page is for the description of changes made under E1670 OSS assignment for Fall 2016, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
&lt;br /&gt;
Expertiza is an Open Source web application developed on Ruby On Rails platform. It is a platform which allows students to take assignments posted by the course instructors. Expertiza allows students to select assignment topics, form teams and submit their work. It also allows them to review other students' submissions and improve their work based on this feedback.&lt;br /&gt;
&lt;br /&gt;
===Project Description===&lt;br /&gt;
&lt;br /&gt;
In Expertiza, each questionnaire contains many questions, those question may have different types (e.g. checkbox, criterion, etc). When a user fills in a rubric, the responses for each question will become an answer record. The responses of rubrics are stored in answers table in DB. The answer.rb is the model for the answers table in DB. Answer.rb model does not have any test cases and the aim of the project is to write fast, effective and flexible unit test cases that offer maximum code coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Created/Modified===&lt;br /&gt;
*answer_spec.rb&lt;br /&gt;
*factories.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===RSpec===&lt;br /&gt;
====RSpec Introduction====&lt;br /&gt;
RSpec is a testing framework for Ruby for behavior-driven development (BDD) licensed under MIT. It is inspired by JBehave and contains fully integrated JMock based framework which has a very rich and powerful DSL (domain-specific language) which resembles a natural language specification.&lt;br /&gt;
Composed of multiple libraries structured to work together, RSpec provides encapsulated testing via the describe block to specify the behavior of the class and the context for the unit test case.&lt;br /&gt;
&lt;br /&gt;
==== Why RSpec? ====&lt;br /&gt;
RSpec is easy to learn and implement and can be used with other testing tools like Cucumber and Minitest independently. It is extremely powerful for testing states with complicated setup and also helps in tearing down complex code to access the objects required for testing&lt;br /&gt;
RSpec semantics encourage agile thinking and practice and it structures the tests in a more intuitive way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Functions in answers.rb===&lt;br /&gt;
&lt;br /&gt;
'''Function Name : Compute_scores'''&lt;br /&gt;
&lt;br /&gt;
Compute_scores is a function in model answer.rb which gives the average, maximum and minimum scores obtained in a series a responses/assessments. It has two input parameters: List of assessments and questions. The function iterates over each assessment to get the total score of that assessment. If the response or review is invalid, that assessment won’t be considered in the calculation of the score average. After iterating over all assessments, Max score, and Min scores are calculated along with the average score based on the number of valid assessments. Their scores are returned by the function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : Compute_scores'''&lt;br /&gt;
&lt;br /&gt;
Following scenarios are tested:&lt;br /&gt;
&lt;br /&gt;
* To return scores as nil if the input list of assessments is nil. This is to make sure no Null Pointer exceptions are thrown by the code&lt;br /&gt;
*To return a particular score when a single valid assessment is given as an input.&lt;br /&gt;
*To return a particular score when multiple valid assessments are given as an input. This is to test the looping functionality of the method.&lt;br /&gt;
*To return a particular score when invalid assessments are given as an input. The validity and total scores are returned by a mock and not by the actual functions. This is to make the test cases less rigid so that failure of dependent functions do not disrupt the functionality of interface level tests.&lt;br /&gt;
*To return a particular score when invalid flag is nil. Invalid flag can either be 0,1 or nil. Nil situation is tested to prevent NullPointer Exceptions&lt;br /&gt;
*To check if the method get_total_score is called with the right parameters.&lt;br /&gt;
&lt;br /&gt;
This unit test uses a stub and returns a mock value.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Answer.stub(:get_total_score)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is to eliminate tight coupling between compute_scores and get_total_scores. Failure in get_total_scores wouldn't break the compute_scores test cases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Function Name : Get_total_scores'''&lt;br /&gt;
&lt;br /&gt;
This function is called by the Compute_scores method of the answer.rb model to compute the total score of an assessment. The input consists of assessment for which the total score is being calculated and the list of questions being evaluated in the assessment. The method uses questionnaire id from the questions and response id to obtain a score view questionnaire data. This score view is a read-only record. The questionnaire data mainly consists of q1_max_question_score, sum_of_weights and weighted_score. Before calculating the score, the function performs two crucial tasks. &lt;br /&gt;
*Checks if the answer for a scored question is nil. If it is nil or unanswered, the question will be ignored and not counted towards the score of this response.&lt;br /&gt;
* Calls the submission_valid function by passing the response record to set the @invalid flag based on the validity of the response.&lt;br /&gt;
The total score is calculated using the below formula&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(weighted_score / (sum_of_weights * max_question_score)) * 100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any edge cases would return -1 indicating no score&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : Get_total_scores'''&lt;br /&gt;
&lt;br /&gt;
Following scenarios are tested:&lt;br /&gt;
&lt;br /&gt;
*To return an anticipated total score of a single response without any edge cases. Since this function will be called only on one response at a time, there is no need to test for multiple responses at the same time.&lt;br /&gt;
*To return an anticipated total score of a response where nil answer is for a scored question. This is to check if its weight gets removed from the sum_of_weights.&lt;br /&gt;
*To return -1 when the sum of weights becomes 0. This can happen when all the scored questions are unanswered. Return value of -1 is checked at the calling function to ensure if a score is returned or not.&lt;br /&gt;
*To return -1 when weighted_score of questionnaireData is nil&lt;br /&gt;
* To check if submission_valid is called. This method is called to set invalid flag to indicate whether the response entered is valid or not. The validity criteria is explained in the submission_valid? Function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This unit test uses two stubs and returns mock results&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ScoreView.stub(:find_by_sql)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Answer.stub(:where)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is to reduce the outcome of the test to depend on DB calls. For example, in case the connection to DB fails, this unit test would still pass making it less rigid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Function Name : submission_valid?'''&lt;br /&gt;
&lt;br /&gt;
This purpose of this function is to verify the validity of a review based on a deadline.  This function obtains a list of AssignmentDueDate objects  in descending order which is then compared against the current time to determine which deadlines are valid and which ones are not. The flag variable is used to represent whether or not a deadline was available in the previous iteration of the loop. If the flag is set to TRUE and the deadline is less than the current date, then latest_review_phase_start_time is set to this deadline. A list of ResubmissionTime objects is also retrieved from the controller. These objects are then compared against the then latest_review_phase_start_time variable to determine a response. &lt;br /&gt;
&lt;br /&gt;
Observations: The current implementation of the function is bugged. It retrieves a list of sorted AssignmentDueDate objects and proceeds to check if this list is empty. However, instead of exiting if the function if the list is empty, it carries on execution and raises an exception on hitting the for loop. &lt;br /&gt;
&lt;br /&gt;
*Checks if a review is valid or not by comparing its date with a list of deadlines.&lt;br /&gt;
*Returns 1 or 0 depending on validity&lt;br /&gt;
*Current implementation is bugged. Throws an exception if no AssignmentDueDate objects are passed, returns nil if any objects are passed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : submission_valid?'''&lt;br /&gt;
&lt;br /&gt;
Following scenarios are tested:&lt;br /&gt;
&lt;br /&gt;
*Passing valid AssignmentDueDate objects&lt;br /&gt;
*Not passing any AssignmentDueDate objects&lt;br /&gt;
&lt;br /&gt;
When valid AssignmentDueDate objects are passed, stubs are used to create fake AssignmentDueDate Objects and ResubmissionTime objects. These objects are then populated with valid deadline dates and deadline_type values. These values are then supplied when requested by the submission_valid? Function rather than actually calling the function.  The current implementation of this test case expects the program to throw an error when it reaches the for loop. Once this bug is fixed, this test case may be re-written to test a more legitimate test case.&lt;br /&gt;
&lt;br /&gt;
In case an empty list of AssignmentDueDate objects is passed back to the submission_valid?() method. This would cause the function to return nil. When this function is fixed, the following test case may be re-written to test for a more legitimate test-case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This unit test uses two stubs and returns mock results&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AssignmentDueDate.stub_chain(:where, :order)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above stub returns two AssignmentDueDate objects whenever the where() and order() method are chained on AssignmentDueDate.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ResubmissionTime.stub_chain(:where, :order)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above stub returns two ResubmissionTime objects whenever the where() and order() method are chained on ResubmissionTime.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AssignmentDueDate.stub_chain(:where, :order)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This stub is used in the second test case to return nil objects.&lt;br /&gt;
&lt;br /&gt;
the stub_chain method can be used to create stubs where chained methods are expected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Function Name : answers_by_question, answers_by_question_for_reviewee,answers_by_question_for_reviewee_in_round'''&lt;br /&gt;
&lt;br /&gt;
These three functions are sql queries that hit the DB to get a output record after a series of selections and joins. SQL queries that hit DB often do not have a high priority when it comes to testing, so the project does not aggressively test these functions. However, these functions are tested to make sure the queries are able to find the right column names and tables successfully. Any change in the table schema would be detected in these test cases. The functionality of these queries are not tested but instead existence of an output is tested. This ensures that answer.rb is able to make a successful db connection and is sync with the latest db schema. Since the function actually hits the DB, mocks can no longer be used, instead active records were created and saved in test db using FactoryGirl gem from the factories.rb. These records are cleared after every test case.&lt;br /&gt;
&lt;br /&gt;
Following factories were used to create records in the table&lt;br /&gt;
*question&lt;br /&gt;
*response_record&lt;br /&gt;
*response_map&lt;br /&gt;
*answer&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : answers_by_question, answers_by_question_for_reviewee,answers_by_question_for_reviewee_in_round'''&lt;br /&gt;
&lt;br /&gt;
The factories are created such a way that the query would return an output and the tests will pass if the query returns a non nil record. The functionality of these functions would be tested by the integration tests of the controller&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Validation and Dependency  Rspec Test'''&lt;br /&gt;
&lt;br /&gt;
Apart from testing functions, the models are also tested for validations and external dependencies. Model answer.rb does not have any validations but does have a dependency on question.rb. Answer belongs_to question and this was tested using a simple dependency rspec test.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it { should belong_to(:question) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Rspec Test Results'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1 deprecation warning total&lt;br /&gt;
&lt;br /&gt;
Finished in 12.39 seconds (files took 11.25 seconds to load)&lt;br /&gt;
17 examples, 0 failures&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 37447&lt;br /&gt;
&lt;br /&gt;
Coverage report generated for RSpec to /home/attili/expertiza/coverage. 998 / 3919 LOC (25.47%) covered.&lt;br /&gt;
[Coveralls] Outside the CI environment, not sending data.&lt;br /&gt;
root@ubuntu:~/expertiza$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1670._Unit_tests_for_answers.rb&amp;diff=102701</id>
		<title>CSC/ECE 517 Fall 2016/E1670. Unit tests for answers.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1670._Unit_tests_for_answers.rb&amp;diff=102701"/>
		<updated>2016-10-28T05:24:40Z</updated>

		<summary type="html">&lt;p&gt;Arattili: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1670 . Unit tests for answers.rb==&lt;br /&gt;
&lt;br /&gt;
This wiki page is for the description of changes made under E1670 OSS assignment for Fall 2016, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
&lt;br /&gt;
Expertiza is an Open Source web application developed on Ruby On Rails platform. It is a platform which allows students to take assignments posted by the course instructors. Expertiza allows students to select assignment topics, form teams and submit their work. It also allows them to review other students' submissions and improve their work based on this feedback.&lt;br /&gt;
&lt;br /&gt;
===Project Description===&lt;br /&gt;
&lt;br /&gt;
In Expertiza, each questionnaire contains many questions, those question may have different types (e.g. checkbox, criterion, etc). When a user fills in a rubric, the responses for each question will become an answer record. The responses of rubrics are stored in answers table in DB. The answer.rb is the model for the answers table in DB. Answer.rb model does not have any test cases and the aim of the project is to write fast, effective and flexible unit test cases that offer maximum code coverage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Functions in answers.rb===&lt;br /&gt;
&lt;br /&gt;
'''Function Name : Compute_scores'''&lt;br /&gt;
&lt;br /&gt;
Compute_scores is a function in model answer.rb which gives the average, maximum and minimum scores obtained in a series a responses/assessments. It has two input parameters: List of assessments and questions. The function iterates over each assessment to get the total score of that assessment. If the response or review is invalid, that assessment won’t be considered in the calculation of the score average. After iterating over all assessments, Max score, and Min scores are calculated along with the average score based on the number of valid assessments. Their scores are returned by the function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : Compute_scores'''&lt;br /&gt;
&lt;br /&gt;
Following scenarios are tested:&lt;br /&gt;
&lt;br /&gt;
* To return scores as nil if the input list of assessments is nil. This is to make sure no Null Pointer exceptions are thrown by the code&lt;br /&gt;
*To return a particular score when a single valid assessment is given as an input.&lt;br /&gt;
*To return a particular score when multiple valid assessments are given as an input. This is to test the looping functionality of the method.&lt;br /&gt;
*To return a particular score when invalid assessments are given as an input. The validity and total scores are returned by a mock and not by the actual functions. This is to make the test cases less rigid so that failure of dependent functions do not disrupt the functionality of interface level tests.&lt;br /&gt;
*To return a particular score when invalid flag is nil. Invalid flag can either be 0,1 or nil. Nil situation is tested to prevent NullPointer Exceptions&lt;br /&gt;
*To check if the method get_total_score is called with the right parameters.&lt;br /&gt;
&lt;br /&gt;
This unit tes uses a stub and returns a mock value.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Answer.stub(:get_total_score)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is to eliminate tight coupling between compute_scores and get_total_scores. Failure in get_total_scores would'nt break the compute_scores test cases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Function Name : Get_total_scores'''&lt;br /&gt;
&lt;br /&gt;
This function is called by the Compute_scores method of the answer.rb model to compute the total score of an assessment. The input consists of assessment for which the total score is being calculated and the list of questions being evaluated in the assessment. The method uses questionnaire id from the questions and response id to obtain a score view questionnaire data. This score view is a read-only record. The questionnaire data mainly consists of q1_max_question_score, sum_of_weights and wieghted_score. Before calculating the score, the function performs two crucial tasks. &lt;br /&gt;
*Checks if the answer for a scored question is nil. If it is nil or unanswered, the question will be ignored and not counted towards the score of this response.&lt;br /&gt;
* Calls the subsission_valid function by passing the response record to set the @invalid flag based on the validity of the response.&lt;br /&gt;
The total score is calculated using the below formula&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(weighted_score / (sum_of_weights * max_question_score)) * 100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any edge cases would return -1 indicating no score&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : Get_total_scores'''&lt;br /&gt;
&lt;br /&gt;
Following scenarios are tested:&lt;br /&gt;
&lt;br /&gt;
*To return an anticipated total score of a single response without any edge cases. Since this function will be called only on one response at a time, there is no need to test for multiple responses at the same time.&lt;br /&gt;
*To return an anticipated total score of a response where nil answer is for a scored question. This is to check if its weight gets removed from the sum_of_weights.&lt;br /&gt;
*To return -1 when the sum of weights becomes 0. This can happen when all the scored questions are unanswered. Return value of -1 is checked at the calling function to ensure if a score is returned or not.&lt;br /&gt;
*To return -1 when weighted_score of questionnaireData is nil&lt;br /&gt;
* To check if submission_valid is called. This method is called to set invalid flag to indicate whether the response entered is valid or not. The validity criteria is explained in the submission_valid? Function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This unit test uses two stubs and returns mock results&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ScoreView.stub(:find_by_sql)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Answer.stub(:where)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is to reduce the outcome of the test to depend on DB calls. For example, in case the connection to DB fails, this unit test would still pass making it less rigid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Function Name : submission_valid?'''&lt;br /&gt;
&lt;br /&gt;
This purpose of this function is to verify the validity of a review based on a deadline.  This function obtains a list of AssignmentDueDate objects  in decending order which are then compared against the current time to determine which deadlines are valid and which ones are not. The flag variable is used to represent whether or not a deadline was available in the previous iteration of the loop. If the flag is set to TRUE and the deadline is less than current date, then latest_review_phase_start_time is set to this deadline. A list of ResubmissionTime objects are also retrieved from the controller. These objects are then compared against the then latest_review_phase_start_time variable to determine a response. &lt;br /&gt;
&lt;br /&gt;
Observations: The current implementation of the function is bugged. It retrieves a list of sorted AssignmentDueDate objects and proceeds to check if this list is empty. However, instead of exiting if the function if the list is empty, it carries on execution and raises an exception on hitting the for loop. &lt;br /&gt;
&lt;br /&gt;
*Checks if a review is valid or not by comparing its date with a list of deadlines.&lt;br /&gt;
*Returns 1 or 0 depending on validity&lt;br /&gt;
*Current implementation is bugged. Throws an exception if no AssignmentDueDate objects are passed, returns nil if any objects are passed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rspec Unit Test : submission_valid?'''&lt;br /&gt;
&lt;br /&gt;
Following scenarios are tested:&lt;br /&gt;
&lt;br /&gt;
*Passing valid AssignmentDueDate objects&lt;br /&gt;
*Not passing any AssignmentDueDate objects&lt;br /&gt;
&lt;br /&gt;
When valid AssignmentDueDate objects are passed, stubs are used to create fake AssignmentDueDate Objects and ResubmissionTime objects. These objects are then populated with valid deadline dates and deadline_type values. These values are then supplied when requested by the submission_valid? Function rather than actually calling the function.  The current implementation of this test case expects the program to throw an error when it reaches the for loop. Once this bug is fixed, this test case may be re-written to test a more legitimate test case.&lt;br /&gt;
&lt;br /&gt;
In case an empty list of AssignmentDueDate objects is passed back to the submission_valid?() method. This would cause the function to return nil. When this function is fixed, the following test case may be re-written to test for a more legitimate test-case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This unit test uses two stubs and returns mock results&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AssignmentDueDate.stub_chain(:where, :order).and_return(due_date1, due_date2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above stub returns two AssignmentDueDate objects whenever the where() and order() method are chained on AssignmentDueDate.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ResubmissionTime.stub_chain(:where, :order).and_return(ResubmissionTime1, ResubmissionTime2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above stub returns two ResubmissionTime objects whenever the where() and order() method are chained on ResubmissionTime.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AssignmentDueDate.stub_chain(:where, :order).and_return(nil)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This stub is used in the second test case to return nil objects.&lt;br /&gt;
&lt;br /&gt;
the stub_chain method can be used to create stubs where chained methods are expected.&lt;/div&gt;</summary>
		<author><name>Arattili</name></author>
	</entry>
</feed>