CSC/ECE 517 Fall 2020 - E2076. Allow users to create an account and submit work to an "assignment" (e.g., for conference reviewing): Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
 
(75 intermediate revisions by 3 users not shown)
Line 15: Line 15:
==Proposed Solution==
==Proposed Solution==


Refactor previous solution which has most of the functionality implemented in controller. We plan to refactor this to follow the standard MVC architecture by moving the main logic to the model.
:* We create a new controller, conference_controller.rb to manage the conference related assignments. If the assignment is tagged to be of conference type a link is generated which can be used by the user to sign up to the conference page. Furthermore, you can find a Captcha implementation which is used to verify that a legitimate user is trying to create an account. This would help maintain the integrity of the website, preventing the use of automated bots on the website.  


Revisions in progress.
:* Add this feature of sending out invitations by the author of the conference paper to other co-authors.
 
:* We use the conference_helper.rb to interconnect different modules inside Expertiza. Refactor the previous solution following proper design practices and ensured proper naming conventions are followed.
 
:* Ensure that new users who are not current users in the Expertiza website can sign up and join a conference assignment. The current users of the Expertiza website can also sign up in the conference assignment using the invite.


==Design Plan==  
==Design Plan==  
Line 24: Line 28:


# '''Author signs up''': This use case assumes that the author isn't part of our expertiza database yet and wants to submit a paper for review. Assuming that the author already has the link to sign up for expertiza. The author would then have to click the link and will have to go through a captcha to verify the user identity.  Then he/she will be asked to put some details to create account with role as student. After account creation, Author will receive email with login ID and password.
# '''Author signs up''': This use case assumes that the author isn't part of our expertiza database yet and wants to submit a paper for review. Assuming that the author already has the link to sign up for expertiza. The author would then have to click the link and will have to go through a captcha to verify the user identity.  Then he/she will be asked to put some details to create account with role as student. After account creation, Author will receive email with login ID and password.
# '''Author submits paper to expertiza for review''': Now that the author has an account he can login to his expertiza account and then click the assignment. Then the author will have to upload his paper by clicking submit your work, then adding the details of the paper like track of the paper etc. [planning to have a dropdown list for this].
# '''Author submits paper to expertiza for review''': Now that the author has an account, he can login to his expertiza account and then click the assignment. Then the author will have to upload his paper by clicking submit your work, then adding the link to his paper.
# '''Author sends an invitation to collaborators''': If required, the author can keep adding collaborators/contributors by selecting the paper he/she uploaded and selecting add contributors. Then he/she has to fill in the co-authors details like email id, etc.
# '''Author sends an invitation to collaborators''': If required, the author can keep adding collaborators/contributors by clicking 'your team' and inviting other participants either with their expertiza username or their e-mail id.
# '''Collaborator signs up''': Assuming that the collaborator doesnt have an existing account. They would have received a mail when they were added as collaborator, they can login using the given username and password in that mail. Then after log in he/she can click your team and accept the pending author invite.
# '''Collaborator signs up''': In this scenario there are two possible cases :
# '''Review''': This part will be almost similar to existing peer reviews.
## Assuming that the collaborator doesn't have an existing account. They would have received a mail when they were added as collaborator, they can then login using the given username and password in that mail. After log in he/she can click your team and accept the pending invite.
## Assuming that the collaborator exists in the expertiza system. They would not receive any mail, they would simply get an invite in their expertiza account. They can accept the invite whenever they next log in.
# '''Review''': The authors / co-authors of any conference assignment will not be able to review.


[[File:OSS12.png]]
[[File:OSS12.png]]
Line 33: Line 39:
Source: [[CSC/ECE 517 Fall 2019 -E1974 Allow users to create an account and submit work to an ”assignment” Design]]
Source: [[CSC/ECE 517 Fall 2019 -E1974 Allow users to create an account and submit work to an ”assignment” Design]]


==Links==  
Here are some screen captures :
 
* Link to join conference
[[File:1.jpg|650px]]
 
 
* Author signup form
[[File:2.jpg|350px]]
 
