CSC/ECE 517 Fall 2018- Project E1861. Improving search facility in Expertiza

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction:

The Expertiza application running on Ruby on Rails is used for a variety of purposes by students and faculty members. There are many pages that display information about students, assignments, rubrics and reviews. The information is displayed with attributes like name, ID, due date etc. This project works on improving the search facility by adding search criteria in existing search bars, making it look elegant and adding search bars if not present.


Problem Definition:

  1. An instructor or administrator can search for a user by name, user-ID, or other characteristics.
  2. An instructor should be able to search for assignments by name, due date, or other characteristics.
  3. An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.
    1. For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course. It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.
    2. One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.
  4. There should be a way to search all reviews of a particular team’s work for particular scores or text strings. Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.
  5. An instructor or administrator should be able to search for all the assignments that a particular user has participated in.
  6. If more than one criteria needs to be specified, there should be an 'Advanced Search' button.


Proposed Solution:

Search for User:

In the current system workflow the user is able to search for a particular user by entering a partial or a complete text that matches with the user name. In the proposed workflow searching by name, searching by User ID will also be supported. The user will be able to apply multiple filters at a time and the output of the query will match all filter applied. If no results are found an empty list will be returned.

Steps to reproduce the proposed workflow:

  1. Log in to expertiza to view the home page
  2. Go to Manage > Users
  3. Type the name of the user in the search box available below the ‘Users’ tab
  4. In the dropdown list that opens up, click on the ‘Advanced Search’ button if you wish to apply more filters.
  5. All the entries that match the given criteria will be returned.


Search for Assignments:

In the current system implementation, searching via the name of the assignment is supported. In the proposed system, the user will be able to search for an assignment using additional filters such as date created, date updated. The user will be able to apply multiple filters at a time and the output of the query will match all filter applied. If no results are found an empty list will be returned.

To search for an assignment by creation date, the user can enter a time duration within which the assignment was created. All assignments that were created within this date range and which match other filters will be returned. The procedure is same for searching by date of update.

Steps to reproduce the proposed workflow:

  1. Log in to expertiza to view the home page
  2. Go to Manage > Assignments
  3. Type the name of the assignment in the search box available below the ‘Assignments’ tab
  4. In the dropdown list that opens up, click on the ‘Advanced Search’ button if you wish to apply more filters ( date of creation, date updated).
  5. All the entries that match the given criteria will be returned.


Search for Questionnaires:

The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the question within a questionnaire, date of creation, date updated. The user will be able to apply multiple filters at a time and the output of the query will match all filter applied. If no results are found an empty list will be returned.

To search for a course by creation date, the user can enter a time duration within which the course was created. All courses that were created within this date range and which match other filters will be returned. The procedure is same for searching by date of update. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.

All the above will be available under Manage > Questionnaires.


Search for Reviews:

The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc.

Use Case Diagram

Proposed Code Changes

We though about 2 ways of adding the search functionality in the system

  1. Adding a search controller to the system
  2. Adding search functionality to individual models

Adding a search controller

If we followed this approach the search query would be like

  • localhost:port/search/user?name=<>
  • localhost:port/search/assignment?name=<>

This would mean that we are thinking of search as a resource on the system which to us looked as a wrong approach


Adding search functionality to individual models

If we followed this approach the search query would be like

  1. localhost:port/user/search?name=<>
  2. localhost:port/assignment/search?name=<>

On discussions we concluded that that the latter was a more RESTFul design For most of the cases we have tried to minimize the changes required in the respective model by reuse We propose to add search methods in each model for corresponding changes.

Therefore in order to perform search every entity required changes in all the three layers

  • View : Changes in view are changes added to UI, and it is used to pass search parameters to controller
  • Controller : Parses the changes from UI, essentially takes params[] hash.
  • Model : Bulk of search logic is implemented here, once the model gets the parameters for the search ( hash ), the query is incrementally built using all the params and then executed to get the list of objects.

