CSC/ECE 517 Fall 2015 E1576 Refactoring submitted content (hyperlinks and files): Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
= Introduction to Expertiza =
= Introduction to Expertiza =
Expertiza is a project developed using Ruby on Rails platform. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an open source application and the code can be cloned from GitHub. This application provides an efficient way to manage assignments, grades and reviews. This makes the process easier and faster when the class strength is large.
Expertiza is a project developed using Ruby on Rails platform. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an open source application and the code can be cloned from GitHub. This application provides an efficient way to manage assignments, grades and reviews. This makes the process easier and faster when the class strength is large.
= Problem Statement =
== Files involved ==
*assignment_participant.rb
*assignment_team.rb and
*views related to submitted hyperlinks and files (submitted_content/_hyperlink.html.erb, submitted_content/_submitted_files.html.erb)
== What it does ==
It handles the display, submission, deletion of hyperlinks and files by the teams.
== What is wrong with it ==
The submitted hyperlinks and files are stored in '''participants''' table, which means they are associated with individuals instead of team. This is not a good design because in Expertiza, students are always grouped in teams, even when there is only one person in each team (individual assignments).
Currently, when a team member wants to see all the submitted hyperlinks of his team, Expertiza needs to load all the submitted hyperlinks from each participant in this team and merge them all before display. Similar overhead happens when a team member wants to delete a submitted hyperlink. Also, the '''directory_num''' field needs to be moved from the '''participants''' table to the '''teams''' table. It signifies the sub-directory which stores all the files submitted by this team. Intuitively it is clear that each team should ideally have only one common copy of '''directory_num'''.
== What needs to be done ==
*Create a new column '''hyperlinks''' in the '''teams''' table.
*Write db migration, move all the participants’ submitted hyperlinks from '''participants''' table into '''teams''' table. Duplicate hyperlinks need to be removed.
*Write db migration, remove the '''hyperlinks''' field from '''participants''' table.
*Rewrite the hyperlink-related methods in both '''assignment_participant.rb''' and '''assignment_team.rb''' to make sure the new code works with the new db design.
*Make sure when doing the peer-review, the reviewer can see the submitted content from the reviewees.
*Make sure when instructor see the peer-review records, they can see the submitted content from the reviewees.
*Write db migration, move the '''directory_num''' field (also the content, of course) to the '''teams''' table.
*Move the '''set_student_directory_num''' method from '''participants_controller''' to '''teams_controller''', then refactor this method into smaller methods.
**This method no longer needs to test all the participants.
**Check if any of them have '''directory_num'''. If so, instead, it should just check the '''directory_num''' from '''teams''' table.
*Make change to the submitted-file-related code to make it work with the new design.
*Write test cases to test student-submitted hyperlinks and files.
= Problem Description =
The main purpose of this project is to improve how submitted hyperlinks are recorded in Expertiza in the current scheme. As of now, the submitted hyperlinks are stored in '''participants''' table, which means they are associated with individuals instead of team. This is not a good design because in Expertiza, students are always grouped in teams, even when there is only one person in each team (individual assignments). This results in a lot of redundant data.
Currently, when a team member wants to see all the submitted hyperlinks of his team, Expertiza needs to load all the submitted hyperlinks from each participant in this team and merge them all before display. When a team member wants to remove one hyperlink, Expertiza needs to loop over all the participants, which makes the code complicated and results in unnecessary computations.
Another aspect of this project requires moving the field '''directory_num''' from the '''participants''' table to the '''teams''' table. The '''directory_num''' field signifies the sub-directory which stores all the files submitted by this team. Intuitively it is clear that each team should ideally have only one common copy of '''directory_num'''. In the current design, since this field is in the '''participants''' table, we are forced to guarantee that all the team members have the same '''directory_num''', which results in redundant code.
= Scope =
This project can be divided into four major work items:
#Moving the '''hyperlinks''' field from the '''participants''' table to the '''teams''' table. After this change, relevant changes are needed in the code to support this database change.
#Moving the '''directory_num''' field from the '''participants''' table to the '''teams''' table. After this change, relevant changes are needed in the code to support this database change.
#Moving the '''set_student_directory_num''' method from the '''participants_controller''' to the '''teams_controller'''. It just needs to check '''directory_num''' from the '''team''' table.
#Write test cases to verify student-submitted hyperlinks and files.
= Implementation =
Expertiza files that will be modified for each work item along with the description:
{| class="wikitable"
! scope="col" style="width: 50px;" | Work Item #
! scope="col" style="width: 225px;" | Files to be modified
! scope="col" style="width: 500px;" | Description
|-
| 1 || assignment_participant.rb<br>assignment_team.rb<br>db:participants table<br>db:teams table || - Create a new column hyperlinks in teams table<br>- Write db migration, move all the participants’ submitted hyperlinks from participants table into teams table. All duplicated hyperlinks have to be removed.<br>- Write db migration, remove the hyperlinks field from participants table.<br>- hyperlink-related methods in both assignment_participant.rb and assignment_team.rb have to be rewritten to make sure the new code works with the new db design.
|-
| 2 || participants_controller.rb<br>teams_controller.rb<br>db:participants table<br>db:teams table || - Write db migration, move the directory_num field (also the content) to teams table.<br>- Move the set_student_directory_num from participant_controller to team_controller, then refactor this method into smaller methods.<br>- This method no longer needs to test all the participants and see if any of them have directory_num, instead, it just check the directory_num from teams table.<br>- Make change to the submitted-file-related code to make sure it works with the new design.
|-
| 3 || New files to be added || - Write test cases to test student-submitted hyperlinks and files.
|}
= Design =
Consider a simple use case where we need to retrieve the submitted hyperlinks and files corresponding to team_id, say, 23841. Since there is no existing correlation between teams and submitted content, we will first need to look up the participants in the team using the teams_users table. And then, using those user_id values one at a time, we need to look up the participants table.
[[File:db.jpg]]

