<?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=Ywang95</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=Ywang95"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Ywang95"/>
	<updated>2026-07-05T11:48:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96075</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96075"/>
		<updated>2015-03-31T03:51:38Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation.&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96074</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96074"/>
		<updated>2015-03-31T03:49:58Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Rust */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation.&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96073</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96073"/>
		<updated>2015-03-31T03:46:57Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Rust */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation.&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96072</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96072"/>
		<updated>2015-03-31T03:44:14Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Rust */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by Mozilla Research.[11] It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting pure-functional, concurrent-actor, imperative-procedural, and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation.&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96071</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96071"/>
		<updated>2015-03-31T03:43:40Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Servo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, multi-paradigm&amp;lt;, compiled programming language developed by Mozilla Research.[11] It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting pure-functional, concurrent-actor, imperative-procedural, and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation.&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96070</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96070"/>
		<updated>2015-03-31T03:42:54Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Servo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, multi-paradigm&amp;lt;, compiled programming language developed by Mozilla Research.[11] It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting pure-functional, concurrent-actor, imperative-procedural, and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation.&amp;lt;ref&amp;gt;Mozilla Research Projects, from https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96069</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96069"/>
		<updated>2015-03-31T03:42:22Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Servo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, multi-paradigm&amp;lt;, compiled programming language developed by Mozilla Research.[11] It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting pure-functional, concurrent-actor, imperative-procedural, and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation.&amp;lt;ref&amp;gt;Mozilla Research Projects https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96068</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96068"/>
		<updated>2015-03-31T03:41:54Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Rusthttp://en.wikipedia.org/wiki/Rust_%28programming_language%29 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, multi-paradigm&amp;lt;, compiled programming language developed by Mozilla Research.[11] It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting pure-functional, concurrent-actor, imperative-procedural, and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96067</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96067"/>
		<updated>2015-03-31T03:39:27Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Rust is a general purpose, multi-paradigm, compiled programming language developed by Mozilla Research.[11] It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting pure-functional, concurrent-actor, imperative-procedural, and object-oriented styles.&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96066</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96066"/>
		<updated>2015-03-31T03:35:48Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96065</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96065"/>
		<updated>2015-03-31T03:35:38Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;reference/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96064</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96064"/>
		<updated>2015-03-31T03:35:07Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