* Co-author invitation page
[[File:3.jpg|650px]]
 
* Author/Co-author available assignment actions
[[File:Amol 4.jpg|650px]]
 
==Implementation Details==
 
===Creating the conference type assignment===
 
Following will be the high level steps the instructor would be performing to create a conference type assignment along with the changes required:
 
1. Instructor logs in with his credentials.
 
2. Instructor creates an assignment by checking a new check box - “Will this be a conference type of assignment”, to mark the assignment to be of conference type.
 
* This checkbox will be introduced in the Assignment’s edit page ('''app/views/assignments/edit/_general.html''')
 
3. Based on the flag, once the assignment is created, a shareable URL will be displayed on the assignments page that can be used by the Instructor to share among students/authors. They will use this URL to join the given assignment.
 
* Authors will use this assignment to submit conference papers. If author does not have account already in expertiza, a new account will be created for him.
 
===Steps for author to join conference===
 
Following will be the high level steps the Author would be performing to create an account:
 
1. Once instructor shares the joining link with potential Authors, they can use their existing expertiza accounts or create new accounts for making a team and adding submissions to the assignment. Creation of new account will not require approval from instructor/admin. Joining URL will be visible on page '''/assignments/{id}/edit '''.
 
2. When Author clicks on joining link, there could be two cases based on whether author has expertiza account or not.
 
*If Author already has an account he will be able to view the assignment assigned to him and a default team.
*If Author does not have expertiza account, he/she will be asked to put some details, pass the re-captcha test in order to create account with role as student. After account creation, Author will receive email with login ID and password.
 
3. After Author logs in, he/she can navigate to '''assignment -> Your Team''' and invite co-authors into his team for working on the submission.
 
4. When inviting the Co-Authors, Author can give Expertiza user name of Co-Author if they already exists in expertiza or Author can invite them by giving email id of Co-Author.
 
