CSC/ECE 517 Fall 2016/E1662. UI issues/fixes: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
 
(15 intermediate revisions by 2 users not shown)
Line 17: Line 17:
The main objective this project is to fix the issues in the current system. The current system has following issues:
The main objective this project is to fix the issues in the current system. The current system has following issues:


* Historically courses were created without providing Institution ID. However now since data warehousing is storing Institution Id for a particular course hence even this application should do that.
* Historically courses were created without providing Institution ID. Since data warehouse is now storing Institution ID for a particular course, this application should do support this function.
* If an assignment is completed, no one can sign up for topics or drop topics. Yet a completely blank "Actions" column on the signup sheet still appears. It would be better if the column did not appear.
* If an assignment is completed, no one can sign up for topics or drop topics. Yet a completely blank "Actions" column on the signup sheet still appears. It would be better if the column did not appear.
* Currently when admin/instructor tries to delete an assignment, there is no alert/confirmation shown. This is risky. We need to add a confirmation step to avoid losing data.
* Currently when admin/instructor tries to delete an assignment, there is no alert/confirmation shown. This is risky. We need to add a confirmation step to avoid losing data.


=== Issue#702 ===
=== Issues ===
==== Issue#702 ====
===== How was this Issue Fixed? =====
Capturing Institution ID
Capturing Institution ID


Institution and Course has One-to-Many relationship wherein one institution may have many courses associated with it. In current system while creating new course user does not have any provision of selecting Institution. Hence we need to fix this issue. Following basic changes are required in order to fix this issue.
Institution and Course has One-to-Many relationship where in one institution may have many courses associated with it. In current system while creating new course user does not have to choose which institution the course belongs to. Hence we need to fix this issue. Following basic changes are required in order to fix this issue.
 
* Ensure that relationship exists between Course and Institution model classes.
* Ensure that relationship exists between Course and Institution model classes.
<pre>
<pre>
Line 37: Line 40:
</pre>
</pre>


* Add a dropdown list in Course creation form so that user can select institution from the available options.
* In ''app/views/course/_course.html.erb'', add a drop-down list so that user can select institution from the available options.
 
<pre>
<pre>
<!--Adding a field so that user can select institution from the list-->
<!--Adding a field so that user can select institution from the list-->
<p><label for="course_institutions_id">Institution Name</label><br/>
<p><label for="course_instituition_id">Institution</label><br/>
  <%= select_tag :'institutions_id', options_from_collection_for_select(Institution.where.not(:name=>nil), 'id', 'name'), :include_blank => "Please select...",:required=>true %>
<%= select_tag 'institution', options_from_collection_for_select(Institution.all,:id,:name) %></p>
</p>
</pre>
</pre>


* Ensure that the id for the selected institution is sent as a parameter along with other parameters back to controller.
* Ensure that the id for the selected institution is sent as a parameter along with other parameters back to controller.
* Once we receive all the data in controller Institution id should be saved in course table.
* Once we receive all the data in controller Institution ID should be saved in course table. Thus in ''app/controllers/course_controller.rb'', add arguments to the Create method.
<pre>
<pre>
@course = Course.new(name: params[:course][:name], directory_path:  
@course = Course.new(name: params[:course][:name], directory_path: params[:course][:directory_path], info: params[:course][:info], private: params[:course][:private], institutions_id: params[:institution])
params[:course][:directory_path], info: params[:course][:info],  
institutions_id: params[:institutions_id], private: params[:course][:private])
</pre>
</pre>


=== Issue#316 ===
===== How to Test this fix? =====
When student open sign up sheet for the Finished projects, he should not be able to take any actions for that assignment and hence Actions column should be hidden to him. For fixing this bug, we had to make following changes into sign_up_sheet/_table_line.html.erb.
* User should login to expertiza using Instructor's credentials.
* Go to Manage Courses and click on New Course button so as to open form for it.
* Fill up the form. you can see new field added as Institution Name. This is a drop down list which has list of Institutions.
* User has to select one of these institutions. If user tries to go ahead without selecting this then he will get an alert flash saying this is a required field.
* Once an institution is selected user can click on Create button to submit the form (with other fields completed).
* Institution ID would be saved in database record against this particular entry of course in Course table. User can verify this by accessing Course table in the database.
 
==== Issue#316 ====
===== How was this Issue Fixed? =====
When student open sign up sheet for the Finished projects, he should not be able to take any actions for that assignment and hence Actions column should be hidden to him. For fixing this bug, we had to make following changes into ''app/views/sign_up_sheet/_table_header.html.erb''.
 
