CSC/ECE 517 Fall 2019 - E1972. OSS project J. Skellington: Accessing Assignment Rubrics: Difference between revisions
No edit summary |
|||
Line 91: | Line 91: | ||
==== Fixes Done ==== | ==== Fixes Done ==== | ||
'''app/ | '''app/assets/javascripts/tree_display.jsx:''' | ||
- This code wait for the page to load and then try to find the user id embedded in the HTML sent from the backend. It then sets this id in a variable available across the app using javascript. | |||
<pre> | <pre> | ||
let app_variables = { | |||
currentUserId: null | |||
}; | |||
window.addEventListener('load', e => { | |||
let treeDisplayDiv = document.querySelector('#tree_display'); | |||
if (treeDisplayDiv) { | |||
app_variables.currentUserId = document.querySelector('#tree_display').dataset.userId; | |||
} | |||
}); | |||
</pre> | </pre> | ||
We then pass the instructor's id coming from the API into the Component as props so that it is accessible inside out component for validation. | |||
<pre> | |||
instructor_id={entry.instructor_id} | |||
</pre> | |||
The check which is helping us achieve this is | |||
<pre> | |||
instructor_id={entry.instructor_id} | |||
</pre> | |||
'''app/controllers/controller2:''' | '''app/controllers/controller2:''' | ||
<pre> | <pre> | ||
(app_variables.currentUserId == null || this.props.instructor_id == app_variables.currentUserId) | |||
</pre> | </pre> | ||
For API changes<br> | |||
'''app/controllers/tree_display_controller.rb''' | |||
<pre> | |||
"instructor_id" => child.get_instructor_id, | |||
</pre> | |||
'''app/models/questionnaire_node.rb''' | |||
This function added to the model which simply returns instructor_id associated with that particular questionnaire or survey. | |||
<pre> | <pre> | ||
def get_instructor_id | |||
Questionnaire.find_by(id: self.node_object_id).try(:instructor_id) | |||
end | |||
</pre> | </pre> | ||
Revision as of 01:36, 27 October 2019
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
Task 1 : Inappropriate redirection when Managing Questionnaire types
Description
Each of the options for Manage>Questionnaires> does not appropriately link you to the Questionnaires tab with that section of Questionnaires expanded.
Problem Cause (The grubby details)
The Manage Content page has three tabs in it namely: "Courses","Assignments" and "Questionnaires". And the application has a feature of storing the 'Last open tab' in its session. Suppose a user was in 'Assignments' tab uner 'Manage Content' Section, and when the user switches to some other tab (By clicking on Home for instance), and comes back on 'Manage Content' section (by clicking on 'Manage...' menu button), he is directed back on the 'Assignments' tab only (the tab that was opened before leaving the 'Manage Content' section).
The problem however, with this feature is that it dominates the natural flow of the application in the following scenario: Lets say after leaving the 'Manage Content' section as mentioned above, the user clicks 'Manage...>Questionnaires', but even at this point, the user is directed again directed to 'Assignments' tab under 'Manage Content'
TODO: RCA
How to reproduce
If you are on the assignment tab and select to Manage…>Questionnaires> [some option], this will send you to the assignment tab. It is believed that the redirect will always send you to the view that was previously displayed. Change the tab to course or questionnaire and then it just sends you to that tab instead.
Flowchart for correct behavior
Major Fixes Done
app/assets/javascripts/tree_display.jsx
componentDidMount: function() { rubBuffer = ["Review", "Metareview", "Author Feedback", "Teammate Review", "Assignment Survey", "Global Survey", "Course Survey"]; selMenuItem = document.getElementById("tree_display").getAttribute("data-menu-item"); selMenuItemInd = rubBuffer.indexOf(selMenuItem); if(rubBuffer[selMenuItemInd] === this.props.name) { if (selMenuItemInd !== -1) { this.setState({ expanded: true }, function () { this.props.rowClicked(this.props.id, true, this.props.newParams) }) } } },
app/controllers/tree_display_controller.rb
def goto_controller(name_parameter, prevTab) node_object = TreeFolder.find_by(name: name_parameter) session[:root] = FolderNode.find_by(node_object_id: node_object.id).id if(prevTab!=nil) session[:last_open_tab] = prevTab end redirect_to controller: 'tree_display', action: 'list', currCtlr: name_parameter end def goto_questionnaires goto_controller('Questionnaires','3') end
ScreenCast
Here is a screencast of the tested functionality after the fix: Fixed Issue #1186
Task 2: Instructors can make changes to each others’ rubrics
Details
Currently, rubric lists show all public rubrics and there is no option to restrict the view as in assignments and courses. This should be fixed by only displaying the option to edit (pencil) when the rubric belongs to the user. This clearly indicates that the user has the ability or not to edit this rubric.
How to reproduce
Log in and Manage…>Questionnaires>Rubrics. Then click on one of the rubric types to show a list of rubrics and click through the edit options to reveal the flash error when you try and edit a rubric that is not yours.
Flowchart for correct behavior:
Fixes Done
app/assets/javascripts/tree_display.jsx: - This code wait for the page to load and then try to find the user id embedded in the HTML sent from the backend. It then sets this id in a variable available across the app using javascript.
let app_variables = { currentUserId: null }; window.addEventListener('load', e => { let treeDisplayDiv = document.querySelector('#tree_display'); if (treeDisplayDiv) { app_variables.currentUserId = document.querySelector('#tree_display').dataset.userId; } });
We then pass the instructor's id coming from the API into the Component as props so that it is accessible inside out component for validation.
instructor_id={entry.instructor_id}
The check which is helping us achieve this is
instructor_id={entry.instructor_id}
app/controllers/controller2:
(app_variables.currentUserId == null || this.props.instructor_id == app_variables.currentUserId)
For API changes
app/controllers/tree_display_controller.rb
"instructor_id" => child.get_instructor_id,
app/models/questionnaire_node.rb
This function added to the model which simply returns instructor_id associated with that particular questionnaire or survey.
def get_instructor_id Questionnaire.find_by(id: self.node_object_id).try(:instructor_id) end
Team Members
Ankit Manendra (amanend@ncsu.edu)
Bharat Sinha (bsinha2@ncsu.edu)
Gurman Singh (gsingh23@ncsu.edu )
Mentor: Carmen Bentley (cnaiken@ncsu.edu)