User:Juhi1296/sandbox

This wiki page is for the description of changes made under E1843 OSS assignment for Fall 2018, CSC/ECE 517.

About Expertiza
Expertiza is an open source project based on Ruby on Rails framework and the code is available on Github. Expertiza allows the instructor to create new assignments as well as edit new or existing assignments. Instructors can also create a list of topics the students can sign up for and specify deadlines for completion of various tasks. Students can form teams in Expertiza to work on various projects and assignments as well as peer review other students' submissions. Expertiza supports submission across various document types, including the URLs Wiki pages.

Issues in the Current Project

 * 1) There is no deadline that specifies when a team can drop their topics. Due to this, few problems occur: The team might drop a topic later on which is close to the submission date and this results in topic not being assigned to any other team on time such that they can submit their assignment. Also, if one team was wait listed for the same topic which the other team dropped closer to the submission deadline, then the first team will be assigned to the dropped topic which is not desirable as they might be working on their assigned topic for long time.
 * 2) There are different topics on which students can work during different times. This type of assignment is known as Staggered- deadline assignment in which different topics have different submission and review deadlines. For these assignments too, there is a need for "Drop Topics Deadline". In the current implementation, the drop topic deadline is same for all the topics in a Staggered Deadline assignment which is not desirable.

Corrections made in the New Project

 * 1) The instructor can specify a Drop Topic deadline date now. After a drop topic deadline passes, the "X" in the Sign-Up sheet disables so that the student cannot drop the topic and the waitlist gets cleared.
 * 2) Staggered deadline assignments now have different drop deadlines for different topics in that assignment.

Files modified in Current Project

 * 1) app/controllers/assignments_controller.rb
 * 2) app/controllers/sign_up_sheet_controller.rb
 * 3) app/models/student_task.rb
 * 4) app/views/assignments/edit.html.erb
 * 5) app/views/sign_up_sheet/_add_signup_topics_staggered.html.erb
 * 6) app/views/sign_up_sheet/_due_dates.html.erb

Current Implementation

 * Clearing the waitlist after Drop Deadline passes is implemented in sign_up_sheet_controller.rb where it is checked if the current time is greater than the time mentioned in    Drop deadline. If the deadline has been passed, the 'update_is_waitlisted' method of SignedUpTeam model is called to delete all the waitlisted teams. The code snippets for the changes made are attached below:

(i) app/controllers/sign_up_sheet_controller.rb

if !topic_id1.nil? and !@drop_topic_deadline1.nil? and Time.now > @drop_topic_deadline1.due_at

SignedUpTeam.update_is_waitlisted(topic_id1.topic_id,team_id) end

(ii) The 'update_is_waitlisted' method is implemented in app/models/signed_up_team.rb as follows:

def self.update_is_waitlisted(topic_id, team_id)

waitlisted_teams = SignedUpTeam.where(topic_id: topic_id, team_id: team_id)

waitlisted_teams.each do |team|

if(team.is_waitlisted == true)

SignedUpTeam.delete(team.id)

team.save

end

end

end


 * For a Staggered - deadline assignment, each topic will have a different Drop deadline which has been implemented in app/controllers/assignments_controller.rb and  app/controllers/sign_up_sheet_controller.rb by first checking if the assignment type is staggered and then retrieving the Drop Deadlines corresponding to each topic from 'TopicDueDate' table. The 'assignments' and 'due_date' views are also updated to include 'Drop topic deadline' column and Drop deadline date in the timeline present in the student view. Following files have been changed to implement this functionality:

(i)  app/controllers/assignments_controller.rb

@assignment_submission_due_dates = @due_date_all.select {|due_date| due_date.deadline_type_id == DeadlineHelper::DEALINE_TYPE_SUBMISSION }

@assignment_review_due_dates = @due_date_all.select {|due_date| due_date.deadline_type_id == DeadlineHelper::DEALINE_TYPE_REVIEW}                                                                                                     @assignment_drop_topic_due_dates = @due_date_all.select {|due_date| due_date.deadline_type_id == DeadlineHelper::DEADLINE_TYPE_DROP_TOPIC }

(ii)   app/controllers/sign_up_sheet_controller.rb

@drop_topic_deadline1 = @assignment.due_dates.find_by(deadline_type_id: 6)

topic_id1 = SignedUpTeam.where(team_id: team_id).first

if @assignment.staggered_deadline?

@drop_topic_deadline1 = TopicDueDate.where(parent_id: topic_id1.topic_id, deadline_type_id: 6).first rescue nil end

due_dates = params[:due_date]

topics = SignUpTopic.where(assignment_id: params[:assignment_id])

review_rounds = assignment.num_review_rounds

topics.each_with_index do |topic, index|

for i in 1..review_rounds

@topic_drop_topic_due_date = due_dates[topics[index].id.to_s + '_drop_topic_' + i.to_s + '_due_date']

if assignment.due_dates.select {|due_date| due_date.deadline_type_id == 6 }.nil?

@assignment_drop_topic_due_date = DateTime.parse(@assignment_drop_topic_due_dates[i - 1].due_at.to_s).strftime("%Y-%m-%d %H:%M")

end

end

(iii) app/helpers/sign_up_sheet_helper.rb

if assignment_due_dates.length == 0

assignment_due_dates = @assignment_submission_due_dates

end

(iv) app/models/student_task.rb

def self.get_due_date_data(assignment, timeline_list, participant)

if assignment.staggered_deadline?

team_id = participant.team.try(:id)

topic_id1 = SignedUpTeam.where(team_id: team_id).first

if !topic_id1.nil?

topic_due_date = TopicDueDate.where(parent_id: topic_id1.topic_id, deadline_type_id: 6).first rescue nil

timeline = {label: ('Drop Topic Deadline').humanize}

timeline[:updated_at] = topic_due_date.due_at.strftime('%a, %d %b %Y %H:%M')

timeline_list << timeline

end

end

assignment.due_dates.each do |dd|

timeline = {label: (dd.deadline_type.name + ' Deadline').humanize}

unless dd.due_at.nil?

timeline[:updated_at] = dd.due_at.strftime('%a, %d %b %Y %H:%M')

timeline_list << timeline

end

end

end

(v) app/views/assignments/edit.html.erb

<% if @assignment_form.assignment.staggered_deadline == true %>

<%= render partial: '/sign_up_sheet/add_signup_topics_staggered', locals: {review_rounds: @review_rounds, assignment_submission_due_dates:                  @assignment_submission_due_dates, assignment_review_due_dates: @assignment_review_due_dates, assignment_drop_topic_due_dates: @assignment_drop_topic_due_dates} %>

<% else %>

<%= render '/sign_up_sheet/add_signup_topics' %>

<% end %>

(vi) app/views/sign_up_sheet/_add_signup_topics_staggered.html.erb

<%= form_tag :controller => 'sign_up_sheet', :action => 'save_topic_deadlines', :assignment_id => @assignment.id do %>

<%= render :partial => '/sign_up_sheet/due_dates', :locals => {review_rounds: review_rounds, assignment_submission_due_dates: assignment_submission_due_dates, assignment_review_due_dates: assignment_review_due_dates, assignment_drop_topic_due_dates: assignment_drop_topic_due_dates} %>

<% end %>

(vii) app/views/sign_up_sheet/_due_dates.html.erb

Drop deadline

<%for i in 2..review_rounds%>

<%= @assignment.sign_up_topics[i].topic_name %>

<% for review_round in 1..review_rounds %>

<% topic_id = @assignment.sign_up_topics[i].id %>

<%if review_round == 1 %>

<%= text_field :due_date, (topic_id.to_s + '_drop_topic_' + review_round.to_s + '_due_date').to_s, size: 20, value:          check_topic_due_date_value(assignment_drop_topic_due_dates, topic_id, 6, review_round) %>

<%= text_field :due_date, (topic_id.to_s + '_submission_' + review_round.to_s + '_due_date').to_s, size: 20, value: check_topic_due_date_value(assignment_submission_due_dates, topic_id, 1, review_round) %>

<%= text_field :due_date, (topic_id.to_s + '_review_' + review_round.to_s + '_due_date').to_s, size: 20, value: check_topic_due_date_value(assignment_review_due_dates, topic_id, 2, review_round) %>

<%else%>

<%= text_field :due_date, (topic_id.to_s + '_submission_' + review_round.to_s + '_due_date').to_s, size: 20, value: check_topic_due_date_value(assignment_submission_due_dates, topic_id, 1, review_round) %>

<%= text_field :due_date, (topic_id.to_s + '_review_' + review_round.to_s + '_due_date').to_s, size: 20, value: check_topic_due_date_value(assignment_review_due_dates, topic_id, 2, review_round) %> <%end%> <%end%>

<%end%>