<pre>
<pre>
<%if !@assignment.get_current_stage.eql?"Finished"%>
<% if @assignment.current_stage_name != "Finished" %>
   <td align="center">
   <th width="10%">Actions</th>
    <%= render :partial => '/sign_up_sheet/actions',  
  <th width="5%">Advertisement(s)</th>
     :locals => {:i=>i,:topic=>topic, :is_suggested_topic=>is_suggested_topic ||= false} %>
<% else %>
  </td>
<th width="15%">Advertisement(s)</th>
<%end%>
<% end %>
</pre>
 
===== How to Test this fix? =====
* Login to expertiza using student credentials
* Go to assignment tab and look for the assignments which have current stage as "Finished"
* Go to that assignment and open sign-up sheet.
* You should not be able to see column Activities, which means the work is successful.
 
==== Issue#295 ====
===== How was this Issue Fixed? =====
When instructor clicks on delete button to delete assignment, It gets deleted without confirming it. System should ask for confirmation whether to go ahead with deletion or not. To post a confirmation to users, we used the flash method to put the message on the screen. When user is going to delete an assignment, he will firstly use the ''delete'' action in ''assignment'' model with parameter ''force=nil''. Thus in ''app/models/assignment.rb'', we added an condition in the beginning of the method to check whether it is the first attempt to delete the assignment. If it is, an exception will be raised.
<pre>
     if(force.nil?)
      raise "The delete action cannot be revoked."
    end
</pre>
 
The exception will be caught in the assignment controller. Then corresponding messages are passed by flash method to be shown on the page.
 
<pre>
begin
      @assignment_form = AssignmentForm.create_form_object(params[:id])
      @user = session[:user]
      id = @user.get_instructor
      if id != @assignment_form.assignment.instructor_id
        raise "You are not authorized to delete this assignment."
      else
        @assignment_form.delete(params[:force])
        flash[:success] = "The assignment was successfully deleted."
      end
    rescue
      error = $ERROR_INFO
 
      url_accept = url_for action: 'delete', id: params[:id], force: 0
      url_deny = list_tree_display_index_path
 
      url_yes = url_for action: 'delete', id: params[:id], force: 1
      url_no = list_tree_display_index_path
 
      if(error.to_s == "The delete action cannot be revoked.")
        flash[:error] = error.to_s + " Are you sure?&nbsp;<a href='#{url_accept}'>Yes</a>&nbsp;|&nbsp;<a href='#{url_deny}'>No</a><BR/>" 
      else
        flash[:error] = error.to_s + " Delete this assignment anyway?&nbsp;<a href='#{url_yes}'>Yes</a>&nbsp;|&nbsp;<a href='#{url_no}'>No</a><BR/>"
      end
end
 
</pre>
</pre>


===== How to Test this fix? =====
* Login to Expertiza as an Instructor.
* Go to manage assignment page.
* Try deleting an assignment by clicking on an image from the activities column.
* When delete button is clicked, system should ask for confirmation message whether you really want to delete or not.
* If you select yes then that assignment should be deleted. Otherwise if selected no then that assignment should not be deleted.


== References ==
== References ==

Latest revision as of 04:10, 10 November 2016

UI Issues/Fixes

Background

Expertiza is an open source web application developed by students and faculty members of North Carolina State University. This portal is being used by both faculty members and students in order to carry out assignments. Typically following is the workflow of the system:

  • Faculty member adds students to a particular course. He also adds an assignment for the class.
  • Assignment has a specific deadline, review period and final submission.
  • Faculty members upload list of topics for the assignment.
  • Students have to bid for the topic or they can suggest their own topic.
  • At the end of the bidding process, students get a specific topic for the assignment.
  • Students can form the teams by sending out invitations to other students.
  • Students start working on the assignment and submit the assignment work before the initial submission date.
  • Every student then gets to review work submitted by at least one team. Student submit their feedback in the review.
  • Students then make the necessary changes as suggested by reviewer and submit the assignment before the final submission date.
  • Students are graded on the basis of their work and reviews.

Objective

The main objective this project is to fix the issues in the current system. The current system has following issues:

  • Historically courses were created without providing Institution ID. Since data warehouse is now storing Institution ID for a particular course, this application should do support this function.
  • If an assignment is completed, no one can sign up for topics or drop topics. Yet a completely blank "Actions" column on the signup sheet still appears. It would be better if the column did not appear.
  • Currently when admin/instructor tries to delete an assignment, there is no alert/confirmation shown. This is risky. We need to add a confirmation step to avoid losing data.

Issues

Issue#702

How was this Issue Fixed?

Capturing Institution ID

Institution and Course has One-to-Many relationship where in one institution may have many courses associated with it. In current system while creating new course user does not have to choose which institution the course belongs to. Hence we need to fix this issue. Following basic changes are required in order to fix this issue.

  • Ensure that relationship exists between Course and Institution model classes.
# Establishing relationship between Course and Institution
class Institution < ActiveRecord::Base
  has_many :courses, dependent: :destroy
end

class Course < ActiveRecord::Base
  belongs_to :institution, class_name: 'Institution', foreign_key: 'instituition_id'
end
  • In app/views/course/_course.html.erb, add a drop-down list so that user can select institution from the available options.
<!--Adding a field so that user can select institution from the list-->
<p><label for="course_instituition_id">Institution</label><br/>
<%= select_tag 'institution', options_from_collection_for_select(Institution.all,:id,:name) %></p>
  • Ensure that the id for the selected institution is sent as a parameter along with other parameters back to controller.
  • Once we receive all the data in controller Institution ID should be saved in course table. Thus in app/controllers/course_controller.rb, add arguments to the Create method.
@course = Course.new(name: params[:course][:name], directory_path: params[:course][:directory_path], info: params[:course][:info], private: params[:course][:private], institutions_id: params[:institution])
How to Test this fix?
  • User should login to expertiza using Instructor's credentials.
  • Go to Manage Courses and click on New Course button so as to open form for it.
  • Fill up the form. you can see new field added as Institution Name. This is a drop down list which has list of Institutions.
  • User has to select one of these institutions. If user tries to go ahead without selecting this then he will get an alert flash saying this is a required field.
  • Once an institution is selected user can click on Create button to submit the form (with other fields completed).
  • Institution ID would be saved in database record against this particular entry of course in Course table. User can verify this by accessing Course table in the database.

Issue#316

How was this Issue Fixed?

When student open sign up sheet for the Finished projects, he should not be able to take any actions for that assignment and hence Actions column should be hidden to him. For fixing this bug, we had to make following changes into app/views/sign_up_sheet/_table_header.html.erb.

<% if @assignment.current_stage_name != "Finished" %>
  <th width="10%">Actions</th>
  <th width="5%">Advertisement(s)</th>
<% else %>
	<th width="15%">Advertisement(s)</th>
<% end %>
How to Test this fix?
  • Login to expertiza using student credentials
  • Go to assignment tab and look for the assignments which have current stage as "Finished"
  • Go to that assignment and open sign-up sheet.
  • You should not be able to see column Activities, which means the work is successful.

Issue#295

How was this Issue Fixed?

When instructor clicks on delete button to delete assignment, It gets deleted without confirming it. System should ask for confirmation whether to go ahead with deletion or not. To post a confirmation to users, we used the flash method to put the message on the screen. When user is going to delete an assignment, he will firstly use the delete action in assignment model with parameter force=nil. Thus in app/models/assignment.rb, we added an condition in the beginning of the method to check whether it is the first attempt to delete the assignment. If it is, an exception will be raised.

    if(force.nil?)
      raise "The delete action cannot be revoked."
    end

The exception will be caught in the assignment controller. Then corresponding messages are passed by flash method to be shown on the page.

begin
      @assignment_form = AssignmentForm.create_form_object(params[:id])
      @user = session[:user]
      id = @user.get_instructor
      if id != @assignment_form.assignment.instructor_id
        raise "You are not authorized to delete this assignment."
      else
        @assignment_form.delete(params[:force])
        flash[:success] = "The assignment was successfully deleted."
      end
    rescue
      error = $ERROR_INFO

      url_accept = url_for action: 'delete', id: params[:id], force: 0
      url_deny = list_tree_display_index_path

      url_yes = url_for action: 'delete', id: params[:id], force: 1
      url_no = list_tree_display_index_path

      if(error.to_s == "The delete action cannot be revoked.")
        flash[:error] = error.to_s + " Are you sure? <a href='#{url_accept}'>Yes</a> | <a href='#{url_deny}'>No</a><BR/>"  
      else
        flash[:error] = error.to_s + " Delete this assignment anyway? <a href='#{url_yes}'>Yes</a> | <a href='#{url_no}'>No</a><BR/>" 
      end
end

How to Test this fix?
  • Login to Expertiza as an Instructor.
  • Go to manage assignment page.
  • Try deleting an assignment by clicking on an image from the activities column.
  • When delete button is clicked, system should ask for confirmation message whether you really want to delete or not.
  • If you select yes then that assignment should be deleted. Otherwise if selected no then that assignment should not be deleted.

References

1. https://github.com/expertiza/expertiza - Github link for original repository

2. https://github.com/psabhyan/expertiza.git - Github Repository code for the updated code