CSC/ECE 517 Fall 2013/oss E810 aas
E810 Regularize staggered-deadline assignments
This page provides a description of the OSS project conducted on Expertiza which was done as the part of the Object Oriented Languages and Systems coursework.
Introduction to Expertiza
Expertiza is a project developed using Ruby on Rails platform. It supports peer review, team assignments and submission of projects using any method like URL, wiki page or even code. It is open source application and the code can be cloned from github.
It is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities to manage peer reviews in coursework. The source code can be forked from github and cloned for performing modifications. The Expertiza environment is already set up in NC State's VCL image "Ruby on Rails". If you have access, this is quickest way to get a development environment running for Expertiza. See the Expertiza wiki(provide hyperlink) on developing Expertiza on the VCL.
Problem Statement
According to the existing code flow, Assignment deadlines belonged to two categories i.e. Staggered Deadlines and Deadlines (Normal Due Date). If an Assignment has different topics which have dependencies i.e. if Assignment A has two topics Topic A and Topic B , where Topic A can have deadline before Topic B, and therefore the Due Date of Assignment A is dependent on deadlines of Topics designed in that particular assignment. Hence these deadlines are called Staggered Deadlines.
Pre-refactored code had various check statements for staggered and normal deadlines, which had to eliminated and structured in a way that with minimum checks we could distinguish between Staggered and Normal Due Dates. This required refactoring and restructuring of the whole functionality where we reduce these checks by distributing code into separate actions.
Re-factored Code Cases
Case 1 : Refactoring in sign_up_sheet_controller.rb
Current Scenario
Different method definitions for setting up staggered and non-staggered assignment sign up sheet.
- This displays a page that lists all the available topics for an assignment.
#Contains links that let an admin or Instructor edit, delete, view enrolled/waitlisted members for each topic #Also contains links to delete topics and modify the deadlines for individual topics. Staggered means that different topics #can have different deadlines. def add_signup_topics_staggered load_add_signup_topics(params[:id])
@review_rounds = Assignment.find(params[:id]).get_review_rounds @topics = SignUpTopic.find_all_by_assignment_id(params[:id])
#Use this until you figure out how to initialize this array @duedates = SignUpTopic.find_by_sql("SELECT s.id as topic_id FROM sign_up_topics s WHERE s.assignment_id = " + params[:id].to_s)
if !@topics.nil? i=0 @topics.each { |topic|
@duedates[i]['t_id'] = topic.id @duedates[i]['topic_identifier'] = topic.topic_identifier @duedates[i]['topic_name'] = topic.topic_name
for j in 1..@review_rounds if j == 1 duedate_subm = TopicDeadline.find_by_topic_id_and_deadline_type_id(topic.id, DeadlineType.find_by_name('submission').id) duedate_rev = TopicDeadline.find_by_topic_id_and_deadline_type_id(topic.id, DeadlineType.find_by_name('review').id) else duedate_subm = TopicDeadline.find_by_topic_id_and_deadline_type_id_and_round(topic.id, DeadlineType.find_by_name('resubmission').id, j) duedate_rev = TopicDeadline.find_by_topic_id_and_deadline_type_id_and_round(topic.id, DeadlineType.find_by_name('rereview').id, j) end if !duedate_subm.nil? && !duedate_rev.nil? @duedates[i]['submission_'+ j.to_s] = DateTime.parse(duedate_subm['due_at'].to_s).strftime("%Y-%m-%d %H:%M:%S") @duedates[i]['review_'+ j.to_s] = DateTime.parse(duedate_rev['due_at'].to_s).strftime("%Y-%m-%d %H:%M:%S") else #the topic is new. so copy deadlines from assignment set_of_due_dates = DueDate.find_all_by_assignment_id(params[:id]) set_of_due_dates.each { |due_date| create_topic_deadline(due_date, 0, topic.id) } # code execution would have hit the else part during review_round one. So we'll do only round one duedate_subm = TopicDeadline.find_by_topic_id_and_deadline_type_id(topic.id, DeadlineType.find_by_name('submission').id) duedate_rev = TopicDeadline.find_by_topic_id_and_deadline_type_id(topic.id, DeadlineType.find_by_name('review').id) @duedates[i]['submission_'+ j.to_s] = DateTime.parse(duedate_subm['due_at'].to_s).strftime("%Y-%m-%d %H:%M:%S") @duedates[i]['review_'+ j.to_s] = DateTime.parse(duedate_rev['due_at'].to_s).strftime("%Y-%m-%d %H:%M:%S") end
end duedate_subm = TopicDeadline.find_by_topic_id_and_deadline_type_id(topic.id, DeadlineType.find_by_name('metareview').id) if !duedate_subm.nil? @duedates[i]['submission_'+ (@review_rounds+1).to_s] = DateTime.parse(duedate_subm['due_at'].to_s).strftime("%Y-%m-%d %H:%M:%S") else @duedates[i]['submission_'+ (@review_rounds+1).to_s] = nil end i = i + 1 } end end