<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sagupta</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sagupta"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Sagupta"/>
	<updated>2026-07-13T21:21:17Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106481</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106481"/>
		<updated>2016-12-04T18:26:51Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Approach */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by displaying alert messages to the authors and the reviewers who will use the newly created Google document links embedded into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza or any google account for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png|thumb=Doceditor.png|center|alt=none|The expected display on the google documents]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png|thumb=Googledoc.png|center|alt=none|The list of hyperlinks a project author would ideally have]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situation where the peer reviewer forgets to logout would result in his/ her name being added to the history of document edits which will reveal the identity. &lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues the reviewer needs log out of the google accounts.&lt;br /&gt;
*The authors of the project by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png|thumb=can_comment.png|center|alt = ScreenShot of google document settings|ScreenShot of google document settings]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
* Also the anonymity is handled if the user directly comments on the document without login into other google accounts.&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106480</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106480"/>
		<updated>2016-12-04T18:23:08Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Project Description */ Edited Project Description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by displaying alert messages to the authors and the reviewers who will use the newly created Google document links embedded into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza or any google account for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png|thumb=Doceditor.png|center|alt=none|The expected display on the google documents]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png|thumb=Googledoc.png|center|alt=none|The list of hyperlinks a project author would ideally have]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situation where the peer reviewer forgets to logout would result in his/ her name being added to the history of document edits which will reveal the identity. &lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues the reviewer needs log out of the google accounts.&lt;br /&gt;
*The authors of the project by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png|thumb=can_comment.png|center|alt = ScreenShot of google document settings|ScreenShot of google document settings]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
* Also the anonymity is handled if the user directly comments on the document without login into other google accounts.&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106479</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106479"/>
		<updated>2016-12-04T18:15:13Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Creating Google document, Setting Up its Link */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png|thumb=Doceditor.png|center|alt=none|The expected display on the google documents]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png|thumb=Googledoc.png|center|alt=none|The list of hyperlinks a project author would ideally have]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situation where the peer reviewer forgets to logout would result in his/ her name being added to the history of document edits which will reveal the identity. &lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues the reviewer needs log out of the google accounts.&lt;br /&gt;
*The authors of the project by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png|thumb=can_comment.png|center|alt = ScreenShot of google document settings|ScreenShot of google document settings]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
* Also the anonymity is handled if the user directly comments on the document without login into other google accounts.&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106478</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106478"/>
		<updated>2016-12-04T18:12:03Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Security Risks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situation where the peer reviewer forgets to logout would result in his/ her name being added to the history of document edits which will reveal the identity. &lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues the reviewer needs log out of the google accounts.&lt;br /&gt;
*The authors of the project by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png|thumb=can_comment.png|center|alt = ScreenShot of google document settings|ScreenShot of google document settings]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
* Also the anonymity is handled if the user directly comments on the document without login into other google accounts.&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106477</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106477"/>
		<updated>2016-12-04T18:08:56Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Security Risks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situation where the peer reviewer forgets to logout would result in his/ her name being added to the history of document edits which will reveal the identity. &lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues the reviewer needs log out of the google accounts.&lt;br /&gt;
*The authors of the project by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png|center|alt = ScreenShot of google document settings|ScreenShot of google document settings]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
* Also the anonymity is handled if the user directly comments on the document without login into other google accounts.&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106476</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106476"/>
		<updated>2016-12-04T18:07:44Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Security Risks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situation where the peer reviewer forgets to logout would result in his/ her name being added to the history of document edits which will reveal the identity. &lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues the reviewer needs log out of the google accounts.&lt;br /&gt;
*The authors of the project by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png|thumb|center|alt = ScreenShot of google document settings|ScreenShot of google document settings]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
* Also the anonymity is handled if the user directly comments on the document without login into other google accounts.&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106475</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106475"/>
		<updated>2016-12-04T18:07:05Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Security Risks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situation where the peer reviewer forgets to logout would result in his/ her name being added to the history of document edits which will reveal the identity. &lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues the reviewer needs log out of the google accounts.&lt;br /&gt;
*The authors of the project by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png|center|alt = ScreenShot of google document settings|ScreenShot of google document settings]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
* Also the anonymity is handled if the user directly comments on the document without login into other google accounts.&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106474</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106474"/>
		<updated>2016-12-04T18:04:42Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Security Risks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situation where the peer reviewer forgets to logout would result in his/ her name being added to the history of document edits which will reveal the identity. &lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues the reviewer needs log out of the google accounts.&lt;br /&gt;
*The authors of the project by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png|center|alt=Alt|ScreenShot of google document settings]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
* Also the anonymity is handled if the user directly comments on the document without login into other google accounts.&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106473</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106473"/>
		<updated>2016-12-04T18:01:57Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Security Risks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situation where the peer reviewer forgets to logout would result in his/ her name being added to the history of document edits which will reveal the identity. &lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues the reviewer needs log out of the google accounts.&lt;br /&gt;
*The authors of the project by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png|center|&amp;quot;ScreenShot of google document settings&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
* Also the anonymity is handled if the user directly comments on the document without login into other google accounts.&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106472</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106472"/>
		<updated>2016-12-04T18:01:31Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Security Risks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situation where the peer reviewer forgets to logout would result in his/ her name being added to the history of document edits which will reveal the identity. &lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues the reviewer needs log out of the google accounts.&lt;br /&gt;
*The authors of the project by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png|center|ScreenShot of google document settings]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
* Also the anonymity is handled if the user directly comments on the document without login into other google accounts.&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106471</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106471"/>
		<updated>2016-12-04T18:00:21Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Security Risks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situation where the peer reviewer forgets to logout would result in his/ her name being added to the history of document edits which will reveal the identity. &lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues the reviewer needs log out of the google accounts.&lt;br /&gt;
*The authors of the project by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
* Also the anonymity is handled if the user directly comments on the document without login into other google accounts.&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106470</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106470"/>
		<updated>2016-12-04T17:55:15Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Security Risks */ edited all security content&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situation where the peer reviewer forgets to logout would result in his/ her name being added to the history of document edits which will reveal the identity. &lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues the reviewer needs log out of the google accounts.&lt;br /&gt;
*The authors of the project by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
* Also the anonymity is handled if the user directly comments on the document without login into other google accounts.&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106469</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106469"/>
		<updated>2016-12-04T17:42:07Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Key Points To Consider */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
* The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
* The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situtation where more than one people comment on the doc and mess up the content.&lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues we'll be modifying the access rights of the google doc associated with that project.&lt;br /&gt;
*We'll by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106468</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106468"/>
		<updated>2016-12-04T17:41:37Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Key Points To Consider */ edited the points to consider&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
The alert message should only pop up when the faculty as indicated to do so &lt;br /&gt;
The Google doc link needs to be added on the submissions page by the author of the project&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot; by the author&lt;br /&gt;
* A peer reviewer needs be directed not login to any Google account to comment on the doc, and all peer reviewer comments shall be anonymous&lt;br /&gt;
* Multiple commenting at a specific instance is taken care of by the google document settings and it will be placed one below the other.&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situtation where more than one people comment on the doc and mess up the content.&lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues we'll be modifying the access rights of the google doc associated with that project.&lt;br /&gt;
*We'll by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106467</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106467"/>
		<updated>2016-12-04T06:30:06Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Approach */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
The Google doc editor needs to be embedded in expertiza or it should be made as a pop up window&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot;&lt;br /&gt;
* A peer reviewer need not login to Google to comment on the doc, and all peer reviewer comments must be anonymous&lt;br /&gt;
* If more than one user comment on the Google doc at the same time, any conflicts that may arise should be handled well&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situtation where more than one people comment on the doc and mess up the content.&lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues we'll be modifying the access rights of the google doc associated with that project.&lt;br /&gt;
*We'll by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106466</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106466"/>
		<updated>2016-12-04T06:29:12Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Approach */ added the approach and modified the database developements&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
The Google doc editor needs to be embedded in expertiza or it should be made as a pop up window&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot;&lt;br /&gt;
* A peer reviewer need not login to Google to comment on the doc, and all peer reviewer comments must be anonymous&lt;br /&gt;
* If more than one user comment on the Google doc at the same time, any conflicts that may arise should be handled well&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
The first phase of our project aimed at embedding a google a document which enables the project author to automatically generate a google document with specified permissions for the reviews such that when a reviewer makes a comment it appears without his identity. &lt;br /&gt;
We succeeded in authorizing the user to the google documents by using the google-client-API (aouth + signet) credentials and the API console also showed positive results for the &amp;quot;request&amp;quot; sent over to the client and created a google document but to access that particular binary file we had to set the permission rights of the service account for which the google document is created which is different from the credentials account.  We also tried hard coding and giving all access rights to anyone who wanted to open the file but it seems practically impossible to get those rights. &lt;br /&gt;
&lt;br /&gt;
The second half of the project aimed at creating a flash dialog box which directs the author to set the comment rights on the review google document as decided by the professor subject to the condition and complexity of the project. This will happen on the go and the author is notified to &amp;quot;enable commenting rights only&amp;quot; only if the faculty checks the option for that particular project. &lt;br /&gt;
On the other side whenever the reviewers click on the google document link attached to the project for reviewing or commenting on a project they will get a notification alert to log out of all google accounts in order to assure the anonymity of the reviewer. This is done because google documents does not support complete anonymity.    &lt;br /&gt;
In this the assumption is that the google doc is created in the same manner as the other hyperlinks are added. Additionally whenever the  the which will be already created by the author        &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situtation where more than one people comment on the doc and mess up the content.&lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues we'll be modifying the access rights of the google doc associated with that project.&lt;br /&gt;
*We'll by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106465</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106465"/>
		<updated>2016-12-04T05:40:41Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Project File and Database additions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
