CSC/ECE 517 Fall 2017/E1765 Rubrics.rb

From Expertiza_Wiki
Revision as of 02:00, 30 October 2017 by Anjain2 (talk | contribs) (→‎Testing from UI)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

E1765. OSS project Brown: Rubrics

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



About Expertiza

Expertiza is an open source project based on Ruby on Rails framework. The Expertiza project is software to create reusable learning objects through peer review. 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. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. Expertiza enables the instructor to create new and customize existing assignments. It also enables the instructor to create a list of topics the students can sign up for as part of a project. Students can form teams in Expertiza to work on various projects and assignments. Expertiza supports submission across various document types, including the URLs and wiki pages.

About Questionnaires Controller

This class manages the questions attached to a questionnaire. It enables the creation of new questionnaires, and editing of existing questionnaires. The questions attached to the questionnaire can either be added/updated manually from the user interface or imported from an existing comma separated file. Once the questions are added/updated satisfactorily, they can be exported as a comma separated file. The controller currently has its own import and export methods to achieve this functionality.

Problem Statement

The following tasks were accomplished in this project:

  • Fixed Issue 696: Instructors can make changes to each others' rubric, which should not happen
  • Updated action_allowed for access_control to prevent unauthorized access of methods..
  • Implemented new feature 577: Dumping and loading rubric criterion from CSV
  • Refactored Questionnaires Controller to use existing Import and Export controllers.
  • Added import method in Questions model to enable creation of questions from CSV.

Current Implementation

Functionality
  • Any user irrespective of his/ her privileges can edit the questionnaire.
The questionnaire should be restricted to be editable only by an instructor, administrator, or a super administrator. Furthermore, an existing questionnaire should be restricted to be editable only by the instructor who created the questionnaire in the first place.
  • Import and Export functionality in the Questionnaires Controller
The current implementation of the Questionnaires controller uses its own import and export methods. The Questionnaires controller should instead use the import and export implemented for the intended purpose. This promotes separation of concerns and code reuse.
Drawbacks and Solutions
  • Problem 1: An instructor can change others' review rubrics.
The method action_allowed in Questionnaires controller returns true for any user role for all actions.
def action_allowed?
     ['Super-Administrator',
      'Administrator',
      'Instructor',
      'Teaching Assistant', 'Student'].include? current_role_name
end
  • Solution: The implementation has been changed in such a way that the restriction on who is allowed to edit an existing rubric is as follows:
    • A super administrator can edit any existing rubric.
    • An administrator can edit any existing rubric.
    • An instructor can only edit an existing rubric if it was created by him or her. An instructor cannot edit a rubric created by another instructor.
    • The other functionalities have been left as it is, assuming that any user can create, view, etc. a new or existing rubric.
  • Problem 2: Import / Export controller
The feature to allow importing Questions from files and exporting the questions had been broken since the refactoring of Questionnaire controller in summer 2015.
  • Solution: Solution
    • The export file and import file views have to be enhanced to allow import/export of questions.
    • Questionnaire edit view will have to be enhanced to render the export_file/start and import_file/start views which would support importing questions from and importing questions to CSV files.

Enhancements

  • The action_allowed? method in Questionnaires controller has been modified to check for separate roles based on the action:
    • If the action is edit, it checks that the user is a super administrator, an administrator, or an instructor who created the questionnaire in the first place.
    • Else, all users are allowed to perform the action. (Assuming that even a student is allowed to add a questionnaire such as polls, surveys, etc)
def action_allowed?
  if action_name == "edit"
     @questionnaire = Questionnaire.find(params[:id])
     (['Super-Administrator',
      'Administrator'
      ].include? current_role_name)  ||
         ((['Instructor'].include? current_role_name) && current_user_id?( @questionnaire.instructor_id))
  else
      ['Super-Administrator',
       'Administrator',
       'Instructor',
       'Teaching Assistant', 'Student'].include? current_role_name
  end
end
  • Integrating export_file and import_file section with the questionnaire view allows questions to be imported into system from file, example CSV file and also to export question entries from system into an external file.
  • The export_file and import_file views are now partial rendered as part of the edit questionnaire view.
         <%= link_to 'Import Questionnaire', :controller=>'import_file', :action=>'start', :model => 'Question', :id=> @questionnaire.id, :expected_fields => 'txt, type ,seq,size, break_before' %>|
         <%= link_to 'Export Questionnaire', :controller=>'export_file',:action=>'start',:model=> 'Question',:id=> @questionnaire.id %>

Testing from UI

Following are a few testcases with respect to our code changes that can be tried from UI: 1. Log in as instructor 1 and create a new rubric.

2. Log in as another instructor. Go to [ Edit] page for the rubric and try to edit the questions.

3. Re log in as a student. Go to [ Edit] page for the rubric and try to edit the questions.

3. Re log in as instructor 1. Go to [ Edit] page for the rubric and try to edit the questions.

4. Re log in as a super administrator / admininstrator. Go to [ Edit] page for the rubric and try to edit the questionnaire.

5. "Export" button can be used to export all the questions and its associated details from the current questionnaire into a csv file that would named with the name of the questionnaire.

6. Choose the file that contains the questions to be imported into the questionnaire and press "Import" button to import the details into questionnaire.

  • The columns expected in the csv file would be displayed in the same page in the expected order.

References

  1. Expertiza on GitHub
  2. GitHub Project Repository Fork
  3. The live Expertiza website
  4. Demo link
  5. Expertiza project documentation wiki
  6. Rspec Documentation
  7. Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin