CSC/ECE 517 Fall 2013/oss E810 aas: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 55: Line 55:
       #Function call to set up due dates
       #Function call to set up due dates
       assignment_due_date
       assignment_due_date
 
     
       #Render a view different for staggered deadlines assignment from the add_sign_up.html.erb
       #Render a view different for staggered deadlines assignment from the add_sign_up.html.erb
       render "add_signup_topics_staggered"
       render "add_signup_topics_staggered"

Revision as of 01:15, 31 October 2013

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 provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on Remote Servers and Wiki submissions. It is open source application and the code can be cloned from github. This application provides an efficient way to manage assignments, grades and reviews. This makes the process easier and faster when the class strength is large.

Expertiza is supported by National Science Foundation under Grant No. 0536558. Additional funding from the NCSU Learning in a Technology-Rich Environment (LITRE) program, the NCSU Faculty Center for Teaching and Learning, the NCSU STEM Initiative, and the Center for Advanced Computing and Communication.

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. On the other hand, If Assignment A has Topic A and Topic B, but they all have the same deadlines i.e. there is no dependency on each other then that's Normal Due Date scenario. In this case an Assignment may or may not have separate Topics.

Original 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.

method:add_signup_topics_staggered
This method lists all the available topics for an assignment and allows admin to set due dates for assignment.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])
   
   #below functionality finds allows to set due dates for topics of assignment
   @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|
     ......
     i = i + 1
     }
   end
 end

method:add_signup_topics
It is similar to the above function except that all the topics and review/submission rounds have the similar deadlines.

 def add_signup_topics
   load_add_signup_topics(params[:id])
 end

After Changes

We have redundant code in two methods so we merged add_signup_topics_staggered and add_signup_topics into add_signup_topics. The action calls single method for both type of assignments and renders views based on condition of staggered or non-staggered assignment.

def add_signup_topics
   load_add_signup_topics(params[:id])
   if @assignment.staggered_deadline ==true
      @review_rounds = Assignment.find(params[:id]).get_review_rounds
      @topics = SignUpTopic.find_all_by_assignment_id(params[:id])
      
      #Function call to set up due dates
      assignment_due_date
      
      #Render a view different for staggered deadlines assignment from the add_sign_up.html.erb
      render "add_signup_topics_staggered"
  end
end

Case 2 : Method Extraction

Case 3 : Modularize Code in application.rb

Case 4 : DeadCode Elimination in sign_up_sheet_controller.rb

Additional Learning and Future Work