The Google doc editor needs to be embedded in expertiza or it should be made as a pop up window&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot;&lt;br /&gt;
* A peer reviewer need not login to Google to comment on the doc, and all peer reviewer comments must be anonymous&lt;br /&gt;
* If more than one user comment on the Google doc at the same time, any conflicts that may arise should be handled well&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
 &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situtation where more than one people comment on the doc and mess up the content.&lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues we'll be modifying the access rights of the google doc associated with that project.&lt;br /&gt;
*We'll by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input &lt;br /&gt;
* The submitted_content view file '_main.html.erb' has the button to upload the google doc link.&lt;br /&gt;
* The 'submitted_content_controller.erb' has the code which directs the author to enable the anonymous commenting.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106460</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106460"/>
		<updated>2016-12-04T04:16:37Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Project File and Database additions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
The Google doc editor needs to be embedded in expertiza or it should be made as a pop up window&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot;&lt;br /&gt;
* A peer reviewer need not login to Google to comment on the doc, and all peer reviewer comments must be anonymous&lt;br /&gt;
* If more than one user comment on the Google doc at the same time, any conflicts that may arise should be handled well&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
 &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situtation where more than one people comment on the doc and mess up the content.&lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues we'll be modifying the access rights of the google doc associated with that project.&lt;br /&gt;
*We'll by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table 'assignments' and we have made a change to the schema of the table by adding a column 'allow_anonymous_commenting' of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: '_add_allow_anonymous_commenting_to_assignemnnts.rb'&lt;br /&gt;
* The 'factories' file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* '_genral.html.erb' page in the edit assignments view has a 'check box' and a label added to it. &lt;br /&gt;
* A function is added in the 'assignments_form' model which sets the visibility to false/ true depending on the input      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106459</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106459"/>
		<updated>2016-12-04T04:04:34Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Project File and Database additions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
The Google doc editor needs to be embedded in expertiza or it should be made as a pop up window&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot;&lt;br /&gt;
* A peer reviewer need not login to Google to comment on the doc, and all peer reviewer comments must be anonymous&lt;br /&gt;
* If more than one user comment on the Google doc at the same time, any conflicts that may arise should be handled well&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
 &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situtation where more than one people comment on the doc and mess up the content.&lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues we'll be modifying the access rights of the google doc associated with that project.&lt;br /&gt;
*We'll by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table &amp;quot;assignments&amp;quot; and we have made a change to the schema of the table by adding a column &amp;quot;allow_anonymous_commenting&amp;quot; of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: _add_allow_anonymous_commenting_to_assignemnnts.rb&lt;br /&gt;
* The factories file in the spec has a variable added with the default value set as 'FALSE'&lt;br /&gt;
* _genral.html.erb page in the edit assignments view has a 'check box' and a label added to it.      &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106458</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106458"/>
		<updated>2016-12-04T03:58:46Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Project File and Database additions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
The Google doc editor needs to be embedded in expertiza or it should be made as a pop up window&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot;&lt;br /&gt;
* A peer reviewer need not login to Google to comment on the doc, and all peer reviewer comments must be anonymous&lt;br /&gt;
* If more than one user comment on the Google doc at the same time, any conflicts that may arise should be handled well&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
 &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situtation where more than one people comment on the doc and mess up the content.&lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues we'll be modifying the access rights of the google doc associated with that project.&lt;br /&gt;
*We'll by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table &amp;quot;assignments&amp;quot; and we have made a change to the schema of the table by adding a column &amp;quot;allow_anonymous_commenting&amp;quot; of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* To incorporate the data base changes we generated a migration file in the &amp;quot;db&amp;quot; migrate named: _add_allow_anonymous_commenting_to_assignemnnts.rb&lt;br /&gt;
* The factories file in the spec has a variable added with the default value set as 'FALSE'   &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106454</id>
		<title>CSC/ECE 517 Fall 2016/ E1700 Integrate Google doc editor/viewer</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/_E1700_Integrate_Google_doc_editor/viewer&amp;diff=106454"/>
		<updated>2016-12-04T00:37:21Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Project File and Database additions */ added the database change so far&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Expertiza Background'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
&lt;br /&gt;
Currently the instructor creates rubrics for an assignment through questionnaires which students use to review other students' submissions. The only way reviewers can suggest some more changes to the author is by using the 'additional comments' section in the review form which is not very helpful. In this project we will be looking towards improving this functionality by adding an extra medium through which multiple reviewers can collectively comment on the author's work and collaborate their answers in a constructive way. This will be achieved by embedding Google docs into Expertiza. Every project will have a Google doc link for itself which the reviewers can access and make further comments about the project. Once on the Google doc, the reviewer's comments will be posted anonymously, the reviewer's comment will be anonymous to both, other fellow reviewers as well as the author. This feature will help the author to better understand where is his work exactly lacking and how exactly should the changes be worked upon based on the comments received. The reviewers will just need the Google doc link to post comments and it wouldn't be required to login into Expertiza for using this feature.&lt;br /&gt;
&lt;br /&gt;
== '''Key Points To Consider''' ==&lt;br /&gt;
&lt;br /&gt;
The Google doc editor needs to be embedded in expertiza or it should be made as a pop up window&lt;br /&gt;
* The settings for the Google doc should be set to &amp;quot;anyone with link can comment&amp;quot;&lt;br /&gt;
* A peer reviewer need not login to Google to comment on the doc, and all peer reviewer comments must be anonymous&lt;br /&gt;
* If more than one user comment on the Google doc at the same time, any conflicts that may arise should be handled well&lt;br /&gt;
&lt;br /&gt;
== '''Approach''' ==&lt;br /&gt;
&lt;br /&gt;
Generally, we can always create a Google document, slide presentation, or spreadsheet using Google Drive and then embed that document anywhere in our application using iFrame as a dynamic rich content editor. The rich content editor is used in features that support the editor (Announcements, Quizzes or Collaborative Reviewing in our case). Any time you make changes to the Google document (like comments), it will be automatically updated in the application's content editor.&lt;br /&gt;
 &lt;br /&gt;