==Reference==&lt;br /&gt;
&amp;lt;/reference&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96063</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96063"/>
		<updated>2015-03-31T03:34:37Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Servo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96062</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96062"/>
		<updated>2015-03-31T03:34:03Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Servo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.[ref=https://www.mozilla.org/en-US/research/projects/]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95295</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95295"/>
		<updated>2015-03-21T23:44:10Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Method Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
In this project, we have done some refactoring on the questionnaires_controller. We moved some methods to where we thought suited them, and changed the format of language into ruby style, deleted debugging statement. Details are displayed in the following sections.&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
The Expertiza project is system for using peer review to create reusable learning objects. Students do different assignments; then peer review selects the best work in each category, and assembles it to create a single unit.&amp;lt;ref&amp;gt;[http://expertiza.ncsu.edu/ Expertiza]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Refactoring Example===&lt;br /&gt;
&amp;lt;p id=&amp;quot;example&amp;quot;&amp;gt;In models/questionnaires.rb, we add copy_questionnaires method, as shown below:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.copy_questionnaires(id,user)&lt;br /&gt;
    @orig_questionnaire = Questionnaire.find(id)&lt;br /&gt;
    questions = Question.where(questionnaire_id: id)&lt;br /&gt;
    @questionnaire = @orig_questionnaire.clone&lt;br /&gt;
    @questionnaire.instructor_id = user.instructor_id  ## Why was TA-specific code removed here?  See Project E713.&lt;br /&gt;
    @questionnaire.name = 'Copy of ' + @orig_questionnaire.name&lt;br /&gt;
&lt;br /&gt;
    if user.role.name != &amp;quot;Teaching Assistant&amp;quot;&lt;br /&gt;
      @questionnaire.instructor_id = user.id&lt;br /&gt;
    else # for TA we need to get his instructor id and by default add it to his course for which he is the TA&lt;br /&gt;
      @questionnaire.instructor_id = Ta.get_my_instructor(user.id)&lt;br /&gt;
    end&lt;br /&gt;
    @questionnaire.name = 'Copy of '+@orig_questionnaire.name&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      @questionnaire.created_at = Time.now&lt;br /&gt;
      @questionnaire.save!&lt;br /&gt;
&lt;br /&gt;
      questions.each{ | question |&lt;br /&gt;
&lt;br /&gt;
        new_question = question.clone&lt;br /&gt;
        new_question.questionnaire_id = @questionnaire.id&lt;br /&gt;
        new_question.save&lt;br /&gt;
&lt;br /&gt;
        advice = QuestionAdvice.find_by_question_id(question.id)&lt;br /&gt;
        if advice&lt;br /&gt;
          new_advice = advice.clone&lt;br /&gt;
          new_advice.question_id = newquestion.id&lt;br /&gt;
          new_advice.save&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if (@questionnaire.section == &amp;quot;Custom&amp;quot;)&lt;br /&gt;
          old_question_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if old_question_type&lt;br /&gt;
            new_question_type = old_question_type.clone&lt;br /&gt;
            new_question_type.question_id = newquestion.id&lt;br /&gt;
            new_question_type.save&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
      pFolder = TreeFolder.find_by_name(@questionnaire.display_type)&lt;br /&gt;
      parent = FolderNode.find_by_node_object_id(pFolder.id)&lt;br /&gt;
      unless QuestionnaireNode.where(parent_id: parent.id, node_object_id: @questionnaire.id)&lt;br /&gt;
        QuestionnaireNode.create(:parent_id =&amp;gt; parent.id, :node_object_id =&amp;gt; @questionnaire.id)&lt;br /&gt;
      end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95294</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95294"/>
		<updated>2015-03-21T23:43:49Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Method Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
In this project, we have done some refactoring on the questionnaires_controller. We moved some methods to where we thought suited them, and changed the format of language into ruby style, deleted debugging statement. Details are displayed in the following sections.&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
The Expertiza project is system for using peer review to create reusable learning objects. Students do different assignments; then peer review selects the best work in each category, and assembles it to create a single unit.&amp;lt;ref&amp;gt;[http://expertiza.ncsu.edu/ Expertiza]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as &amp;lt;a href=&amp;quot;#example&amp;quot;&amp;gt;copy_questionnaires&amp;lt;/a&amp;gt; method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Refactoring Example===&lt;br /&gt;
&amp;lt;p id=&amp;quot;example&amp;quot;&amp;gt;In models/questionnaires.rb, we add copy_questionnaires method, as shown below:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.copy_questionnaires(id,user)&lt;br /&gt;
    @orig_questionnaire = Questionnaire.find(id)&lt;br /&gt;
    questions = Question.where(questionnaire_id: id)&lt;br /&gt;
    @questionnaire = @orig_questionnaire.clone&lt;br /&gt;
    @questionnaire.instructor_id = user.instructor_id  ## Why was TA-specific code removed here?  See Project E713.&lt;br /&gt;
    @questionnaire.name = 'Copy of ' + @orig_questionnaire.name&lt;br /&gt;
&lt;br /&gt;
    if user.role.name != &amp;quot;Teaching Assistant&amp;quot;&lt;br /&gt;
      @questionnaire.instructor_id = user.id&lt;br /&gt;
    else # for TA we need to get his instructor id and by default add it to his course for which he is the TA&lt;br /&gt;
      @questionnaire.instructor_id = Ta.get_my_instructor(user.id)&lt;br /&gt;
    end&lt;br /&gt;
    @questionnaire.name = 'Copy of '+@orig_questionnaire.name&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      @questionnaire.created_at = Time.now&lt;br /&gt;
      @questionnaire.save!&lt;br /&gt;
&lt;br /&gt;
      questions.each{ | question |&lt;br /&gt;
&lt;br /&gt;
        new_question = question.clone&lt;br /&gt;
        new_question.questionnaire_id = @questionnaire.id&lt;br /&gt;
        new_question.save&lt;br /&gt;
&lt;br /&gt;
        advice = QuestionAdvice.find_by_question_id(question.id)&lt;br /&gt;
        if advice&lt;br /&gt;
          new_advice = advice.clone&lt;br /&gt;
          new_advice.question_id = newquestion.id&lt;br /&gt;
          new_advice.save&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if (@questionnaire.section == &amp;quot;Custom&amp;quot;)&lt;br /&gt;
          old_question_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if old_question_type&lt;br /&gt;
            new_question_type = old_question_type.clone&lt;br /&gt;
            new_question_type.question_id = newquestion.id&lt;br /&gt;
            new_question_type.save&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
      pFolder = TreeFolder.find_by_name(@questionnaire.display_type)&lt;br /&gt;
      parent = FolderNode.find_by_node_object_id(pFolder.id)&lt;br /&gt;
      unless QuestionnaireNode.where(parent_id: parent.id, node_object_id: @questionnaire.id)&lt;br /&gt;
        QuestionnaireNode.create(:parent_id =&amp;gt; parent.id, :node_object_id =&amp;gt; @questionnaire.id)&lt;br /&gt;
      end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95293</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95293"/>
		<updated>2015-03-21T23:42:58Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Refactoring Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
In this project, we have done some refactoring on the questionnaires_controller. We moved some methods to where we thought suited them, and changed the format of language into ruby style, deleted debugging statement. Details are displayed in the following sections.&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
The Expertiza project is system for using peer review to create reusable learning objects. Students do different assignments; then peer review selects the best work in each category, and assembles it to create a single unit.&amp;lt;ref&amp;gt;[http://expertiza.ncsu.edu/ Expertiza]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Refactoring Example===&lt;br /&gt;
&amp;lt;p id=&amp;quot;example&amp;quot;&amp;gt;In models/questionnaires.rb, we add copy_questionnaires method, as shown below:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.copy_questionnaires(id,user)&lt;br /&gt;
    @orig_questionnaire = Questionnaire.find(id)&lt;br /&gt;
    questions = Question.where(questionnaire_id: id)&lt;br /&gt;
    @questionnaire = @orig_questionnaire.clone&lt;br /&gt;
    @questionnaire.instructor_id = user.instructor_id  ## Why was TA-specific code removed here?  See Project E713.&lt;br /&gt;
    @questionnaire.name = 'Copy of ' + @orig_questionnaire.name&lt;br /&gt;
&lt;br /&gt;
    if user.role.name != &amp;quot;Teaching Assistant&amp;quot;&lt;br /&gt;
      @questionnaire.instructor_id = user.id&lt;br /&gt;
    else # for TA we need to get his instructor id and by default add it to his course for which he is the TA&lt;br /&gt;
      @questionnaire.instructor_id = Ta.get_my_instructor(user.id)&lt;br /&gt;
    end&lt;br /&gt;
    @questionnaire.name = 'Copy of '+@orig_questionnaire.name&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      @questionnaire.created_at = Time.now&lt;br /&gt;
      @questionnaire.save!&lt;br /&gt;
&lt;br /&gt;
      questions.each{ | question |&lt;br /&gt;
&lt;br /&gt;
        new_question = question.clone&lt;br /&gt;
        new_question.questionnaire_id = @questionnaire.id&lt;br /&gt;
        new_question.save&lt;br /&gt;
&lt;br /&gt;
        advice = QuestionAdvice.find_by_question_id(question.id)&lt;br /&gt;
        if advice&lt;br /&gt;
          new_advice = advice.clone&lt;br /&gt;
          new_advice.question_id = newquestion.id&lt;br /&gt;
          new_advice.save&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if (@questionnaire.section == &amp;quot;Custom&amp;quot;)&lt;br /&gt;
          old_question_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if old_question_type&lt;br /&gt;
            new_question_type = old_question_type.clone&lt;br /&gt;
            new_question_type.question_id = newquestion.id&lt;br /&gt;
            new_question_type.save&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
      pFolder = TreeFolder.find_by_name(@questionnaire.display_type)&lt;br /&gt;
      parent = FolderNode.find_by_node_object_id(pFolder.id)&lt;br /&gt;
      unless QuestionnaireNode.where(parent_id: parent.id, node_object_id: @questionnaire.id)&lt;br /&gt;
        QuestionnaireNode.create(:parent_id =&amp;gt; parent.id, :node_object_id =&amp;gt; @questionnaire.id)&lt;br /&gt;
      end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95292</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95292"/>
		<updated>2015-03-21T23:40:13Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* What We Have Done */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
In this project, we have done some refactoring on the questionnaires_controller. We moved some methods to where we thought suited them, and changed the format of language into ruby style, deleted debugging statement. Details are displayed in the following sections.&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
The Expertiza project is system for using peer review to create reusable learning objects. Students do different assignments; then peer review selects the best work in each category, and assembles it to create a single unit.&amp;lt;ref&amp;gt;[http://expertiza.ncsu.edu/ Expertiza]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Refactoring Example===&lt;br /&gt;
In models/questionnaires.rb, we add copy_questionnaires method, as shown below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.copy_questionnaires(id,user)&lt;br /&gt;
    @orig_questionnaire = Questionnaire.find(id)&lt;br /&gt;
    questions = Question.where(questionnaire_id: id)&lt;br /&gt;
    @questionnaire = @orig_questionnaire.clone&lt;br /&gt;
    @questionnaire.instructor_id = user.instructor_id  ## Why was TA-specific code removed here?  See Project E713.&lt;br /&gt;
    @questionnaire.name = 'Copy of ' + @orig_questionnaire.name&lt;br /&gt;
&lt;br /&gt;
    if user.role.name != &amp;quot;Teaching Assistant&amp;quot;&lt;br /&gt;
      @questionnaire.instructor_id = user.id&lt;br /&gt;
    else # for TA we need to get his instructor id and by default add it to his course for which he is the TA&lt;br /&gt;
      @questionnaire.instructor_id = Ta.get_my_instructor(user.id)&lt;br /&gt;
    end&lt;br /&gt;
    @questionnaire.name = 'Copy of '+@orig_questionnaire.name&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      @questionnaire.created_at = Time.now&lt;br /&gt;
      @questionnaire.save!&lt;br /&gt;
&lt;br /&gt;
      questions.each{ | question |&lt;br /&gt;
&lt;br /&gt;
        new_question = question.clone&lt;br /&gt;
        new_question.questionnaire_id = @questionnaire.id&lt;br /&gt;
        new_question.save&lt;br /&gt;
&lt;br /&gt;
        advice = QuestionAdvice.find_by_question_id(question.id)&lt;br /&gt;
        if advice&lt;br /&gt;
          new_advice = advice.clone&lt;br /&gt;
          new_advice.question_id = newquestion.id&lt;br /&gt;
          new_advice.save&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if (@questionnaire.section == &amp;quot;Custom&amp;quot;)&lt;br /&gt;
          old_question_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if old_question_type&lt;br /&gt;
            new_question_type = old_question_type.clone&lt;br /&gt;
            new_question_type.question_id = newquestion.id&lt;br /&gt;
            new_question_type.save&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      }&lt;br /&gt;
      pFolder = TreeFolder.find_by_name(@questionnaire.display_type)&lt;br /&gt;
      parent = FolderNode.find_by_node_object_id(pFolder.id)&lt;br /&gt;
      unless QuestionnaireNode.where(parent_id: parent.id, node_object_id: @questionnaire.id)&lt;br /&gt;
        QuestionnaireNode.create(:parent_id =&amp;gt; parent.id, :node_object_id =&amp;gt; @questionnaire.id)&lt;br /&gt;
      end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95291</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95291"/>
		<updated>2015-03-21T23:34:27Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
In this project, we have done some refactoring on the questionnaires_controller. We moved some methods to where we thought suited them, and changed the format of language into ruby style, deleted debugging statement. Details are displayed in the following sections.&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
The Expertiza project is system for using peer review to create reusable learning objects. Students do different assignments; then peer review selects the best work in each category, and assembles it to create a single unit.&amp;lt;ref&amp;gt;[http://expertiza.ncsu.edu/ Expertiza]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95290</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95290"/>
		<updated>2015-03-21T23:33:24Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
In this project, we have done some refactoring on the questionnaires_controller. We moved some methods to where we thought suited them, and changed the format of language into ruby style, deleted debugging statement. Details are displayed in the following sections.&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
The Expertiza project is system for using peer review to create reusable learning objects. Students do different assignments; then peer review selects the best work in each category, and assembles it to create a single unit.&amp;lt;ref&amp;gt;[http://expertiza.ncsu.edu/]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95289</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95289"/>
		<updated>2015-03-21T23:32:56Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Introduction to Expertiza */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
In this project, we have done some refactoring on the questionnaires_controller. We moved some methods to where we thought suited them, and changed the format of language into ruby style, deleted debugging statement. Details are displayed in the following sections.&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
The Expertiza project is system for using peer review to create reusable learning objects. Students do different assignments; then peer review selects the best work in each category, and assembles it to create a single unit.&amp;lt;ref&amp;gt;[http://expertiza.ncsu.edu/]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95288</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95288"/>
		<updated>2015-03-21T23:25:05Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* What we have left */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
In this project, we have done some refactoring on the questionnaires_controller. We moved some methods to where we thought suited them, and changed the format of language into ruby style, deleted debugging statement. Details are displayed in the following sections.&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95042</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95042"/>
		<updated>2015-03-21T03:21:10Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* E1502: Questionnaire Controller Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
In this project, we have done some refactoring on the questionnaires_controller. We moved some methods to where we thought suited them, and changed the format of language into ruby style, deleted debugging statement. Details are displayed in the following sections.&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==What we have left==&lt;br /&gt;
Though in the&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95041</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95041"/>
		<updated>2015-03-21T03:20:39Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* What we have left */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
In this project, we have done some refactoring on the questionnaires_controller. We moved some methods to where we thought suits them, and changed the format of language into ruby style, deleted debugging statement. Details are displayed in the following sections.&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==What we have left==&lt;br /&gt;
Though in the&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95040</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95040"/>
		<updated>2015-03-21T03:12:54Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* E1502: Questionnaire Controller Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
In this project, we have done some refactoring on the questionnaires_controller. We moved some methods to where we thought suits them, and changed the format of language into ruby style, deleted debugging statement. Details are displayed in the following sections.&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==What we have left==&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95039</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95039"/>
		<updated>2015-03-21T03:08:55Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==What we have left==&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95038</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95038"/>
		<updated>2015-03-21T03:06:22Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Case 3: Name */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95037</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95037"/>
		<updated>2015-03-21T03:03:28Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Method Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to be put in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95036</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95036"/>
		<updated>2015-03-21T03:01:10Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Case 2: if Condition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: If Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95035</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95035"/>
		<updated>2015-03-21T03:00:51Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* E1502: Questionnaire Controller Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: if Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95034</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95034"/>
		<updated>2015-03-21T03:00:29Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Case 2: if Condition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;red writing&amp;lt;/span&amp;gt;&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: if Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 if this_q&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95033</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95033"/>
		<updated>2015-03-21T02:59:44Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Format Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;red writing&amp;lt;/span&amp;gt;&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: if Condition====&lt;br /&gt;
Change all the if conditions into ruby format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 if @successful_create == true&lt;br /&gt;
 unless this_q.nil?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 if @successful_create&lt;br /&gt;
 if this_q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Case 3: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95032</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95032"/>
		<updated>2015-03-21T02:56:10Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Case 1: Loop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;red writing&amp;lt;/span&amp;gt;&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop Condition====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95031</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95031"/>
		<updated>2015-03-21T02:55:43Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Case 1: Loop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;red writing&amp;lt;/span&amp;gt;&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop====&lt;br /&gt;
Change all the looping conditions into one format&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  for question in @questionnaire.questions&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  @questionnaire.assignments.each&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Case 2: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95030</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95030"/>
		<updated>2015-03-21T02:53:10Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Format Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;red writing&amp;lt;/span&amp;gt;&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop====&lt;br /&gt;
Change all from &amp;quot;for question in @questionnaire.questions&amp;quot; to &amp;quot;@questionnaire.questions.each do |question|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        @questionnaire.questions.each do |question|&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Case 2: Name====&lt;br /&gt;
Change all the name from &amp;quot;JAVA name&amp;quot; to &amp;quot;Ruby name&amp;quot;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  questionnum=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #save an updated quiz questionnaire to the database&lt;br /&gt;
  def update_quiz&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  question_num=1&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95029</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95029"/>
		<updated>2015-03-21T02:48:30Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Case 1: Loop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;red writing&amp;lt;/span&amp;gt;&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop====&lt;br /&gt;
Change from &amp;quot;for question in @questionnaire.questions&amp;quot; to &amp;quot;@questionnaire.questions.each do |question|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        @questionnaire.questions.each do |question|&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95028</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95028"/>
		<updated>2015-03-21T02:47:54Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Format Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;red writing&amp;lt;/span&amp;gt;&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
====Case 1: Loop====&lt;br /&gt;
Change from &amp;quot;for question in @questionnaire.questions&amp;quot; to &amp;quot;@questionnaire.questions.each do |question|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Before&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        @questionnaire.questions.each do |question|&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95027</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95027"/>
		<updated>2015-03-21T02:47:22Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Format Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;red writing&amp;lt;/span&amp;gt;&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
&amp;lt;b&amp;gt;Case 1:&amp;lt;br&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
Change from &amp;quot;for question in @questionnaire.questions&amp;quot; to &amp;quot;@questionnaire.questions.each do |question|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Before&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        @questionnaire.questions.each do |question|&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95026</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95026"/>
		<updated>2015-03-21T02:46:50Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Format Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;red writing&amp;lt;/span&amp;gt;&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
&amp;lt;b&amp;gt;Case 1:&amp;lt;br&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
Change from &amp;quot;for question in @questionnaire.questions&amp;quot; to &amp;quot;@questionnaire.questions.each do |question|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Before&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&amp;lt;b&amp;gt;&lt;br /&gt;
        for question in @questionnaire.questions&amp;lt;/b&amp;gt;&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        @questionnaire.questions.each do |question|&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95025</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95025"/>
		<updated>2015-03-21T02:45:53Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Format Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;red writing&amp;lt;/span&amp;gt;&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
&amp;lt;b&amp;gt;Case 1:&amp;lt;br&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
Change from &amp;quot;for question in @questionnaire.questions&amp;quot; to &amp;quot;@questionnaire.questions.each do |question|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Before&lt;br /&gt;
&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
After&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
        @questionnaire.questions.each do |question|&amp;lt;/font&amp;gt;&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95024</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95024"/>
		<updated>2015-03-21T02:45:33Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;red writing&amp;lt;/span&amp;gt;&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
&amp;lt;b&amp;gt;Case 1:&amp;lt;br&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
Change from &amp;quot;for question in @questionnaire.questions&amp;quot; to &amp;quot;@questionnaire.questions.each do |question|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Before&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
        @questionnaire.questions.each do |question|&amp;lt;/font&amp;gt;&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95023</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95023"/>
		<updated>2015-03-21T02:45:15Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
&amp;lt;b&amp;gt;Case 1:&amp;lt;br&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
Change from &amp;quot;for question in @questionnaire.questions&amp;quot; to &amp;quot;@questionnaire.questions.each do |question|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Before&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
        @questionnaire.questions.each do |question|&amp;lt;/font&amp;gt;&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95022</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95022"/>
		<updated>2015-03-21T02:44:55Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
&amp;lt;b&amp;gt;Case 1:&amp;lt;br&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
Change from &amp;quot;for question in @questionnaire.questions&amp;quot; to &amp;quot;@questionnaire.questions.each do |question|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Before&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
        for question in @questionnaire.questions&amp;lt;/span&amp;gt;&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
        @questionnaire.questions.each do |question|&amp;lt;/font&amp;gt;&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95021</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95021"/>
		<updated>2015-03-21T02:43:03Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Format Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
&amp;lt;b&amp;gt;Case 1:&amp;lt;br&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
Change from &amp;quot;for question in @questionnaire.questions&amp;quot; to &amp;quot;@questionnaire.questions.each do |question|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Before&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
        for question in @questionnaire.questions&amp;lt;/font&amp;gt;&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
        @questionnaire.questions.each do |question|&amp;lt;/font&amp;gt;&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95020</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95020"/>
		<updated>2015-03-21T02:41:14Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Format Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
&amp;lt;b&amp;gt;Case 1:&amp;lt;br&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
change from &amp;quot;for question in @questionnaire.questions&amp;quot; to &amp;quot;@questionnaire.questions.each do |question|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Before&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        @questionnaire.questions.each do |question|&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95019</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95019"/>
		<updated>2015-03-21T02:40:15Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Format Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
&amp;lt;b&amp;gt;Case 1:&amp;lt;br&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
change from &amp;quot;for xx in xx&amp;quot; to &amp;quot;xx.each do |xx|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Before&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        @questionnaire.questions.each do |question|&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95018</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95018"/>
		<updated>2015-03-21T02:39:34Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Format Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
Case 1:&amp;lt;br&amp;gt;&lt;br /&gt;
change from &amp;quot;for xx in xx&amp;quot; to &amp;quot;xx.each do |xx|&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        @questionnaire.questions.each do |question|&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95017</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95017"/>
		<updated>2015-03-21T02:39:15Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
Case 1:&lt;br /&gt;
change from &amp;quot;for xx in xx&amp;quot; to &amp;quot;xx.each do |xx|&amp;quot;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        @questionnaire.questions.each do |question|&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95016</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95016"/>
		<updated>2015-03-21T02:38:37Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Format Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
Case 1:&lt;br /&gt;
change from &amp;quot;for xx in xx&amp;quot; to &amp;quot;xx.each do |xx|&amp;quot;&lt;br /&gt;
&amp;lt;b&amp;gt;Before&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;After&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        @questionnaire.questions.each do |question|&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Moving code to the proper place===&lt;br /&gt;
The ResponseController allows the user to create and edit responses to questionnaires, in doing so, there needs to be some sort of authentication, and the proper place for that is in the action_allowed? method, however the un-refactored code did in the redirect_when_disallowed method. Moreover, once this code was moved to the action_allowed? method, all of the references to redirect_when_disallowed were changed to action_allowed? (left out of wiki for brevity).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Changes&lt;br /&gt;
! |After Changes &lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
def action_allowed?&lt;br /&gt;
    current_user&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
def redirect_when_disallowed(response)&lt;br /&gt;
    # For author feedback, participants need to be able to read feedback submitted by other teammates.&lt;br /&gt;
    # If response is anything but author feedback, only the person who wrote feedback should be able to see it.&lt;br /&gt;
    if response.map.read_attribute(:type) == 'FeedbackResponseMap' &amp;amp;&amp;amp; response.map.assignment.team_assignment?&lt;br /&gt;
      team = response.map.reviewer.team&lt;br /&gt;
      unless team.has_user session[:user]&lt;br /&gt;
        redirect_to '/denied?reason=You are not on the team that wrote this feedback'&lt;br /&gt;
      else&lt;br /&gt;
        return false&lt;br /&gt;
      end&lt;br /&gt;
      response.map.read_attribute(:type)&lt;br /&gt;
    end&lt;br /&gt;
    !current_user_id?(response.map.reviewer.user_id)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
def action_allowed?(response)&lt;br /&gt;
    # For author feedback, participants need to be able to read feedback submitted by other teammates.&lt;br /&gt;
    # If response is anything but author feedback, only the person who wrote feedback should be able to see it.&lt;br /&gt;
    if response.map.read_attribute(:type) == 'FeedbackResponseMap' &amp;amp;&amp;amp; response.map.assignment.team_assignment?&lt;br /&gt;
      team = response.map.reviewer.team&lt;br /&gt;
      unless team.has_user session[:user]&lt;br /&gt;
        redirect_to '/denied?reason=You are not on the team that wrote this feedback'&lt;br /&gt;
      else&lt;br /&gt;
        return false&lt;br /&gt;
      end&lt;br /&gt;
      response.map.read_attribute(:type)&lt;br /&gt;
    end&lt;br /&gt;
    !current_user_id?(response.map.reviewer.user_id)&lt;br /&gt;
   end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95014</id>
		<title>CSC/ECE 517 Fall 2014/oss E1502 wwj</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_E1502_wwj&amp;diff=95014"/>
		<updated>2015-03-21T02:35:12Z</updated>

		<summary type="html">&lt;p&gt;Ywang95: /* Format Refactoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1502: Questionnaire Controller Refactoring==&lt;br /&gt;
&lt;br /&gt;
==Introduction to Expertiza==&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
===What it does:===	 &lt;br /&gt;
Used on the admin side of Expertiza for creating/ editing questionnaires (rubrics, surveys and quizzes). It helps in add/removing questions, options, etc for a questionnaire.&lt;br /&gt;
&amp;lt;li&amp;gt;Very big controller that handles a lot more than the name suggests. Functionalities need to be moved to appropriate controllers.&lt;br /&gt;
&amp;lt;li&amp;gt;Quiz methods are should be treated the same as any other type of questionnaire; differences between quiz questionnaires and other questionnaires should be implemented in the model class, quiz_questionnaire&lt;br /&gt;
&amp;lt;li&amp;gt;Turn the questionnaire into a “form object.”  The ..._questions methods: save_new_questions, delete_questions, save_questions should be in a separate class.&lt;br /&gt;
===Other classes involved:===&lt;br /&gt;
&amp;lt;li&amp;gt;questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;quiz_questionnaire.rb&lt;br /&gt;
&amp;lt;li&amp;gt;questions_controller.rb&lt;br /&gt;
&lt;br /&gt;
===What needs to be done:===&lt;br /&gt;
&amp;lt;li&amp;gt;Move quiz related functions to quiz_questionnaire.rb.&lt;br /&gt;
&amp;lt;li&amp;gt;copy, update_quiz, valid_quiz methods, clone_questionnaire_details is too long.&lt;br /&gt;
&amp;lt;li&amp;gt;Debug output (print statements) should be removed.&lt;br /&gt;
&amp;lt;li&amp;gt;Understand the functions in the controller and comment them. Ensure that the code is understandable to the next programmer who works on it.&lt;br /&gt;
&lt;br /&gt;
==What We Have Done==&lt;br /&gt;
===Method Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;width:13%;&amp;quot;|Method Name&lt;br /&gt;
! style=&amp;quot;width:33%;&amp;quot;|Changes Made &lt;br /&gt;
! style=&amp;quot;width:43%;&amp;quot;|Reason For Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| copy&lt;br /&gt;
| Extracted the content of this method as copy_questionnaires method and put it in questionnaire.rb &lt;br /&gt;
| The content of this method is about operations on the database (coping a questionnaire), it is better to put it in the model&lt;br /&gt;
|-&lt;br /&gt;
| valid_quiz&lt;br /&gt;
| Moved this method to quiz_questionnaire.rb&lt;br /&gt;
| This method is about validation of the quiz, it shouldn't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| export&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method exports the questionnaires as csv file, it should't appear in the controller &lt;br /&gt;
|-&lt;br /&gt;
| import&lt;br /&gt;
| Moved this method to questionnaire.rb&lt;br /&gt;
| This method imports the questionnaires from csv file, it should't appear in the controller&lt;br /&gt;
|-&lt;br /&gt;
| clone_questionnaire_details&lt;br /&gt;
| Deleted this method due to the duplication&lt;br /&gt;
| Substituted by copy_questionnaires method in questionnaire.rb &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
===Format Refactoring===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before &lt;br /&gt;
! |After&lt;br /&gt;
|- style=&amp;quot;vertical-align:bottom;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
 # Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        for question in @questionnaire.questions&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          unless current_q_type.nil?&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
# Remove a given questionnaire&lt;br /&gt;
  def delete&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    if @questionnaire&lt;br /&gt;
      begin&lt;br /&gt;
        name = @questionnaire.name&lt;br /&gt;
&lt;br /&gt;
        @questionnaire.questions.each do |question|&lt;br /&gt;
          current_q_type = QuestionType.find_by_question_id(question.id)&lt;br /&gt;
          if current_q_type&lt;br /&gt;
            current_q_type.delete&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
        @questionnaire.assignments.each{&lt;br /&gt;
          | assignment |&lt;br /&gt;
          raise &amp;quot;The assignment #{assignment.name} uses this questionnaire. Do you want to &amp;lt;A href='../assignment/delete/#{assignment.id}'&amp;gt;delete&amp;lt;/A&amp;gt; the assignment?&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        @questionnaire.destroy&lt;br /&gt;
        undo_link(&amp;quot;Questionnaire \&amp;quot;#{name}\&amp;quot; has been deleted successfully. &amp;quot;)&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = $!&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    redirect_to :action =&amp;gt; 'list', :controller =&amp;gt; 'tree_display'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|- style=&amp;quot;vertical-align:bottom;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
def view&lt;br /&gt;
    @response = Response.find(params[:id])&lt;br /&gt;
    return if redirect_when_disallowed(@response)&lt;br /&gt;
    @map = @response.map&lt;br /&gt;
    get_content&lt;br /&gt;
    @review_scores = Array.new&lt;br /&gt;
    @question_type = Array.new&lt;br /&gt;
    @questions.each do |question|&lt;br /&gt;
      @review_scores &amp;lt;&amp;lt; Score.where(response_id: @map.response_id, question_id:  question.id).first&lt;br /&gt;
      @question_type &amp;lt;&amp;lt; QuestionType.find_by_question_id(question.id)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
def view&lt;br /&gt;
    @response = Response.find(params[:id])&lt;br /&gt;
    return if action_allowed?(@response)&lt;br /&gt;
    @map = @response.map&lt;br /&gt;
    get_content&lt;br /&gt;
    get_scores(@response, @questions)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
def view&lt;br /&gt;
    @response = Response.find(params[:id])&lt;br /&gt;
    return if action_allowed?(@response)&lt;br /&gt;
    @map = @response.map&lt;br /&gt;
    get_content&lt;br /&gt;
    get_scores(@response, @questions)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Moving code to the proper place===&lt;br /&gt;
The ResponseController allows the user to create and edit responses to questionnaires, in doing so, there needs to be some sort of authentication, and the proper place for that is in the action_allowed? method, however the un-refactored code did in the redirect_when_disallowed method. Moreover, once this code was moved to the action_allowed? method, all of the references to redirect_when_disallowed were changed to action_allowed? (left out of wiki for brevity).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Changes&lt;br /&gt;
! |After Changes &lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
def action_allowed?&lt;br /&gt;
    current_user&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
def redirect_when_disallowed(response)&lt;br /&gt;
    # For author feedback, participants need to be able to read feedback submitted by other teammates.&lt;br /&gt;
    # If response is anything but author feedback, only the person who wrote feedback should be able to see it.&lt;br /&gt;
    if response.map.read_attribute(:type) == 'FeedbackResponseMap' &amp;amp;&amp;amp; response.map.assignment.team_assignment?&lt;br /&gt;
      team = response.map.reviewer.team&lt;br /&gt;
      unless team.has_user session[:user]&lt;br /&gt;
        redirect_to '/denied?reason=You are not on the team that wrote this feedback'&lt;br /&gt;
      else&lt;br /&gt;
        return false&lt;br /&gt;
      end&lt;br /&gt;
      response.map.read_attribute(:type)&lt;br /&gt;
    end&lt;br /&gt;
    !current_user_id?(response.map.reviewer.user_id)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
def action_allowed?(response)&lt;br /&gt;
    # For author feedback, participants need to be able to read feedback submitted by other teammates.&lt;br /&gt;
    # If response is anything but author feedback, only the person who wrote feedback should be able to see it.&lt;br /&gt;
    if response.map.read_attribute(:type) == 'FeedbackResponseMap' &amp;amp;&amp;amp; response.map.assignment.team_assignment?&lt;br /&gt;
      team = response.map.reviewer.team&lt;br /&gt;
      unless team.has_user session[:user]&lt;br /&gt;
        redirect_to '/denied?reason=You are not on the team that wrote this feedback'&lt;br /&gt;
      else&lt;br /&gt;
        return false&lt;br /&gt;
      end&lt;br /&gt;
      response.map.read_attribute(:type)&lt;br /&gt;
    end&lt;br /&gt;
    !current_user_id?(response.map.reviewer.user_id)&lt;br /&gt;
   end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ywang95</name></author>
	</entry>
</feed>