CSC/ECE 517 Fall 2014/OSS E1450 cxm
E1450: UI change for assignment view
What it does: Change UI of Expertiza to support varying rubric feature (allow instructors to specify different review rubrics for different review rounds)
Background Information
What is Expertiza?
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation<ref>https://github.com/expertiza/expertiza</ref>. The Expertiza project is software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages<ref>http://wikis.lib.ncsu.edu/index.php/Expertiza</ref>.
JavaScript
JavaScript is a dynamic programming language of the Web browsers. Despite some naming, syntactic, and standard library similarities, JavaScript and Java are otherwise unrelated and have very different semantics. The syntax of JavaScript is actually derived from C, while the semantics and design are influenced by Self and Scheme programming languages<ref>http://en.wikipedia.org/wiki/JavaScript</ref>. This mix of features makes it a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles.
Project Description
Classes involved:controllers/assignment_controller.rb (488 lines)
views/assignment/edit.html.erb (55 lines) in production branch (not in master branch)
What needs to be done:
This project requires JavaScript knowledge.
- A checkbox “Review rubrics vary by round” should be added to the “General” tab in the view of creating/editing assignment. No corresponding field in “assignments” table is necessary. We can tell if this checkbox should be checked by checking “assignments_questionnaires” table by current assignment_id. If there is no record with a non-null value in “used_in_round” field, this assignment is not using this feature and the checkbox should not be checked. (if one assignment has 2 rounds but they are using the same set of rubrics, for each type of rubric there should be only one entry with “used_in_round” field null)R
- 4 checkboxes “Review rubrics vary by round” should be added on the “rubrics” tab. each one denotes for each type of rubric (review, metareview, author feedback and teammate review) for which the instructor wants to use different rubrics. Again, no corresponding DB field is necessary. If the checkbox on the “General” tab is selected, on the “rubrics” tab, the “Review rubrics vary by round” checkbox for “review” will be selected automatically
- There should be a editable “deadline name” for each due date on “due date” panel if this type of review is specified to be “varying by rounds” in the “rubrics” tab (the input should be recorded in deadline_name field in due_dates table)
- Another “description URL” text box should be editable when this type of review is specified to be “varying by rounds” in the “rubrics” tab (the input should be recorded in description_url field in due_dates table)
- A drop-down box which help instructor to select review rubric should be added for a review round when this type of review is specified to be “varying by rounds” in the “rubrics” tab (the input should be recorded in assignments_questionnaires table)
- There are no tests for the code. Create appropriate functional and integration tests.
Design Patterns
Environment Setup
Since we are developing on the Production branch, in stead of the Rails4 branch, the environment for us would be different from the majority of the class. Here is the list:
Ruby: 1.8.7
Rails: 2.3.15
Java: 1.6
Openjdk: 6.0
Database: expertiza_scrubbed_2014_03_14.sql
Code Modifications
Case 1: Add Checkbox on "General" Tab
Current Scenario
No checkbox for "Varying Rubric by Round" on the general tab for Instructors.
After Changes
In the views / assignment / edit / _general.html.erb, we added a checkbox, which can read the value of used_in_round_flag:
<input name="assignment_questionnaires[used_in_round]" type="hidden" value="false"/> <%= check_box_tag('assignment_questionnaires[used_in_round]', 'true', @used_in_round_flag ) %> <%= label_tag('assignment_questionnaires[used_in_round]', 'Review rubric vary by round?') %>
In the assignment_controller.rb, we added a method to load the value from database to used_in_round_flag: def edit @assignment = Assignment.find(params[:id]) @assignment_questionnaires = AssignmentQuestionnaire.find_all_by_assignment_id(params[:id]) @used_in_round_flag= nil @assignment_questionnaires.each do |aq| if(!(aq.used_in_round.nil?)) @used_in_round_flag= 1 end end end
Case 2: Add 4 Checkbox on "Rubric" Tab
Current Scenario
No checkbox on the Rubric tab to show is the type of review is varied by round.
After Changes
In the "edit" method we defined above, a list of 4 flags are added to reflect the corresponding database value:
@assignment_questionnaires.each do |aq| if(!(aq.used_in_round.nil?)) @q_id = aq.questionnaire_id @qn = Questionnaire.find(@q_id) if(@qn.display_type.eql?"Review") @review_flag = 1 elsif(@qn.display_type.eql?"Metareview") @metareview_flag=1 elsif(@qn.display_type.eql?"Author Feedback") @authorfeedback_flag = 1 elsif(@qn.display_type.eql?"Teammate Review") @teammate_flag = 1 end end end
In the views / assignment / edit / _rubrics.html.erb, 4 checkbox are added, based on the corresponding flag value:
if(questionnaire.display_type == "Review")
html += '<input name="assignment_questionnaires[used_in_round]" type="hidden"
value="false"><%= check_box_tag('assignment_questionnaires[used_in_round]', 'true', @review_check ) %><%=
label_tag('assignment_questionnaires[used_in_round]', 'Review rubric vary by round?') %> '+
'';
else if(questionnaire.display_type == "Metareview")
html += '<input name="assignment_questionnaires[used_in_round]" type="hidden"
value="false"><%= check_box_tag('assignment_questionnaires[used_in_round]', 'true', @metareview_check) %><%=
label_tag('assignment_questionnaires[used_in_round]', 'Review rubric vary by round?') %> '+
'';
else if(questionnaire.display_type == "Author Feedback")
html += '<input name="assignment_questionnaires[used_in_round]" type="hidden"
value="false"><%= check_box_tag('assignment_questionnaires[used_in_round]', 'true', @author_check) %><%=
label_tag('assignment_questionnaires[used_in_round]', 'Review rubric vary by round?') %> '+
'';
else if(questionnaire.display_type == "Teammate Review")
html += '<input name="assignment_questionnaires[used_in_round]" type="hidden"
value="false"><%= check_box_tag('assignment_questionnaires[used_in_round]', 'true', @teammate_check) %><%=
label_tag('assignment_questionnaires[used_in_round]', 'Review rubric vary by round?') %> '+
'';
Case 3: Add "Deadline_name" and "Description_url" on "Due_date" Tab
Current Scenario
After Changes
Case 4: Add Dropdown-box to Select Review Rubric
Current Scenario
After Changes
Add Cucumber Tests
References
<reference />