===Creating Google document, Setting Up its Link===&lt;br /&gt;
&lt;br /&gt;
* First and foremost a provision (button) for creating a Google document is added to the ''Your Work'' page of ''Assignments''.&lt;br /&gt;
* When the authors would select this button before submitting their assignment, a new Google doc is created.&lt;br /&gt;
* The document's Sharing criteria is set using google docs API such that the authors of the team can edit the document.&lt;br /&gt;
* Sharing criteria is also set such that anyone else having the link to this document can only comment.&lt;br /&gt;
* The authors would then copy paste their content, to be reviewed, on to the document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Doceditor.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Now the file sharable link must be pasted while submitting an Assignment in expertiza as shown below.&lt;br /&gt;
* The new Google doc link will be saved with other hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Googledoc.png]]&lt;br /&gt;
&lt;br /&gt;
===Publishing the document to Web===&lt;br /&gt;
&lt;br /&gt;
* Open the File menu in Google doc and select Publish to the web....&lt;br /&gt;
* Make sure that the Automatically republish when changes are made checkbox is selected. Click the Start publishing button.&lt;br /&gt;
* When a confirmation prompt pops up, click the OK button.&lt;br /&gt;
* Click on the Embed tab to get the below screen, now copy the text in order to use it in our expertiza code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Publish.png]]&lt;br /&gt;
&lt;br /&gt;
===Security Risks===&lt;br /&gt;
&lt;br /&gt;
As mentioned in the requirement document, there are 2 security risks associated with this project, they are:&lt;br /&gt;
*A situtation where more than one people comment on the doc and mess up the content.&lt;br /&gt;
*Possible security violations like an user with access to the link deletes all the content on that doc.&lt;br /&gt;
&lt;br /&gt;
Proposed solution to mitigate the risk:&lt;br /&gt;
*To address these two issues we'll be modifying the access rights of the google doc associated with that project.&lt;br /&gt;
*We'll by default assign all new users who access the page only the 'can comment' access right and only the author team will have 'can edit' rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:can_comment.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*As it can be seen, Google doc has 3 access levels and the 'can comment' option will allow the users only to add more comments on the Google doc. They won't be able to edit or delete previously entered comments.&lt;br /&gt;
*Doing this will ensure that no user even unintentionally will be able to delete or edit previous comments which might be of great value to the authors of that project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Embedding the document editor in expertiza===&lt;br /&gt;
&lt;br /&gt;
* Our aim is to incorporate the dynamic content editor in the Review Assignments page, so that all the users can make collaborative suggestions in the document at the time of Review.&lt;br /&gt;
* In order to embed this editor, the code needs to be added in the View page for student responses. &lt;br /&gt;
* For example, to embed the editor for Assignment Responses the above code must be incorporated in the view.html.erb file in the response View, as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Iframecode.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On building the code and running expertiza, we must be able to see the Google doc editor successfully embedded in the Assignment Reviews page.&lt;br /&gt;
* In the below image, we can see the frame where the saved Google doc is embedded. Instead of embedding the doc, we can also have a pop-up window of the doc.&lt;br /&gt;
* All the text in ''black'' in the below image, is the content added by the authors. Hence this cannot be edited by the reviewers.&lt;br /&gt;
* The text in colored font are the comments made by reviewers. The below comments have been written for illustrations sake.&lt;br /&gt;
* The comments in reality would be different and will be shown on the right side of the document page. (We can correlate this with comments made in MS Word document)&lt;br /&gt;
* The users need not login to Google in order to comment in the document. Hence, the comments made will be anonymous.&lt;br /&gt;
* If the users are already logged in to Google, constraints will be set such that their ''ID'' is hidden and their comments are still made anonymous.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Embeddoc.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Project File and Database additions''' ==&lt;br /&gt;
&lt;br /&gt;
* The new outcome will involve accessing the data base table &amp;quot;assignments&amp;quot; and we have made a change to the schema of the table by adding a column &amp;quot;allow_anonymous_commenting&amp;quot; of the type 'Boolean' to indicate whether the professor has asked the project developers to have a review document created with the rights of anonymous comments.  &lt;br /&gt;
* Newly added Google doc hyperlinks will be saved with other assignment hyperlinks in the 'submitted_hyperlinks' column of 'teams' table.&lt;br /&gt;
* The iFrame tag will be added to the 'view.html.erb' file in 'response' View in order to embed the Google doc.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
&lt;br /&gt;
This UI enhancement will be tested to check whether the following required functionalities are implemented successfully:&lt;br /&gt;
&lt;br /&gt;
i. Any user having the doc link should only be able to comment on the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
ii. Changes made in the original Google doc should be reflected in the embedded doc editor in expertiza &amp;lt;br&amp;gt;&lt;br /&gt;
iii. Users need not login to comment in the Google doc&amp;lt;br&amp;gt;&lt;br /&gt;
iv. All comments made must be anonymous&amp;lt;br&amp;gt;&lt;br /&gt;
v. Multiple comments made at the same time should not lead to any conflicts &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
&lt;br /&gt;
*[https://community.canvaslms.com/docs/DOC-1885  Guide to Embedding Google doc editor]&lt;br /&gt;
*[https://expertiza.ncsu.edu/ Expertiza application]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Ruby_on_Rails  Ruby on Rails]&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103818</id>
		<title>CSC/ECE 517 Fall 2016/E1659. Refactor on the fly calc.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103818"/>
		<updated>2016-10-29T03:45:03Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1659 OSS assignment for Fall 2016, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student5431,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student5427,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
We worked on a module named on_the_fly_calc in this Expertiza based OSS project. We focussed on refactoring some methods which were very complex and also modified the language of the module to make it more ruby-istic. We also worked on refactoring the code to reduce redundancy. Our goal in this project was to make this model easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
A model was modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. On_the_fly_calc&lt;br /&gt;
&lt;br /&gt;
=== On_the_fly_calc ===&lt;br /&gt;
&lt;br /&gt;
On_the_fly_calc is a module that is included in assignment.rb. What this module does is that it calculates the score for both students and instructors. E.g., when a student clicks “view my score”, Expertiza calculates the review scores for each review. This is called “on the fly” because expertiza stores the review scores based on each question (in answers table), but does not store the total score that a reviewer gives to a reviewee. It directly calculates the total review score for each review, using the score values in the answer table during run-time.&lt;br /&gt;
Eg: For a set of 4 questions a reviewer gives 5 on 5 points for 2 questions and 4 on 5 points for other 2 questions. So only these points are stored in the database and when a reviewee clicks to see the score given by this particular reviewer, on_the_fly_calc module helps calculate the total score i.e. 90% in this case.&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
The main aim was to reduce the complexity grade of ‘on_the_fly_calc.rb’ module from “F” to “C” in CodeClimate, which was achieved. We worked on the following work items(WIs) in order to refactor the module:&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor ‘Similar Code’ in lines 34-42 and 62-70 in on_the_fly_calc.rb&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Prefer ‘each’ over every instance of ‘for loop’ &amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor ‘scores’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Refactor ‘compute_reviews_hash’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Refactor ‘compute_avg_and_ranges_hash’ method to reduce ABC (assignment, branch and condition) size&lt;br /&gt;
&lt;br /&gt;
=== Solutions Implemented and Delivered ===&lt;br /&gt;
&lt;br /&gt;
==== Refactored similar code ====&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 and 62-70 were similar in compute_reviews_hash method. Hence, a dedicated method ‘calc_review_score’ was defined and this method was called in the both instances inside compute_reviews_hash.&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 in compute_reviews_hash:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similar code in Lines 62-70:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactored method 'calc_review_score' for the two similar codes:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Same code method.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Each loop prefered over For loop ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In every instance where ‘for’ loops were used in on_the_fly_calc module, ‘each…do’ was replaced instead. This significantly reduced the Cyclomatic complexity of the code. &lt;br /&gt;
&lt;br /&gt;
The following screen shows the instances where for loops where replaced:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Eachloop.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Refactored methods - 'scores', 'compute_reviews_hash', 'compute_avg_and_ranges_hash'  ====&lt;br /&gt;
&lt;br /&gt;
1. a) Method ‘scores’ was very complex, performing too many functions within a single method. Hence, every specific function was broken down into 4 separate smaller methods. This significantly reduced the Assignment, Branch, Condition size for ‘scores’ method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def scores(questions)&lt;br /&gt;
    scores = {}&lt;br /&gt;
    score_team = scores[:teams][index.to_s.to_sym]&lt;br /&gt;
    score = score_team[:scores]&lt;br /&gt;
    scores[:participants] = {}&lt;br /&gt;
    participant_score          #New method defined - participant_score&lt;br /&gt;
    scores[:teams] = {}&lt;br /&gt;
    index = 0&lt;br /&gt;
    self.teams.each do |team|&lt;br /&gt;
      score_team = {}&lt;br /&gt;
      score_team[:team] = team&lt;br /&gt;
      if self.varying_rubrics_by_round?&lt;br /&gt;
        assess                #New method defined - assess&lt;br /&gt;
        calculate_score       #New method defined - calculate_score&lt;br /&gt;
        calculate_assessment  #New method defined - calculate_assessment&lt;br /&gt;
      else&lt;br /&gt;
        assessments = ReviewResponseMap.get_assessments_for(team)&lt;br /&gt;
        score = Answer.compute_scores(assessments, questions[:review])&lt;br /&gt;
      end&lt;br /&gt;
      index += 1&lt;br /&gt;
    end&lt;br /&gt;
    scores&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b) The following 4 methods were created after splitting the first method&amp;lt;br&amp;gt;&lt;br /&gt;
i.  participant_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def participant_score&lt;br /&gt;
  self.participants.each do |participant|&lt;br /&gt;
    scores[:participants][participant.id.to_s.to_sym] = participant.scores(questions)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ii. assess&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def assess&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    total_score = 0&lt;br /&gt;
    total_num_of_assessments = 0 # calculate grades for each rounds&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    assessments = ReviewResponseMap.get_assessments_round_for(team, i)&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    round = Answer.compute_scores(assessments, questions[round_sym])&lt;br /&gt;
    total_num_of_assessments += assessments.size&lt;br /&gt;
    total_score += round[:avg] * assessments.size.to_f unless round[:avg].nil?&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iii. calculate_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_score&lt;br /&gt;
  score = {}&lt;br /&gt;
  score[:max] = -999_999_999&lt;br /&gt;
  score[:min] = 999_999_999&lt;br /&gt;
  score[:avg] = 0&lt;br /&gt;
  grades_by_rounds = {}&lt;br /&gt;
  round = grades_by_rounds[round_sym]&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    score[:max] = round[:max] if max_condition&lt;br /&gt;
    score[:min] = round[:min] if min_condition&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iv. calculate_assessment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_assessment&lt;br /&gt;
  if total_num_of_assessments.nonzero?&lt;br /&gt;
    score[:avg] = total_score / total_num_of_assessments&lt;br /&gt;
  else&lt;br /&gt;
    score[:avg] = nil&lt;br /&gt;
    score[:max] = 0&lt;br /&gt;
    score[:min] = 0&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c) Complex and long statements or loops were broken into simpler multiple statements.&lt;br /&gt;
&lt;br /&gt;
For example, the unless condition in Lines 132-134 was refactored to Line 127. This reduced the Perceived Complexity of 'scores' method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Conditionsimpler.png]]&lt;br /&gt;
&lt;br /&gt;
2. a) We also refactored method ‘compute_reviews_hash’ which was very complex and modularized individual functionalities into 2 separate methods.&lt;br /&gt;
b) The following 2 methods were created and called after refactoring:&amp;lt;br&amp;gt;&lt;br /&gt;
i.  scores_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
ii. scores_non_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Similarly, method ‘compute_avg_and_ranges_hash’ was also refactored and a seperate method calc_contri_score was defined to calculate contributor’s score. This method was then called from ‘compute_avg_and_ranges_hash’.&lt;br /&gt;
&lt;br /&gt;
[[File:rsz_unnamed.png]]&lt;br /&gt;
  The Code Climate Grade Before Regactoring&lt;br /&gt;
&lt;br /&gt;
[[File:rsz_1after.png]] &lt;br /&gt;
  The Code Climate Grade After Regactoring&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
====UI Testing====&lt;br /&gt;
&lt;br /&gt;
Login into Expertiza as a student or an instructor. Go to an assignment which has some reviews for a previous project and click on view scores. The total score for a review is calculated on the fly using this module. You will be able to see the average score that each reviewer gave you on the top right of your page. This ensured that the refactoring done by us didn't break the code and it delivered it's expected functionality.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
Every code has future improvements possible. We have evolved the Code Climate Grade 'F' to a Grade 'C' currently by removing the Cyclomatic complexity, the Perceived Complexity and replaced with the &amp;quot;for&amp;quot; with the 'each' to reduce the size .&lt;br /&gt;
There are modifications that can still reduce the &amp;quot;ABC&amp;quot; Assignment Branches and Conditions Score as we can include the variables and functions in the &amp;quot;before action clauses&amp;quot;, and rename long names with shorter yet appropriate names thus moving towards the score of &amp;quot;A&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Rsz_1after.png&amp;diff=103815</id>
		<title>File:Rsz 1after.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Rsz_1after.png&amp;diff=103815"/>
		<updated>2016-10-29T03:42:50Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: After refactoring code grade&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;After refactoring code grade&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103811</id>
		<title>CSC/ECE 517 Fall 2016/E1659. Refactor on the fly calc.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103811"/>
		<updated>2016-10-29T03:39:23Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1659 OSS assignment for Fall 2016, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student5431,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student5427,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
We worked on a module named on_the_fly_calc in this Expertiza based OSS project. We focussed on refactoring some methods which were very complex and also modified the language of the module to make it more ruby-istic. We also worked on refactoring the code to reduce redundancy. Our goal in this project was to make this model easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
A model was modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. On_the_fly_calc&lt;br /&gt;
&lt;br /&gt;
=== On_the_fly_calc ===&lt;br /&gt;
&lt;br /&gt;
On_the_fly_calc is a module that is included in assignment.rb. What this module does is that it calculates the score for both students and instructors. E.g., when a student clicks “view my score”, Expertiza calculates the review scores for each review. This is called “on the fly” because expertiza stores the review scores based on each question (in answers table), but does not store the total score that a reviewer gives to a reviewee. It directly calculates the total review score for each review, using the score values in the answer table during run-time.&lt;br /&gt;
Eg: For a set of 4 questions a reviewer gives 5 on 5 points for 2 questions and 4 on 5 points for other 2 questions. So only these points are stored in the database and when a reviewee clicks to see the score given by this particular reviewer, on_the_fly_calc module helps calculate the total score i.e. 90% in this case.&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
The main aim was to reduce the complexity grade of ‘on_the_fly_calc.rb’ module from “F” to “C” in CodeClimate, which was achieved. We worked on the following work items(WIs) in order to refactor the module:&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor ‘Similar Code’ in lines 34-42 and 62-70 in on_the_fly_calc.rb&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Prefer ‘each’ over every instance of ‘for loop’ &amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor ‘scores’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Refactor ‘compute_reviews_hash’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Refactor ‘compute_avg_and_ranges_hash’ method to reduce ABC (assignment, branch and condition) size&lt;br /&gt;
&lt;br /&gt;
=== Solutions Implemented and Delivered ===&lt;br /&gt;
&lt;br /&gt;
==== Refactored similar code ====&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 and 62-70 were similar in compute_reviews_hash method. Hence, a dedicated method ‘calc_review_score’ was defined and this method was called in the both instances inside compute_reviews_hash.&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 in compute_reviews_hash:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similar code in Lines 62-70:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactored method 'calc_review_score' for the two similar codes:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Same code method.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Each loop prefered over For loop ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In every instance where ‘for’ loops were used in on_the_fly_calc module, ‘each…do’ was replaced instead. This significantly reduced the Cyclomatic complexity of the code. &lt;br /&gt;
&lt;br /&gt;
The following screen shows the instances where for loops where replaced:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Eachloop.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Refactored methods - 'scores', 'compute_reviews_hash', 'compute_avg_and_ranges_hash'  ====&lt;br /&gt;
&lt;br /&gt;
1. a) Method ‘scores’ was very complex, performing too many functions within a single method. Hence, every specific function was broken down into 4 separate smaller methods. This significantly reduced the Assignment, Branch, Condition size for ‘scores’ method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def scores(questions)&lt;br /&gt;
    scores = {}&lt;br /&gt;
    score_team = scores[:teams][index.to_s.to_sym]&lt;br /&gt;
    score = score_team[:scores]&lt;br /&gt;
    scores[:participants] = {}&lt;br /&gt;
    participant_score          #New method defined - participant_score&lt;br /&gt;
    scores[:teams] = {}&lt;br /&gt;
    index = 0&lt;br /&gt;
    self.teams.each do |team|&lt;br /&gt;
      score_team = {}&lt;br /&gt;
      score_team[:team] = team&lt;br /&gt;
      if self.varying_rubrics_by_round?&lt;br /&gt;
        assess                #New method defined - assess&lt;br /&gt;
        calculate_score       #New method defined - calculate_score&lt;br /&gt;
        calculate_assessment  #New method defined - calculate_assessment&lt;br /&gt;
      else&lt;br /&gt;
        assessments = ReviewResponseMap.get_assessments_for(team)&lt;br /&gt;
        score = Answer.compute_scores(assessments, questions[:review])&lt;br /&gt;
      end&lt;br /&gt;
      index += 1&lt;br /&gt;
    end&lt;br /&gt;
    scores&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b) The following 4 methods were created after splitting the first method&amp;lt;br&amp;gt;&lt;br /&gt;
i.  participant_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def participant_score&lt;br /&gt;
  self.participants.each do |participant|&lt;br /&gt;
    scores[:participants][participant.id.to_s.to_sym] = participant.scores(questions)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ii. assess&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def assess&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    total_score = 0&lt;br /&gt;
    total_num_of_assessments = 0 # calculate grades for each rounds&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    assessments = ReviewResponseMap.get_assessments_round_for(team, i)&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    round = Answer.compute_scores(assessments, questions[round_sym])&lt;br /&gt;
    total_num_of_assessments += assessments.size&lt;br /&gt;
    total_score += round[:avg] * assessments.size.to_f unless round[:avg].nil?&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iii. calculate_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_score&lt;br /&gt;
  score = {}&lt;br /&gt;
  score[:max] = -999_999_999&lt;br /&gt;
  score[:min] = 999_999_999&lt;br /&gt;
  score[:avg] = 0&lt;br /&gt;
  grades_by_rounds = {}&lt;br /&gt;
  round = grades_by_rounds[round_sym]&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    score[:max] = round[:max] if max_condition&lt;br /&gt;
    score[:min] = round[:min] if min_condition&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iv. calculate_assessment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_assessment&lt;br /&gt;
  if total_num_of_assessments.nonzero?&lt;br /&gt;
    score[:avg] = total_score / total_num_of_assessments&lt;br /&gt;
  else&lt;br /&gt;
    score[:avg] = nil&lt;br /&gt;
    score[:max] = 0&lt;br /&gt;
    score[:min] = 0&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c) Complex and long statements or loops were broken into simpler multiple statements.&lt;br /&gt;
&lt;br /&gt;
For example, the unless condition in Lines 132-134 was refactored to Line 127. This reduced the Perceived Complexity of 'scores' method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Conditionsimpler.png]]&lt;br /&gt;
&lt;br /&gt;
2. a) We also refactored method ‘compute_reviews_hash’ which was very complex and modularized individual functionalities into 2 separate methods.&lt;br /&gt;
b) The following 2 methods were created and called after refactoring:&amp;lt;br&amp;gt;&lt;br /&gt;
i.  scores_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
ii. scores_non_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Similarly, method ‘compute_avg_and_ranges_hash’ was also refactored and a seperate method calc_contri_score was defined to calculate contributor’s score. This method was then called from ‘compute_avg_and_ranges_hash’.&lt;br /&gt;
&lt;br /&gt;
[[File:rsz_unnamed.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
====UI Testing====&lt;br /&gt;
&lt;br /&gt;
Login into Expertiza as a student or an instructor. Go to an assignment which has some reviews for a previous project and click on view scores. The total score for a review is calculated on the fly using this module. You will be able to see the average score that each reviewer gave you on the top right of your page. This ensured that the refactoring done by us didn't break the code and it delivered it's expected functionality.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
Every code has future improvements possible. We have evolved the Code Climate Grade 'F' to a Grade 'C' currently by removing the Cyclomatic complexity, the Perceived Complexity and replaced with the &amp;quot;for&amp;quot; with the 'each' to reduce the size .&lt;br /&gt;
There are modifications that can still reduce the &amp;quot;ABC&amp;quot; Assignment Branches and Conditions Score as we can include the variables and functions in the &amp;quot;before action clauses&amp;quot;, and rename long names with shorter yet appropriate names thus moving towards the score of &amp;quot;A&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Rsz_unnamed.png&amp;diff=103809</id>
		<title>File:Rsz unnamed.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Rsz_unnamed.png&amp;diff=103809"/>
		<updated>2016-10-29T03:38:14Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: Code Climate Grade Before Refactoring&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Code Climate Grade Before Refactoring&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103801</id>
		<title>CSC/ECE 517 Fall 2016/E1659. Refactor on the fly calc.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103801"/>
		<updated>2016-10-29T03:31:48Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1659 OSS assignment for Fall 2016, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student5431,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student5427,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
We worked on a module named on_the_fly_calc in this Expertiza based OSS project. We focussed on refactoring some methods which were very complex and also modified the language of the module to make it more ruby-istic. We also worked on refactoring the code to reduce redundancy. Our goal in this project was to make this model easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
A model was modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. On_the_fly_calc&lt;br /&gt;
&lt;br /&gt;
=== On_the_fly_calc ===&lt;br /&gt;
&lt;br /&gt;
On_the_fly_calc is a module that is included in assignment.rb. What this module does is that it calculates the score for both students and instructors. E.g., when a student clicks “view my score”, Expertiza calculates the review scores for each review. This is called “on the fly” because expertiza stores the review scores based on each question (in answers table), but does not store the total score that a reviewer gives to a reviewee. It directly calculates the total review score for each review, using the score values in the answer table during run-time.&lt;br /&gt;
Eg: For a set of 4 questions a reviewer gives 5 on 5 points for 2 questions and 4 on 5 points for other 2 questions. So only these points are stored in the database and when a reviewee clicks to see the score given by this particular reviewer, on_the_fly_calc module helps calculate the total score i.e. 90% in this case.&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
The main aim was to reduce the complexity grade of ‘on_the_fly_calc.rb’ module from “F” to “C” in CodeClimate, which was achieved. We worked on the following work items(WIs) in order to refactor the module:&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor ‘Similar Code’ in lines 34-42 and 62-70 in on_the_fly_calc.rb&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Prefer ‘each’ over every instance of ‘for loop’ &amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor ‘scores’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Refactor ‘compute_reviews_hash’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Refactor ‘compute_avg_and_ranges_hash’ method to reduce ABC (assignment, branch and condition) size&lt;br /&gt;
&lt;br /&gt;
=== Solutions Implemented and Delivered ===&lt;br /&gt;
&lt;br /&gt;
==== Refactored similar code ====&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 and 62-70 were similar in compute_reviews_hash method. Hence, a dedicated method ‘calc_review_score’ was defined and this method was called in the both instances inside compute_reviews_hash.&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 in compute_reviews_hash:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similar code in Lines 62-70:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactored method 'calc_review_score' for the two similar codes:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Same code method.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Each loop prefered over For loop ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In every instance where ‘for’ loops were used in on_the_fly_calc module, ‘each…do’ was replaced instead. This significantly reduced the Cyclomatic complexity of the code. &lt;br /&gt;
&lt;br /&gt;
The following screen shows the instances where for loops where replaced:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Eachloop.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Refactored methods - 'scores', 'compute_reviews_hash', 'compute_avg_and_ranges_hash'  ====&lt;br /&gt;
&lt;br /&gt;
1. a) Method ‘scores’ was very complex, performing too many functions within a single method. Hence, every specific function was broken down into 4 separate smaller methods. This significantly reduced the Assignment, Branch, Condition size for ‘scores’ method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def scores(questions)&lt;br /&gt;
    scores = {}&lt;br /&gt;
    score_team = scores[:teams][index.to_s.to_sym]&lt;br /&gt;
    score = score_team[:scores]&lt;br /&gt;
    scores[:participants] = {}&lt;br /&gt;
    participant_score          #New method defined - participant_score&lt;br /&gt;
    scores[:teams] = {}&lt;br /&gt;
    index = 0&lt;br /&gt;
    self.teams.each do |team|&lt;br /&gt;
      score_team = {}&lt;br /&gt;
      score_team[:team] = team&lt;br /&gt;
      if self.varying_rubrics_by_round?&lt;br /&gt;
        assess                #New method defined - assess&lt;br /&gt;
        calculate_score       #New method defined - calculate_score&lt;br /&gt;
        calculate_assessment  #New method defined - calculate_assessment&lt;br /&gt;
      else&lt;br /&gt;
        assessments = ReviewResponseMap.get_assessments_for(team)&lt;br /&gt;
        score = Answer.compute_scores(assessments, questions[:review])&lt;br /&gt;
      end&lt;br /&gt;
      index += 1&lt;br /&gt;
    end&lt;br /&gt;
    scores&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b) The following 4 methods were created after splitting the first method&amp;lt;br&amp;gt;&lt;br /&gt;
i.  participant_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def participant_score&lt;br /&gt;
  self.participants.each do |participant|&lt;br /&gt;
    scores[:participants][participant.id.to_s.to_sym] = participant.scores(questions)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ii. assess&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def assess&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    total_score = 0&lt;br /&gt;
    total_num_of_assessments = 0 # calculate grades for each rounds&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    assessments = ReviewResponseMap.get_assessments_round_for(team, i)&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    round = Answer.compute_scores(assessments, questions[round_sym])&lt;br /&gt;
    total_num_of_assessments += assessments.size&lt;br /&gt;
    total_score += round[:avg] * assessments.size.to_f unless round[:avg].nil?&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iii. calculate_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_score&lt;br /&gt;
  score = {}&lt;br /&gt;
  score[:max] = -999_999_999&lt;br /&gt;
  score[:min] = 999_999_999&lt;br /&gt;
  score[:avg] = 0&lt;br /&gt;
  grades_by_rounds = {}&lt;br /&gt;
  round = grades_by_rounds[round_sym]&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    score[:max] = round[:max] if max_condition&lt;br /&gt;
    score[:min] = round[:min] if min_condition&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iv. calculate_assessment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_assessment&lt;br /&gt;
  if total_num_of_assessments.nonzero?&lt;br /&gt;
    score[:avg] = total_score / total_num_of_assessments&lt;br /&gt;
  else&lt;br /&gt;
    score[:avg] = nil&lt;br /&gt;
    score[:max] = 0&lt;br /&gt;
    score[:min] = 0&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c) Complex and long statements or loops were broken into simpler multiple statements.&lt;br /&gt;
&lt;br /&gt;
For example, the unless condition in Lines 132-134 was refactored to Line 127. This reduced the Perceived Complexity of 'scores' method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Conditionsimpler.png]]&lt;br /&gt;
&lt;br /&gt;
2. a) We also refactored method ‘compute_reviews_hash’ which was very complex and modularized individual functionalities into 2 separate methods.&lt;br /&gt;
b) The following 2 methods were created and called after refactoring:&amp;lt;br&amp;gt;&lt;br /&gt;
i.  scores_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
ii. scores_non_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Similarly, method ‘compute_avg_and_ranges_hash’ was also refactored and a seperate method calc_contri_score was defined to calculate contributor’s score. This method was then called from ‘compute_avg_and_ranges_hash’.&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
====UI Testing====&lt;br /&gt;
&lt;br /&gt;
Login into Expertiza as a student or an instructor. Go to an assignment which has some reviews for a previous project and click on view scores. The total score for a review is calculated on the fly using this module. You will be able to see the average score that each reviewer gave you on the top right of your page. This ensured that the refactoring done by us didn't break the code and it delivered it's expected functionality.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
Every code has future improvements possible. We have evolved the Code Climate Grade 'F' to a Grade 'C' currently by removing the Cyclomatic complexity, the Perceived Complexity and replaced with the &amp;quot;for&amp;quot; with the 'each' to reduce the size .&lt;br /&gt;
There are modifications that can still reduce the &amp;quot;ABC&amp;quot; Assignment Branches and Conditions Score as we can include the variables and functions in the &amp;quot;before action clauses&amp;quot;, and rename long names with shorter yet appropriate names thus moving towards the score of &amp;quot;A&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103799</id>
		<title>CSC/ECE 517 Fall 2016/E1659. Refactor on the fly calc.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103799"/>
		<updated>2016-10-29T03:30:46Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1659 OSS assignment for Fall 2016, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student5431,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student5427,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
We worked on a module named on_the_fly_calc in this Expertiza based OSS project. We focussed on refactoring some methods which were very complex and also modified the language of the module to make it more ruby-istic. We also worked on refactoring the code to reduce redundancy. Our goal in this project was to make this model easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
A model was modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. On_the_fly_calc&lt;br /&gt;
&lt;br /&gt;
=== On_the_fly_calc ===&lt;br /&gt;
&lt;br /&gt;
On_the_fly_calc is a module that is included in assignment.rb. What this module does is that it calculates the score for both students and instructors. E.g., when a student clicks “view my score”, Expertiza calculates the review scores for each review. This is called “on the fly” because expertiza stores the review scores based on each question (in answers table), but does not store the total score that a reviewer gives to a reviewee. It directly calculates the total review score for each review, using the score values in the answer table during run-time.&lt;br /&gt;
Eg: For a set of 4 questions a reviewer gives 5 on 5 points for 2 questions and 4 on 5 points for other 2 questions. So only these points are stored in the database and when a reviewee clicks to see the score given by this particular reviewer, on_the_fly_calc module helps calculate the total score i.e. 90% in this case.&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
The main aim was to reduce the complexity grade of ‘on_the_fly_calc.rb’ module from “F” to “C” in CodeClimate, which was achieved. We worked on the following work items(WIs) in order to refactor the module:&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor ‘Similar Code’ in lines 34-42 and 62-70 in on_the_fly_calc.rb&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Prefer ‘each’ over every instance of ‘for loop’ &amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor ‘scores’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Refactor ‘compute_reviews_hash’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Refactor ‘compute_avg_and_ranges_hash’ method to reduce ABC (assignment, branch and condition) size&lt;br /&gt;
&lt;br /&gt;
=== Solutions Implemented and Delivered ===&lt;br /&gt;
&lt;br /&gt;
==== Refactored similar code ====&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 and 62-70 were similar in compute_reviews_hash method. Hence, a dedicated method ‘calc_review_score’ was defined and this method was called in the both instances inside compute_reviews_hash.&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 in compute_reviews_hash:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similar code in Lines 62-70:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactored method 'calc_review_score' for the two similar codes:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Same code method.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Each loop prefered over For loop ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In every instance where ‘for’ loops were used in on_the_fly_calc module, ‘each…do’ was replaced instead. This significantly reduced the Cyclomatic complexity of the code. &lt;br /&gt;
&lt;br /&gt;
The following screen shows the instances where for loops where replaced:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Eachloop.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Refactored methods - 'scores', 'compute_reviews_hash', 'compute_avg_and_ranges_hash'  ====&lt;br /&gt;
&lt;br /&gt;
1. a) Method ‘scores’ was very complex, performing too many functions within a single method. Hence, every specific function was broken down into 4 separate smaller methods. This significantly reduced the Assignment, Branch, Condition size for ‘scores’ method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def scores(questions)&lt;br /&gt;
    scores = {}&lt;br /&gt;
    score_team = scores[:teams][index.to_s.to_sym]&lt;br /&gt;
    score = score_team[:scores]&lt;br /&gt;
    scores[:participants] = {}&lt;br /&gt;
    participant_score          #New method defined - participant_score&lt;br /&gt;
    scores[:teams] = {}&lt;br /&gt;
    index = 0&lt;br /&gt;
    self.teams.each do |team|&lt;br /&gt;
      score_team = {}&lt;br /&gt;
      score_team[:team] = team&lt;br /&gt;
      if self.varying_rubrics_by_round?&lt;br /&gt;
        assess                #New method defined - assess&lt;br /&gt;
        calculate_score       #New method defined - calculate_score&lt;br /&gt;
        calculate_assessment  #New method defined - calculate_assessment&lt;br /&gt;
      else&lt;br /&gt;
        assessments = ReviewResponseMap.get_assessments_for(team)&lt;br /&gt;
        score = Answer.compute_scores(assessments, questions[:review])&lt;br /&gt;
      end&lt;br /&gt;
      index += 1&lt;br /&gt;
    end&lt;br /&gt;
    scores&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b) The following 4 methods were created after splitting the first method&amp;lt;br&amp;gt;&lt;br /&gt;
i.  participant_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def participant_score&lt;br /&gt;
  self.participants.each do |participant|&lt;br /&gt;
    scores[:participants][participant.id.to_s.to_sym] = participant.scores(questions)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ii. assess&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def assess&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    total_score = 0&lt;br /&gt;
    total_num_of_assessments = 0 # calculate grades for each rounds&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    assessments = ReviewResponseMap.get_assessments_round_for(team, i)&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    round = Answer.compute_scores(assessments, questions[round_sym])&lt;br /&gt;
    total_num_of_assessments += assessments.size&lt;br /&gt;
    total_score += round[:avg] * assessments.size.to_f unless round[:avg].nil?&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iii. calculate_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_score&lt;br /&gt;
  score = {}&lt;br /&gt;
  score[:max] = -999_999_999&lt;br /&gt;
  score[:min] = 999_999_999&lt;br /&gt;
  score[:avg] = 0&lt;br /&gt;
  grades_by_rounds = {}&lt;br /&gt;
  round = grades_by_rounds[round_sym]&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    score[:max] = round[:max] if max_condition&lt;br /&gt;
    score[:min] = round[:min] if min_condition&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iv. calculate_assessment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_assessment&lt;br /&gt;
  if total_num_of_assessments.nonzero?&lt;br /&gt;
    score[:avg] = total_score / total_num_of_assessments&lt;br /&gt;
  else&lt;br /&gt;
    score[:avg] = nil&lt;br /&gt;
    score[:max] = 0&lt;br /&gt;
    score[:min] = 0&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c) Complex and long statements or loops were broken into simpler multiple statements.&lt;br /&gt;
&lt;br /&gt;
For example, the unless condition in Lines 132-134 was refactored to Line 127. This reduced the Perceived Complexity of 'scores' method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Conditionsimpler.png]]&lt;br /&gt;
&lt;br /&gt;
2. a) We also refactored method ‘compute_reviews_hash’ which was very complex and modularized individual functionalities into 2 separate methods.&lt;br /&gt;
b) The following 2 methods were created and called after refactoring:&amp;lt;br&amp;gt;&lt;br /&gt;
i.  scores_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
ii. scores_non_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Similarly, method ‘compute_avg_and_ranges_hash’ was also refactored and a seperate method calc_contri_score was defined to calculate contributor’s score. This method was then called from ‘compute_avg_and_ranges_hash’.&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
UI Testing&lt;br /&gt;
&lt;br /&gt;
Login into Expertiza as a student or an instructor. Go to an assignment which has some reviews for a previous project and click on view scores. The total score for a review is calculated on the fly using this module. You will be able to see the average score that each reviewer gave you on the top right of your page. This ensured that the refactoring done by us didn't break the code and it delivered it's expected functionality.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
Every code has future improvements possible. We have evolved the Code Climate Grade 'F' to a Grade 'C' currently by removing the Cyclomatic complexity, the Perceived Complexity and replaced with the &amp;quot;for&amp;quot; with the 'each' to reduce the size .&lt;br /&gt;
There are modifications that can still reduce the &amp;quot;ABC&amp;quot; Assignment Branches and Conditions Score as we can include the variables and functions in the &amp;quot;before action clauses&amp;quot;, and rename long names with shorter yet appropriate names thus moving towards the score of &amp;quot;A&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103797</id>
		<title>CSC/ECE 517 Fall 2016/E1659. Refactor on the fly calc.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103797"/>
		<updated>2016-10-29T03:28:40Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1659 OSS assignment for Fall 2016, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student5431,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student5427,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
We worked on a module named on_the_fly_calc in this Expertiza based OSS project. We focussed on refactoring some methods which were very complex and also modified the language of the module to make it more ruby-istic. We also worked on refactoring the code to reduce redundancy. Our goal in this project was to make this model easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
A model was modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. On_the_fly_calc&lt;br /&gt;
&lt;br /&gt;
=== On_the_fly_calc ===&lt;br /&gt;
&lt;br /&gt;
On_the_fly_calc is a module that is included in assignment.rb. What this module does is that it calculates the score for both students and instructors. E.g., when a student clicks “view my score”, Expertiza calculates the review scores for each review. This is called “on the fly” because expertiza stores the review scores based on each question (in answers table), but does not store the total score that a reviewer gives to a reviewee. It directly calculates the total review score for each review, using the score values in the answer table during run-time.&lt;br /&gt;
Eg: For a set of 4 questions a reviewer gives 5 on 5 points for 2 questions and 4 on 5 points for other 2 questions. So only these points are stored in the database and when a reviewee clicks to see the score given by this particular reviewer, on_the_fly_calc module helps calculate the total score i.e. 90% in this case.&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
The main aim was to reduce the complexity grade of ‘on_the_fly_calc.rb’ module from “F” to “C” in CodeClimate, which was achieved. We worked on the following work items(WIs) in order to refactor the module:&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor ‘Similar Code’ in lines 34-42 and 62-70 in on_the_fly_calc.rb&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Prefer ‘each’ over every instance of ‘for loop’ &amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor ‘scores’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Refactor ‘compute_reviews_hash’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Refactor ‘compute_avg_and_ranges_hash’ method to reduce ABC (assignment, branch and condition) size&lt;br /&gt;
&lt;br /&gt;
=== Solutions Implemented and Delivered ===&lt;br /&gt;
&lt;br /&gt;
==== Refactored similar code ====&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 and 62-70 were similar in compute_reviews_hash method. Hence, a dedicated method ‘calc_review_score’ was defined and this method was called in the both instances inside compute_reviews_hash.&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 in compute_reviews_hash:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similar code in Lines 62-70:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactored method 'calc_review_score' for the two similar codes:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Same code method.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Each loop prefered over For loop ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In every instance where ‘for’ loops were used in on_the_fly_calc module, ‘each…do’ was replaced instead. This significantly reduced the Cyclomatic complexity of the code. &lt;br /&gt;
&lt;br /&gt;
The following screen shows the instances where for loops where replaced:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Eachloop.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Refactored methods - 'scores', 'compute_reviews_hash', 'compute_avg_and_ranges_hash'  ====&lt;br /&gt;
&lt;br /&gt;
1. a) Method ‘scores’ was very complex, performing too many functions within a single method. Hence, every specific function was broken down into 4 separate smaller methods. This significantly reduced the Assignment, Branch, Condition size for ‘scores’ method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def scores(questions)&lt;br /&gt;
    scores = {}&lt;br /&gt;
    score_team = scores[:teams][index.to_s.to_sym]&lt;br /&gt;
    score = score_team[:scores]&lt;br /&gt;
    scores[:participants] = {}&lt;br /&gt;
    participant_score          #New method defined - participant_score&lt;br /&gt;
    scores[:teams] = {}&lt;br /&gt;
    index = 0&lt;br /&gt;
    self.teams.each do |team|&lt;br /&gt;
      score_team = {}&lt;br /&gt;
      score_team[:team] = team&lt;br /&gt;
      if self.varying_rubrics_by_round?&lt;br /&gt;
        assess                #New method defined - assess&lt;br /&gt;
        calculate_score       #New method defined - calculate_score&lt;br /&gt;
        calculate_assessment  #New method defined - calculate_assessment&lt;br /&gt;
      else&lt;br /&gt;
        assessments = ReviewResponseMap.get_assessments_for(team)&lt;br /&gt;
        score = Answer.compute_scores(assessments, questions[:review])&lt;br /&gt;
      end&lt;br /&gt;
      index += 1&lt;br /&gt;
    end&lt;br /&gt;
    scores&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b) The following 4 methods were created after splitting the first method&amp;lt;br&amp;gt;&lt;br /&gt;
i.  participant_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def participant_score&lt;br /&gt;
  self.participants.each do |participant|&lt;br /&gt;
    scores[:participants][participant.id.to_s.to_sym] = participant.scores(questions)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ii. assess&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def assess&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    total_score = 0&lt;br /&gt;
    total_num_of_assessments = 0 # calculate grades for each rounds&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    assessments = ReviewResponseMap.get_assessments_round_for(team, i)&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    round = Answer.compute_scores(assessments, questions[round_sym])&lt;br /&gt;
    total_num_of_assessments += assessments.size&lt;br /&gt;
    total_score += round[:avg] * assessments.size.to_f unless round[:avg].nil?&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iii. calculate_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_score&lt;br /&gt;
  score = {}&lt;br /&gt;
  score[:max] = -999_999_999&lt;br /&gt;
  score[:min] = 999_999_999&lt;br /&gt;
  score[:avg] = 0&lt;br /&gt;
  grades_by_rounds = {}&lt;br /&gt;
  round = grades_by_rounds[round_sym]&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    score[:max] = round[:max] if max_condition&lt;br /&gt;
    score[:min] = round[:min] if min_condition&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iv. calculate_assessment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_assessment&lt;br /&gt;
  if total_num_of_assessments.nonzero?&lt;br /&gt;
    score[:avg] = total_score / total_num_of_assessments&lt;br /&gt;
  else&lt;br /&gt;
    score[:avg] = nil&lt;br /&gt;
    score[:max] = 0&lt;br /&gt;
    score[:min] = 0&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c) Complex and long statements or loops were broken into simpler multiple statements.&lt;br /&gt;
&lt;br /&gt;
For example, the unless condition in Lines 132-134 was refactored to Line 127. This reduced the Perceived Complexity of 'scores' method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Conditionsimpler.png]]&lt;br /&gt;
&lt;br /&gt;
2. a) We also refactored method ‘compute_reviews_hash’ which was very complex and modularized individual functionalities into 2 separate methods.&lt;br /&gt;
b) The following 2 methods were created and called after refactoring:&amp;lt;br&amp;gt;&lt;br /&gt;
i.  scores_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
ii. scores_non_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Similarly, method ‘compute_avg_and_ranges_hash’ was also refactored and a seperate method calc_contri_score was defined to calculate contributor’s score. This method was then called from ‘compute_avg_and_ranges_hash’.&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
== UI Testing ==&lt;br /&gt;
&lt;br /&gt;
Login into Expertiza as a student or an instructor. Go to an assignment which has some reviews for a previous project and click on view scores. The total score for a review is calculated on the fly using this module. You will be able to see the average score that each reviewer gave you on the top right of your page. This ensured that the refactoring done by us didn't break the code and it delivered it's expected functionality.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
Every code has future improvements possible. We have evolved the Code Climate Grade 'F' to a Grade 'C' currently by removing the Cyclomatic complexity, the Perceived Complexity and replaced with the &amp;quot;for&amp;quot; with the 'each' to reduce the size .&lt;br /&gt;
There are modifications that can still reduce the &amp;quot;ABC&amp;quot; Assignment Branches and Conditions Score as we can include the variables and functions in the &amp;quot;before action clauses&amp;quot;, and rename long names with shorter yet appropriate names thus moving towards the score of &amp;quot;A&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103795</id>
		<title>CSC/ECE 517 Fall 2016/E1659. Refactor on the fly calc.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103795"/>
		<updated>2016-10-29T03:27:37Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: /* Scope for future improvement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1659 OSS assignment for Fall 2016, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student5431,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student5427,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
We worked on a module named on_the_fly_calc in this Expertiza based OSS project. We focussed on refactoring some methods which were very complex and also modified the language of the module to make it more ruby-istic. We also worked on refactoring the code to reduce redundancy. Our goal in this project was to make this model easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
A model was modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. On_the_fly_calc&lt;br /&gt;
&lt;br /&gt;
=== On_the_fly_calc ===&lt;br /&gt;
&lt;br /&gt;
On_the_fly_calc is a module that is included in assignment.rb. What this module does is that it calculates the score for both students and instructors. E.g., when a student clicks “view my score”, Expertiza calculates the review scores for each review. This is called “on the fly” because expertiza stores the review scores based on each question (in answers table), but does not store the total score that a reviewer gives to a reviewee. It directly calculates the total review score for each review, using the score values in the answer table during run-time.&lt;br /&gt;
Eg: For a set of 4 questions a reviewer gives 5 on 5 points for 2 questions and 4 on 5 points for other 2 questions. So only these points are stored in the database and when a reviewee clicks to see the score given by this particular reviewer, on_the_fly_calc module helps calculate the total score i.e. 90% in this case.&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
The main aim was to reduce the complexity grade of ‘on_the_fly_calc.rb’ module from “F” to “C” in CodeClimate, which was achieved. We worked on the following work items(WIs) in order to refactor the module:&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor ‘Similar Code’ in lines 34-42 and 62-70 in on_the_fly_calc.rb&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Prefer ‘each’ over every instance of ‘for loop’ &amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor ‘scores’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Refactor ‘compute_reviews_hash’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Refactor ‘compute_avg_and_ranges_hash’ method to reduce ABC (assignment, branch and condition) size&lt;br /&gt;
&lt;br /&gt;
=== Solutions Implemented and Delivered ===&lt;br /&gt;
&lt;br /&gt;
==== Refactored similar code ====&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 and 62-70 were similar in compute_reviews_hash method. Hence, a dedicated method ‘calc_review_score’ was defined and this method was called in the both instances inside compute_reviews_hash.&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 in compute_reviews_hash:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similar code in Lines 62-70:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactored method 'calc_review_score' for the two similar codes:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Same code method.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Each loop prefered over For loop ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In every instance where ‘for’ loops were used in on_the_fly_calc module, ‘each…do’ was replaced instead. This significantly reduced the Cyclomatic complexity of the code. &lt;br /&gt;
&lt;br /&gt;
The following screen shows the instances where for loops where replaced:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Eachloop.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Refactored methods - 'scores', 'compute_reviews_hash', 'compute_avg_and_ranges_hash'  ====&lt;br /&gt;
&lt;br /&gt;
1. a) Method ‘scores’ was very complex, performing too many functions within a single method. Hence, every specific function was broken down into 4 separate smaller methods. This significantly reduced the Assignment, Branch, Condition size for ‘scores’ method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def scores(questions)&lt;br /&gt;
    scores = {}&lt;br /&gt;
    score_team = scores[:teams][index.to_s.to_sym]&lt;br /&gt;
    score = score_team[:scores]&lt;br /&gt;
    scores[:participants] = {}&lt;br /&gt;
    participant_score          #New method defined - participant_score&lt;br /&gt;
    scores[:teams] = {}&lt;br /&gt;
    index = 0&lt;br /&gt;
    self.teams.each do |team|&lt;br /&gt;
      score_team = {}&lt;br /&gt;
      score_team[:team] = team&lt;br /&gt;
      if self.varying_rubrics_by_round?&lt;br /&gt;
        assess                #New method defined - assess&lt;br /&gt;
        calculate_score       #New method defined - calculate_score&lt;br /&gt;
        calculate_assessment  #New method defined - calculate_assessment&lt;br /&gt;
      else&lt;br /&gt;
        assessments = ReviewResponseMap.get_assessments_for(team)&lt;br /&gt;
        score = Answer.compute_scores(assessments, questions[:review])&lt;br /&gt;
      end&lt;br /&gt;
      index += 1&lt;br /&gt;
    end&lt;br /&gt;
    scores&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b) The following 4 methods were created after splitting the first method&amp;lt;br&amp;gt;&lt;br /&gt;
i.  participant_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def participant_score&lt;br /&gt;
  self.participants.each do |participant|&lt;br /&gt;
    scores[:participants][participant.id.to_s.to_sym] = participant.scores(questions)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ii. assess&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def assess&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    total_score = 0&lt;br /&gt;
    total_num_of_assessments = 0 # calculate grades for each rounds&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    assessments = ReviewResponseMap.get_assessments_round_for(team, i)&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    round = Answer.compute_scores(assessments, questions[round_sym])&lt;br /&gt;
    total_num_of_assessments += assessments.size&lt;br /&gt;
    total_score += round[:avg] * assessments.size.to_f unless round[:avg].nil?&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iii. calculate_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_score&lt;br /&gt;
  score = {}&lt;br /&gt;
  score[:max] = -999_999_999&lt;br /&gt;
  score[:min] = 999_999_999&lt;br /&gt;
  score[:avg] = 0&lt;br /&gt;
  grades_by_rounds = {}&lt;br /&gt;
  round = grades_by_rounds[round_sym]&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    score[:max] = round[:max] if max_condition&lt;br /&gt;
    score[:min] = round[:min] if min_condition&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iv. calculate_assessment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_assessment&lt;br /&gt;
  if total_num_of_assessments.nonzero?&lt;br /&gt;
    score[:avg] = total_score / total_num_of_assessments&lt;br /&gt;
  else&lt;br /&gt;
    score[:avg] = nil&lt;br /&gt;
    score[:max] = 0&lt;br /&gt;
    score[:min] = 0&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c) Complex and long statements or loops were broken into simpler multiple statements.&lt;br /&gt;
&lt;br /&gt;
For example, the unless condition in Lines 132-134 was refactored to Line 127. This reduced the Perceived Complexity of 'scores' method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Conditionsimpler.png]]&lt;br /&gt;
&lt;br /&gt;
2. a) We also refactored method ‘compute_reviews_hash’ which was very complex and modularized individual functionalities into 2 separate methods.&lt;br /&gt;
b) The following 2 methods were created and called after refactoring:&amp;lt;br&amp;gt;&lt;br /&gt;
i.  scores_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
ii. scores_non_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Similarly, method ‘compute_avg_and_ranges_hash’ was also refactored and a seperate method calc_contri_score was defined to calculate contributor’s score. This method was then called from ‘compute_avg_and_ranges_hash’.&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Login into Expertiza as a student or an instructor. Go to an assignment which has some reviews for a previous project and click on view scores. The total score for a review is calculated on the fly using this module. You will be able to see the average score that each reviewer gave you on the top right of your page. This ensured that the refactoring done by us didn't break the code and it delivered it's expected functionality.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
Every code has future improvements possible. We have evolved the Code Climate Grade 'F' to a Grade 'C' currently by removing the Cyclomatic complexity, the Perceived Complexity and replaced with the &amp;quot;for&amp;quot; with the 'each' to reduce the size .&lt;br /&gt;
There are modifications that can still reduce the &amp;quot;ABC&amp;quot; Assignment Branches and Conditions Score as we can include the variables and functions in the &amp;quot;before action clauses&amp;quot;, and rename long names with shorter yet appropriate names thus moving towards the score of &amp;quot;A&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103793</id>
		<title>CSC/ECE 517 Fall 2016/E1659. Refactor on the fly calc.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1659._Refactor_on_the_fly_calc.rb&amp;diff=103793"/>
		<updated>2016-10-29T03:27:17Z</updated>

		<summary type="html">&lt;p&gt;Sagupta: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E1659 OSS assignment for Fall 2016, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
* Instructor login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
* Student  login: username -&amp;gt; student5431,  password -&amp;gt; password &lt;br /&gt;
* Student login: username -&amp;gt; student5427,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. Using Expertiza students can bid for a particular project topic and the faculty assigns the same to different groups. Students can track their grades for previous projects and make new submissions for current projects. It also allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
We worked on a module named on_the_fly_calc in this Expertiza based OSS project. We focussed on refactoring some methods which were very complex and also modified the language of the module to make it more ruby-istic. We also worked on refactoring the code to reduce redundancy. Our goal in this project was to make this model easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
A model was modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. On_the_fly_calc&lt;br /&gt;
&lt;br /&gt;
=== On_the_fly_calc ===&lt;br /&gt;
&lt;br /&gt;
On_the_fly_calc is a module that is included in assignment.rb. What this module does is that it calculates the score for both students and instructors. E.g., when a student clicks “view my score”, Expertiza calculates the review scores for each review. This is called “on the fly” because expertiza stores the review scores based on each question (in answers table), but does not store the total score that a reviewer gives to a reviewee. It directly calculates the total review score for each review, using the score values in the answer table during run-time.&lt;br /&gt;
Eg: For a set of 4 questions a reviewer gives 5 on 5 points for 2 questions and 4 on 5 points for other 2 questions. So only these points are stored in the database and when a reviewee clicks to see the score given by this particular reviewer, on_the_fly_calc module helps calculate the total score i.e. 90% in this case.&lt;br /&gt;
&lt;br /&gt;
== List of changes ==&lt;br /&gt;
The main aim was to reduce the complexity grade of ‘on_the_fly_calc.rb’ module from “F” to “C” in CodeClimate, which was achieved. We worked on the following work items(WIs) in order to refactor the module:&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor ‘Similar Code’ in lines 34-42 and 62-70 in on_the_fly_calc.rb&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Prefer ‘each’ over every instance of ‘for loop’ &amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor ‘scores’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Refactor ‘compute_reviews_hash’ method to reduce ABC (assignment, branch and condition) size&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Refactor ‘compute_avg_and_ranges_hash’ method to reduce ABC (assignment, branch and condition) size&lt;br /&gt;
&lt;br /&gt;
=== Solutions Implemented and Delivered ===&lt;br /&gt;
&lt;br /&gt;
==== Refactored similar code ====&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 and 62-70 were similar in compute_reviews_hash method. Hence, a dedicated method ‘calc_review_score’ was defined and this method was called in the both instances inside compute_reviews_hash.&lt;br /&gt;
&lt;br /&gt;
Lines 34-42 in compute_reviews_hash:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similar code in Lines 62-70:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Similar code 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Refactored method 'calc_review_score' for the two similar codes:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Same code method.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Each loop prefered over For loop ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In every instance where ‘for’ loops were used in on_the_fly_calc module, ‘each…do’ was replaced instead. This significantly reduced the Cyclomatic complexity of the code. &lt;br /&gt;
&lt;br /&gt;
The following screen shows the instances where for loops where replaced:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Eachloop.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Refactored methods - 'scores', 'compute_reviews_hash', 'compute_avg_and_ranges_hash'  ====&lt;br /&gt;
&lt;br /&gt;
1. a) Method ‘scores’ was very complex, performing too many functions within a single method. Hence, every specific function was broken down into 4 separate smaller methods. This significantly reduced the Assignment, Branch, Condition size for ‘scores’ method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def scores(questions)&lt;br /&gt;
    scores = {}&lt;br /&gt;
    score_team = scores[:teams][index.to_s.to_sym]&lt;br /&gt;
    score = score_team[:scores]&lt;br /&gt;
    scores[:participants] = {}&lt;br /&gt;
    participant_score          #New method defined - participant_score&lt;br /&gt;
    scores[:teams] = {}&lt;br /&gt;
    index = 0&lt;br /&gt;
    self.teams.each do |team|&lt;br /&gt;
      score_team = {}&lt;br /&gt;
      score_team[:team] = team&lt;br /&gt;
      if self.varying_rubrics_by_round?&lt;br /&gt;
        assess                #New method defined - assess&lt;br /&gt;
        calculate_score       #New method defined - calculate_score&lt;br /&gt;
        calculate_assessment  #New method defined - calculate_assessment&lt;br /&gt;
      else&lt;br /&gt;
        assessments = ReviewResponseMap.get_assessments_for(team)&lt;br /&gt;
        score = Answer.compute_scores(assessments, questions[:review])&lt;br /&gt;
      end&lt;br /&gt;
      index += 1&lt;br /&gt;
    end&lt;br /&gt;
    scores&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b) The following 4 methods were created after splitting the first method&amp;lt;br&amp;gt;&lt;br /&gt;
i.  participant_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def participant_score&lt;br /&gt;
  self.participants.each do |participant|&lt;br /&gt;
    scores[:participants][participant.id.to_s.to_sym] = participant.scores(questions)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ii. assess&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def assess&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    total_score = 0&lt;br /&gt;
    total_num_of_assessments = 0 # calculate grades for each rounds&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    assessments = ReviewResponseMap.get_assessments_round_for(team, i)&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    round = Answer.compute_scores(assessments, questions[round_sym])&lt;br /&gt;
    total_num_of_assessments += assessments.size&lt;br /&gt;
    total_score += round[:avg] * assessments.size.to_f unless round[:avg].nil?&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iii. calculate_score&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_score&lt;br /&gt;
  score = {}&lt;br /&gt;
  score[:max] = -999_999_999&lt;br /&gt;
  score[:min] = 999_999_999&lt;br /&gt;
  score[:avg] = 0&lt;br /&gt;
  grades_by_rounds = {}&lt;br /&gt;
  round = grades_by_rounds[round_sym]&lt;br /&gt;
  self.num_review_rounds.each do |i|&lt;br /&gt;
    round_sym = (&amp;quot;review&amp;quot; + i.to_s).to_sym&lt;br /&gt;
    grades_by_rounds = {}&lt;br /&gt;
    round = grades_by_rounds[round_sym]&lt;br /&gt;
    score[:max] = round[:max] if max_condition&lt;br /&gt;
    score[:min] = round[:min] if min_condition&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iv. calculate_assessment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def calculate_assessment&lt;br /&gt;
  if total_num_of_assessments.nonzero?&lt;br /&gt;
    score[:avg] = total_score / total_num_of_assessments&lt;br /&gt;
  else&lt;br /&gt;
    score[:avg] = nil&lt;br /&gt;
    score[:max] = 0&lt;br /&gt;
    score[:min] = 0&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c) Complex and long statements or loops were broken into simpler multiple statements.&lt;br /&gt;
&lt;br /&gt;
For example, the unless condition in Lines 132-134 was refactored to Line 127. This reduced the Perceived Complexity of 'scores' method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Conditionsimpler.png]]&lt;br /&gt;
&lt;br /&gt;
2. a) We also refactored method ‘compute_reviews_hash’ which was very complex and modularized individual functionalities into 2 separate methods.&lt;br /&gt;
b) The following 2 methods were created and called after refactoring:&amp;lt;br&amp;gt;&lt;br /&gt;
i.  scores_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
ii. scores_non_varying_rubrics&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Similarly, method ‘compute_avg_and_ranges_hash’ was also refactored and a seperate method calc_contri_score was defined to calculate contributor’s score. This method was then called from ‘compute_avg_and_ranges_hash’.&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
Login into Expertiza as a student or an instructor. Go to an assignment which has some reviews for a previous project and click on view scores. The total score for a review is calculated on the fly using this module. You will be able to see the average score that each reviewer gave you on the top right of your page. This ensured that the refactoring done by us didn't break the code and it delivered it's expected functionality.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
&lt;br /&gt;
Every code has future improvements possible. We have evolved the Code Climate Grade 'F' to a Grade 'C' currently by removing the Cyclomatic complexity, the Perceived Complexity and replaced with the &amp;quot;for&amp;quot; with the 'each' to reduce the size .&lt;br /&gt;
There are modifications that can still reduce the &amp;quot;ABC&amp;quot; Assignment Branches and Conditions Score as we can include the variables and functions in the &amp;quot;before action clauses&amp;quot;, and rename long names with shorter yet appropriate names thus moving towards the score of &amp;quot;A&amp;quot;.  &lt;br /&gt;
Perceived &lt;br /&gt;
ABC&lt;/div&gt;</summary>
		<author><name>Sagupta</name></author>
	</entry>
</feed>