5. The role for both Author and Co-author is a student type because the difference in the 'conference type assignment' and a normal assignment is only in the way that users are added to it(i.e., by creating an account for themselves if they don't already have an account).
 
===Steps for co-author to join conference===
 
1. If Co-Author's expertiza account already exists, then he or she will be able to see conference assignment in Assignments page and "Your Team" section will be having the invite sent by the author.
 
2. If Co-Author's expertiza does not exists then he/she will receive an email with username and password and expertiza link on his/her email, that was given by author to invite the co-author. When co-author logs in with same email id or password, he/she will be able to see conference assignment in Assignments page and "Your Team" section will be having the invite sent by the author.
 
3. After that co-author can accept or reject the team invite and proceed with assignment submission.
 
===Database changes===
As part of this project, the change in the database is addition of a new column: 'is_conference_assignment' in 'Assignment' table with default value false, and value = true if the assignment is  'conference' type.
 
==Code Improvements==
 
1. We have refactored the previous code, by moving everything related to conference to 'conference_controller.rb'.
2. The helper methods for conference controller has been added to 'conference_helper.rb'.
 
3. We have also implemented re-captcha ( a form of captcha verification tool by google ) , so that bots cannot create accounts. The re-captcha code has been added in 'app/views/new.html.erb'. The re-captcha verification code has been added in 'conference_controller.rb'. This re-captcha verification is done before any author creation.
 
4. We have also added separate mailer partials for author creation and co-author invitations.
 
5. For author/co-author, we have disabled the option to review other's work. This change has been added in 'app/views/student_task/view.html.erb'
 
 
 
There is one more change that is not in the code base. For the re-captcha implementation , we had created a new set of keys from our google account. These keys are tied to our google account, and should not be used in the production code. For more information, please refer to the file :  'config/initializers/recaptcha.rb'. These keys will expire in 3 months and have to be regenerated. You can regenerate the keys with this link : https://www.google.com/recaptcha/admin/create
 
==Files Edited==
 
We have edited the following files:
 
===Controllers===
 
*conference_controller.rb : We have added new and create methods for creating conference author / co-author.
 
*invitations_controller.rb : We have modified invitations controller such that if an author invites another user to be the co-author, and if that user doesn't have an expertiza account, a new user account will be created for them automatically and those details will be sent to them via e-mail.
 
screen capture from conference_controller.rb
 
[[File:Newamol.jpg|650px]]
 
[[File:Amolcreate.png|650px]]
 
[[File:Amoladd.png|650px]]
 
===Model===
 
*mailer.rb : Added generic message template for conference user mail with its corresponding variable values.
 
===Helpers===
 
*conference_helper.rb : We have added helpers methods in this file for conference_controller.rb , invitation_controller.rb and user_controller.rb
 
*mailer_helper.rb : Added a mailer template for conference user


* Git - https://github.com/snkumar32/expertiza
===Views===
* Pull request - Coming Soon...
* Video - Coming Soon...


==Files to be edited==
*_general.html.erb : This is the assignment general view. We have added link generation if the assignment is marked as conference assignment.  
These are some of the files identified, that will require changes. Also, our observations include that most of the code has been written in the controller which is not an ideal design. We will try and push some of the code into models to better align with the design principles.


1. users_controller.rb :  
*new.html.erb : This is the view page for non expertiza users, for joining the conference.


Previous Methods added:
*view.html.erb : Modified this view, to grey out review option ( other's work link ) for conference users.
1. create_writer : for implementing the sign-up for a writer
2. new_writer : creates an instance of user class


Current proposed changes :
1. There is some repeatable code. We are planning to restructure it in such a way that it follows 'DRY' guidelines.
2. We are planning to optimize the code by eliminating unused variables.


Screen capture of new.html.erb to join conference


2. assignments_controller.rb
[[File:Amolcv.png|650px]]


Methods to be edited:
===Environment Configuration===
1. addContributor : for adding co-authors to already submitted papers
2. updateAttributes : for updating the attributes of the submitted paper
3. addReviewDetails : to control the number of reviews, etc. for a given paper


*config/environments/development.rb : Modified this file to account for changes required for sending e-mails.


3. invitations_controller.rb
<small>'''''NOTE''': As we have developed / tested the code in VCL machine with IP 152.7.98.82 and port 8080, we have changed the SMTP configuration in development.rb. We have modified '''config.action_mailer.default_url_options = { :host => 'localhost:3000' }''' to '''config.action_mailer.default_url_options = { :host => '152.7.98.82:8080', protocol: 'http'  }''' and changed port number for SMTP to 25 from 587.'' </small>


Methods to be edited:
=== Other configuration files ===
1. check_participant_before_invitation : This method checks if the user is part of an assignment that is of 'conference' type.


Finally, we have to update the corresponding views like : assignment.html.erb and user.html.erb
*config/initializers/recaptcha.rb : Modified this file for enabling re-captcha on author sign up.


==Test Plan==  
==Test Plan==  
Line 77: Line 174:
This spec would test the following scenarios when an author is inviting co-authors to join his/her team
This spec would test the following scenarios when an author is inviting co-authors to join his/her team


1) When the co-author does not have an expertiza account:
# '''When the co-author does not have an expertiza account''': It is expected that invitation create method should increase the User count by one and Invitations count by one
It is expected that invitation creation should increase the User count by one and Invitations count by one
# '''When the co-author already has an expertiza account''': It is expected that invitation create method should increase only the Invitations count by one as user is already existing
 
# '''When email entered by the author is in wrong format and co-author does not exist already''': It is expected that no new invitation should be created.
2) When the co-author already has an expertiza account:
# '''When the assignment is not of conference type and the assignment participant tries to add a teammate who does not have an expertiza account''': It is expected that no new invitation or user should be created. (Regression-testing)
It is expected that invitation creation should increase only the Invitations count by one as user is already existing
 
3) When email entered by the author is in wrong format and co-author does not exist already:
It is expected that no new invitation should be created.


4) (Regression) for a normal assignment, if author tries to add a teammate who does not have an expertiza account
====spec/controllers/conference_controller_spec.rb====
It is expected that no new invitation or user should be created.
 
====spec/controllers/users_controller_spec.rb====
This spec would test the following scenarios when an author is joining the conference assignment as a participant
This spec would test the following scenarios when an author is joining the conference assignment as a participant


1) When the author does not have an expertiza account:
# '''When the author does not have an expertiza account''': It is expected to increase both user and participant count by 1 and to give a flash success message of "You are added as an Author for assignment <assignment-name>", when the user is created.
It is expected that User count should be increased by one and participants count should increase by one
# '''When the author already has an expertiza account but is logged out''': It is expected that only participants count should increase by one and a flash success message of "You are added as an Author for assignment <assignment-name>" is displayed.
 
# '''When the author already has an expertiza account and is logged in''': It is expected that only participants count should increase by one and the response page is expected to redirect to "http://localhost:8080/student_task/list"
2) When the author already has an expertiza account but is logged out:
# '''When new user tries to join with an e-mail address that already exists in the system''' :  It is expected to return a flash error " A user with username of this email already exists, Please provide a unique email to continue."
It is expected that only participants count should increase by one
# '''When author tries to log in with correct re-captcha''': It is expected that the response page should redirect to root path.
 
# '''When author tries to login with incorrect re-captcha''': It is expected that the user count will not increase.
3) When the author already has an expertiza account and is logged in:
It is expected that only participants count should increase by one


==Team Information==  
==Team Information==  
Line 110: Line 198:
==References==
==References==


Previous work: 1[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A5_Allow_users_to_create_an_account_and_submit_work_to_an_%22assignment%22_(e.g.,_for_conference_reviewing)]
#Previous work: [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A5_Allow_users_to_create_an_account_and_submit_work_to_an_%22assignment%22_(e.g.,_for_conference_reviewing][https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-E1974_Allow_users_to_create_an_account_and_submit_work_to_an_%C3%A2%E2%82%AC%C2%9Dassignment%C3%A2%E2%82%AC%C2%9D_Design]
 
#[https://github.com/snkumar32/expertiza Forked Git Repo] 
2[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-E1974_Allow_users_to_create_an_account_and_submit_work_to_an_%C3%A2%E2%82%AC%C2%9Dassignment%C3%A2%E2%82%AC%C2%9D_Design]
#[https://github.com/expertiza/expertiza/pull/1844 Pull request]
#Video - https://youtu.be/-Eq-SMUVQOU

Latest revision as of 04:39, 27 November 2020

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. 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

Peer-assessment systems have always been separate from peer-review systems used by journals and conferences. But the two systems have a lot in common: submitting and reviewing, and guidance given to reviewers in the form of a rubric. The main differences are how accounts are created and how reviewers are assigned. In a peer-assessment system, the instructor typically creates accounts for the whole class. Reviewers are assigned either by the instructor, or automatically by the system. In conference and journal review, anyone can submit a paper. When they do, an account is implicitly created for them. They may invite their co-authors to join them; this is kind of like inviting teammates in Expertiza, except that the co-authors don’t necessarily have pre-existing accounts either, and there is typically no maximum on the number of authors for a paper.

Proposed Solution

  • We create a new controller, conference_controller.rb to manage the conference related assignments. If the assignment is tagged to be of conference type a link is generated which can be used by the user to sign up to the conference page. Furthermore, you can find a Captcha implementation which is used to verify that a legitimate user is trying to create an account. This would help maintain the integrity of the website, preventing the use of automated bots on the website.
  • Add this feature of sending out invitations by the author of the conference paper to other co-authors.
  • We use the conference_helper.rb to interconnect different modules inside Expertiza. Refactor the previous solution following proper design practices and ensured proper naming conventions are followed.
  • Ensure that new users who are not current users in the Expertiza website can sign up and join a conference assignment. The current users of the Expertiza website can also sign up in the conference assignment using the invite.

Design Plan

Use Case

  1. Author signs up: This use case assumes that the author isn't part of our expertiza database yet and wants to submit a paper for review. Assuming that the author already has the link to sign up for expertiza. The author would then have to click the link and will have to go through a captcha to verify the user identity. Then he/she will be asked to put some details to create account with role as student. After account creation, Author will receive email with login ID and password.
  2. Author submits paper to expertiza for review: Now that the author has an account, he can login to his expertiza account and then click the assignment. Then the author will have to upload his paper by clicking submit your work, then adding the link to his paper.
  3. Author sends an invitation to collaborators: If required, the author can keep adding collaborators/contributors by clicking 'your team' and inviting other participants either with their expertiza username or their e-mail id.
  4. Collaborator signs up: In this scenario there are two possible cases :
    1. Assuming that the collaborator doesn't have an existing account. They would have received a mail when they were added as collaborator, they can then login using the given username and password in that mail. After log in he/she can click your team and accept the pending invite.
    2. Assuming that the collaborator exists in the expertiza system. They would not receive any mail, they would simply get an invite in their expertiza account. They can accept the invite whenever they next log in.
  5. Review: The authors / co-authors of any conference assignment will not be able to review.

Source: CSC/ECE 517 Fall 2019 -E1974 Allow users to create an account and submit work to an ”assignment” Design

Here are some screen captures :

  • Link to join conference


  • Author signup form

  • Co-author invitation page

  • Author/Co-author available assignment actions

Implementation Details

Creating the conference type assignment

Following will be the high level steps the instructor would be performing to create a conference type assignment along with the changes required:

1. Instructor logs in with his credentials.

2. Instructor creates an assignment by checking a new check box - “Will this be a conference type of assignment”, to mark the assignment to be of conference type.

  • This checkbox will be introduced in the Assignment’s edit page (app/views/assignments/edit/_general.html)

3. Based on the flag, once the assignment is created, a shareable URL will be displayed on the assignments page that can be used by the Instructor to share among students/authors. They will use this URL to join the given assignment.

  • Authors will use this assignment to submit conference papers. If author does not have account already in expertiza, a new account will be created for him.

Steps for author to join conference

Following will be the high level steps the Author would be performing to create an account:

1. Once instructor shares the joining link with potential Authors, they can use their existing expertiza accounts or create new accounts for making a team and adding submissions to the assignment. Creation of new account will not require approval from instructor/admin. Joining URL will be visible on page /assignments/{id}/edit .

2. When Author clicks on joining link, there could be two cases based on whether author has expertiza account or not.

  • If Author already has an account he will be able to view the assignment assigned to him and a default team.
  • If Author does not have expertiza account, he/she will be asked to put some details, pass the re-captcha test in order to create account with role as student. After account creation, Author will receive email with login ID and password.

3. After Author logs in, he/she can navigate to assignment -> Your Team and invite co-authors into his team for working on the submission.

4. When inviting the Co-Authors, Author can give Expertiza user name of Co-Author if they already exists in expertiza or Author can invite them by giving email id of Co-Author.

5. The role for both Author and Co-author is a student type because the difference in the 'conference type assignment' and a normal assignment is only in the way that users are added to it(i.e., by creating an account for themselves if they don't already have an account).

Steps for co-author to join conference

1. If Co-Author's expertiza account already exists, then he or she will be able to see conference assignment in Assignments page and "Your Team" section will be having the invite sent by the author.

2. If Co-Author's expertiza does not exists then he/she will receive an email with username and password and expertiza link on his/her email, that was given by author to invite the co-author. When co-author logs in with same email id or password, he/she will be able to see conference assignment in Assignments page and "Your Team" section will be having the invite sent by the author.

3. After that co-author can accept or reject the team invite and proceed with assignment submission.

Database changes

As part of this project, the change in the database is addition of a new column: 'is_conference_assignment' in 'Assignment' table with default value false, and value = true if the assignment is 'conference' type.

Code Improvements

1. We have refactored the previous code, by moving everything related to conference to 'conference_controller.rb'.

2. The helper methods for conference controller has been added to 'conference_helper.rb'.

3. We have also implemented re-captcha ( a form of captcha verification tool by google ) , so that bots cannot create accounts. The re-captcha code has been added in 'app/views/new.html.erb'. The re-captcha verification code has been added in 'conference_controller.rb'. This re-captcha verification is done before any author creation.

4. We have also added separate mailer partials for author creation and co-author invitations.

5. For author/co-author, we have disabled the option to review other's work. This change has been added in 'app/views/student_task/view.html.erb'


There is one more change that is not in the code base. For the re-captcha implementation , we had created a new set of keys from our google account. These keys are tied to our google account, and should not be used in the production code. For more information, please refer to the file : 'config/initializers/recaptcha.rb'. These keys will expire in 3 months and have to be regenerated. You can regenerate the keys with this link : https://www.google.com/recaptcha/admin/create

Files Edited

We have edited the following files:

Controllers

  • conference_controller.rb : We have added new and create methods for creating conference author / co-author.
  • invitations_controller.rb : We have modified invitations controller such that if an author invites another user to be the co-author, and if that user doesn't have an expertiza account, a new user account will be created for them automatically and those details will be sent to them via e-mail.

screen capture from conference_controller.rb

Model

  • mailer.rb : Added generic message template for conference user mail with its corresponding variable values.

Helpers

  • conference_helper.rb : We have added helpers methods in this file for conference_controller.rb , invitation_controller.rb and user_controller.rb
  • mailer_helper.rb : Added a mailer template for conference user

Views

  • _general.html.erb : This is the assignment general view. We have added link generation if the assignment is marked as conference assignment.
  • new.html.erb : This is the view page for non expertiza users, for joining the conference.
  • view.html.erb : Modified this view, to grey out review option ( other's work link ) for conference users.


Screen capture of new.html.erb to join conference

Environment Configuration

  • config/environments/development.rb : Modified this file to account for changes required for sending e-mails.

NOTE: As we have developed / tested the code in VCL machine with IP 152.7.98.82 and port 8080, we have changed the SMTP configuration in development.rb. We have modified config.action_mailer.default_url_options = { :host => 'localhost:3000' } to config.action_mailer.default_url_options = { :host => '152.7.98.82:8080', protocol: 'http' } and changed port number for SMTP to 25 from 587.

Other configuration files

  • config/initializers/recaptcha.rb : Modified this file for enabling re-captcha on author sign up.

Test Plan

Please find the below plan to test the functionality

RSpec Tests

Please find below RSpec Test cases for this feature

spec/controllers/invitations_controller_spec.rb

This spec would test the following scenarios when an author is inviting co-authors to join his/her team

  1. When the co-author does not have an expertiza account: It is expected that invitation create method should increase the User count by one and Invitations count by one
  2. When the co-author already has an expertiza account: It is expected that invitation create method should increase only the Invitations count by one as user is already existing
  3. When email entered by the author is in wrong format and co-author does not exist already: It is expected that no new invitation should be created.
  4. When the assignment is not of conference type and the assignment participant tries to add a teammate who does not have an expertiza account: It is expected that no new invitation or user should be created. (Regression-testing)

spec/controllers/conference_controller_spec.rb

This spec would test the following scenarios when an author is joining the conference assignment as a participant

  1. When the author does not have an expertiza account: It is expected to increase both user and participant count by 1 and to give a flash success message of "You are added as an Author for assignment <assignment-name>", when the user is created.
  2. When the author already has an expertiza account but is logged out: It is expected that only participants count should increase by one and a flash success message of "You are added as an Author for assignment <assignment-name>" is displayed.
  3. When the author already has an expertiza account and is logged in: It is expected that only participants count should increase by one and the response page is expected to redirect to "http://localhost:8080/student_task/list"
  4. When new user tries to join with an e-mail address that already exists in the system : It is expected to return a flash error " A user with username of this email already exists, Please provide a unique email to continue."
  5. When author tries to log in with correct re-captcha: It is expected that the response page should redirect to root path.
  6. When author tries to login with incorrect re-captcha: It is expected that the user count will not increase.

Team Information

  • Sneha Kumar(skumar32)
  • Palash Gupta(pgupta25)
  • Sushreeta Mitra(smitra4)
  • Amol Gautam(agautam6)

References

  1. Previous work: [1][2]
  2. Forked Git Repo
  3. Pull request
  4. Video - https://youtu.be/-Eq-SMUVQOU