User changes have been handled differently than for Questionnaire, Assignments and Review because Users follows the traditional RoR scheme, where as others user React for UI. React based View changes are in app/assets/javascripts/tree_display.jsx.

User

  • Search fields
    • username
    • name
    • email
  • Modified files:
    • app/views/users/list.html.erb
    • app/controllers/users_controller.rb
    • app/models/user.rb
  • Modified functions
    • UsersController#list : Parses the username, name and email from the params hash.
    • User#get_user_list : Model returns list of users to the view, changes in this function uses regex to filter out the entries that do not match search params.

Assignment

  • Search fields
    • name
    • assignee_username
    • assignee_name
    • due_date_before
    • due_date_after
    • created_before
    • created_after
  • Modified files
    • app/assets/javascripts/tree_display.jsx
    • app/controllers/tree_display_controller.rb
    • app/models/assignment_node.rb
  • Modified functions
    • TreeDisplayController#initialize_fnode_update_children
    • TreeDisplayController#update_fnode_children
    • AssignmentNode.get

Questionnaire

  • Search fields
    • name
    • text
    • course
    • assignment
  • Modified files
    • app/assets/javascripts/tree_display.jsx
    • app/controllers/tree_display_controller.rb
    • app/models/questionnaire_node.rb
  • Modified functions
    • TreeDisplayController#get_tmp_res
    • QuestionnaireNode.get

Review

  • Search fields
    • team
    • text
    • min_score
    • max_score
  • Modified files
    • app/views/review_mapping/_searchbox.html.erb
    • app/controllers/review_mapping_controller.rb
    • app/helpers/summary_helper.rb
  • Modified functions
    • ReviewMappingController#response_report
    • SummaryHelper#summarize_reviews_by_reviewees

Database Design

ER Diagram:

The simplified version of ER Diagram depicts relationships between the entity sets that are used in the system. Many-to-many relationships are identified by named-diamonds - teams_users, assignment_questionnaires, which are implemented as tables.


Relevant Tables

Test Plan:

We plan to two types of testing

UI Tests

Search for User

Setup: create a user with name="student" and userId="5000"

Action: Instructor clicks on manage - > users -> in textbox enters name="student"
Response: Relevant details of student, name="student" is displayed

Action: Instructor clicks on manage - > users -> advanced search->clicks on checkbox student id and enters "5000" and click "ok"
Response: Relevant details of student, name="student" is displayed

Search for Assignments

Setup create an assignment with name="assignment" and set a due date

Action : Instructor clicks on Manage -> Assignments, in textbox enter "assignment" in relevant tab
Response : Relevant assignment should be displayed

Action : Instructor clicks on Manage -> Assignments-> drop down and apply filters for due date and enter date and click "ok"
Response : Relevant assignments should be displayed

Search for Questionnaires

Setup : Create a Questionnaire, add questions to it
Action : Log in as instructor, Manage -> Questionnaires, in text box enter text
Response : Questionnaires matching text are shown

Action : Log in as instructor, Manage -> Questionnaires, click advanced search and check creation date and enter value
Response : Questionnaires matching text are shown

Search for Reviews

Setup : Setup review for an assignment, login as student and then add review

Action : Log in as instructor, Manage -> Assignments, Click on Review Report icon on corresponding assignment
Result : Review should be seen

Action : Click Advanced search, check review by text and enter text
Result : Matching review should be visible

Automated Tests

Automated tests in RSpec will be added as we implement the search functionality for each Model
Most tests added will be unit tests that cover the test cases for each flow and changes in the model.
Test Details

  • User Model ( spec/models/user_spec.rb )
  1. Search by user name
  2. Search by user name that does not exist
  3. Search by user email
  4. Search by user email that does not exist
  5. Search by user email containing a substring
  6. Search by user full name
  7. Search by user full name is empty
  8. Search by user name and email