Revision as of 05:25, 9 November 2015

Introduction to Expertiza

Expertiza is a project developed using Ruby on Rails platform. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an open source application and the code can be cloned from GitHub. This application provides an efficient way to manage assignments, grades and reviews. This makes the process easier and faster when the class strength is large.

Problem Statement

Files involved

  • assignment_participant.rb
  • assignment_team.rb and
  • views related to submitted hyperlinks and files (submitted_content/_hyperlink.html.erb, submitted_content/_submitted_files.html.erb)

What it does

It handles the display, submission, deletion of hyperlinks and files by the teams.

What is wrong with it

The submitted hyperlinks and files are stored in participants table, which means they are associated with individuals instead of team. This is not a good design because in Expertiza, students are always grouped in teams, even when there is only one person in each team (individual assignments). Currently, when a team member wants to see all the submitted hyperlinks of his team, Expertiza needs to load all the submitted hyperlinks from each participant in this team and merge them all before display. Similar overhead happens when a team member wants to delete a submitted hyperlink. Also, the directory_num field needs to be moved from the participants table to the teams table. It signifies the sub-directory which stores all the files submitted by this team. Intuitively it is clear that each team should ideally have only one common copy of directory_num.

What needs to be done

  • Create a new column hyperlinks in the teams table.
  • Write db migration, move all the participants’ submitted hyperlinks from participants table into teams table. Duplicate hyperlinks need to be removed.
  • Write db migration, remove the hyperlinks field from participants table.
  • Rewrite the hyperlink-related methods in both assignment_participant.rb and assignment_team.rb to make sure the new code works with the new db design.
  • Make sure when doing the peer-review, the reviewer can see the submitted content from the reviewees.
  • Make sure when instructor see the peer-review records, they can see the submitted content from the reviewees.
  • Write db migration, move the directory_num field (also the content, of course) to the teams table.
  • Move the set_student_directory_num method from participants_controller to teams_controller, then refactor this method into smaller methods.
    • This method no longer needs to test all the participants.
    • Check if any of them have directory_num. If so, instead, it should just check the directory_num from teams table.
  • Make change to the submitted-file-related code to make it work with the new design.
  • Write test cases to test student-submitted hyperlinks and files.

Problem Description

The main purpose of this project is to improve how submitted hyperlinks are recorded in Expertiza in the current scheme. As of now, the submitted hyperlinks are stored in participants table, which means they are associated with individuals instead of team. This is not a good design because in Expertiza, students are always grouped in teams, even when there is only one person in each team (individual assignments). This results in a lot of redundant data. Currently, when a team member wants to see all the submitted hyperlinks of his team, Expertiza needs to load all the submitted hyperlinks from each participant in this team and merge them all before display. When a team member wants to remove one hyperlink, Expertiza needs to loop over all the participants, which makes the code complicated and results in unnecessary computations. Another aspect of this project requires moving the field directory_num from the participants table to the teams table. The directory_num field signifies the sub-directory which stores all the files submitted by this team. Intuitively it is clear that each team should ideally have only one common copy of directory_num. In the current design, since this field is in the participants table, we are forced to guarantee that all the team members have the same directory_num, which results in redundant code.

Scope

This project can be divided into four major work items:

  1. Moving the hyperlinks field from the participants table to the teams table. After this change, relevant changes are needed in the code to support this database change.
  2. Moving the directory_num field from the participants table to the teams table. After this change, relevant changes are needed in the code to support this database change.
  3. Moving the set_student_directory_num method from the participants_controller to the teams_controller. It just needs to check directory_num from the team table.
  4. Write test cases to verify student-submitted hyperlinks and files.

Implementation

Expertiza files that will be modified for each work item along with the description:

Work Item # Files to be modified Description
1 assignment_participant.rb
assignment_team.rb
db:participants table
db:teams table
- Create a new column hyperlinks in teams table
- Write db migration, move all the participants’ submitted hyperlinks from participants table into teams table. All duplicated hyperlinks have to be removed.
- Write db migration, remove the hyperlinks field from participants table.
- hyperlink-related methods in both assignment_participant.rb and assignment_team.rb have to be rewritten to make sure the new code works with the new db design.
2 participants_controller.rb
teams_controller.rb
db:participants table
db:teams table
- Write db migration, move the directory_num field (also the content) to teams table.
- Move the set_student_directory_num from participant_controller to team_controller, then refactor this method into smaller methods.
- This method no longer needs to test all the participants and see if any of them have directory_num, instead, it just check the directory_num from teams table.
- Make change to the submitted-file-related code to make sure it works with the new design.
3 New files to be added - Write test cases to test student-submitted hyperlinks and files.

Design

Consider a simple use case where we need to retrieve the submitted hyperlinks and files corresponding to team_id, say, 23841. Since there is no existing correlation between teams and submitted content, we will first need to look up the participants in the team using the teams_users table. And then, using those user_id values one at a time, we need to look up the participants table.