CSC/ECE 517 Fall 2016/E1648

From Expertiza_Wiki
Revision as of 08:20, 29 October 2016 by Stiruma (talk | contribs) (→‎New Implementation: changed format)
Jump to navigation Jump to search

E1648. Adding past due assignments to the task list

This page provides a description of the Expertiza based OSS project for Fall 2016.



About Expertiza

Expertiza is an open source project based on Ruby on Rails framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.

Problem Statement

The following tasks required completion in this project:

  • Adding past due assignments to the task list.
  • Highlighting the next immediate due date on the assignment list.
  • Correcting the stage deadline of finished assignments.

Current Implementation

Functionality
  • Assignments that are past due are not present in the task list
The assignments that the user is a participant of and are past the deadline but not yet completed are not part of the task list of the user. Currently only tasks that are not yet started by the user are being shown in the task list.
  • Next immediate due date
As per the current implementation, it is hard to pick the when and which assignment has the next immediate due.
  • Stage deadline of a finished assignment
According to the existing implementation, the stage deadline of any finished assignment is being shown as one year from the current time which is misleading from the actual final stage deadline of that assignment.
Problems and Solutions
  • Problem 1:next_due_date is being assigned string value instead of DueDate object
While finding the current stage of the assignment, the next due date returned from the DueDate model currently returns nil for the assignments which have their due dates past the current time. Then, if the next due date is found to be nil or 'Finished' it is being assigned the value 'Finished'. In the list.html.erb of the student_task view, the stage deadline of the student task for an assignment is fetched as the due_at attribute of the next due date object. As the finished assignments have a next due date as a string they are being caught as an exception and rescued by showing the stage deadline as an year from the current time.
  • Problem 2:
While fetching next_due_date from the DueDate model, it returns next due date from the assignments which have due dates greater than current time. If the due date is past, next due date is nil. The past due dates are not being retrieved in case if the next due date is nil.
  • Solution:If the next_due_date of an assignment is found to be nil while finding its current stage, its past_due_date is retrieved and name of the deadline type is looked up from the DeadlineTypes model with the deadline_type_id attribute of the past_due_date.

New Implementation

  • The method find_current_stage looks up for the past_due_date if the next_due_date is nil and returns it. Else it will return the found next_due_date.

 def find_current_stage(topic_id = nil)
   next_due_date = DueDate.get_next_due_date(self.id, topic_id)
   next_due_date.nil? ? DueDate.get_past_due_date(self.id, topic_id) : next_due_date
 end
  • The get_current_stage method returns the name of the deadline type from the DeadlineType controller with the deadline_type_id key. For this the deadline type

'Finished' is maintained in the deadline_types table.

 def get_current_stage(topic_id=nil)
   return 'Unknown' if topic_id.nil? and self.staggered_deadline?
   due_date = find_current_stage(topic_id)
   (due_date == nil || due_date == 'Finished') ? 'Finished' : DeadlineType.find(due_date.deadline_type_id).name
 end

 class AddFinishedDeadlineType < ActiveRecord::Migration
   execute "INSERT INTO `deadline_types` VALUES (12,'Finished');"
 end
  • The late tasks are collected into latetasks by selecting the tasks which are in the 'Finished' stage but does not have any submitted content. These are shown in the student task view in the task list.

 def late_tasks?
   current_stage == 'Finished' && !started?
 end

 <strong>  <span class="tasknum"> <%= @latetasks.size.to_s %> </span> Late Tasks<br></strong><br>
     <% @latetasks.each do |student_task|
      participant = student_task.participant
      stage = student_task.current_stage
      controller = "submitted_content"
      action = "edit"
      puts "participant id is #{participant.parent_id}"
      id = participant.parent_id
      %>

    <span>  »
      <%= link_to student_task.assignment.name + " " + student_task.current_stage, :controller => controller, :action => action, :id => id %>
      (<%= student_task.relative_deadline %> ago)
    </span><br/>
  <% end %>
  • The next immediate deadline from the current time is fetched from the student_task controller and compared with stage deadline of every assignment while iterating to find and highlight the assignemnt that has next immediate due.

 def next_dead_line
    ######## Next Immediate Due Date ###############
    next_deadline = nil
    @student_tasks = StudentTask.from_user current_user
    @student_tasks.reject! {|t| !t.assignment.availability_flag }
    @student_tasks.each do |student_task|
	if(student_task.stage_deadline > Time.now)
	   (next_deadline && next_deadline < student_task.stage_deadline) ? next_deadline : next_deadline = student_task.stage_deadline
	end
     end
    next_deadline
  end

 <% if @next_deadline == student_task.stage_deadline
           rowstyle = "font-weight:bold"
          else
           rowstyle = ""
         end %>
        <tr class="listingRow" style = <%= rowstyle%> >
         .. </tr>