<?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=Nzlu</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=Nzlu"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Nzlu"/>
	<updated>2026-07-01T22:15:34Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104787</id>
		<title>CSC/ECE 517 Fall 2016/E1701. Accelerate RSpec testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104787"/>
		<updated>2016-11-08T22:28:26Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Eexpertiza''' ==&lt;br /&gt;
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.&lt;br /&gt;
== '''Rspec''' ==&lt;br /&gt;
Rspec is a meta-gem, which depends on the rspec-core, rspec-expectations and rspec-mocks gems. Each of these can be installed separately and loaded in isolation using require. Among other benefits, this allows you to use rspec-expectations, for example, in Test::Unit::TestCase if you happen to prefer that style.&lt;br /&gt;
Conversely, if you like RSpec's approach to declaring example groups and examples (describe and it) but prefer Test::Unit assertions and mocha, rr or flexmock for mocking, you'll be able to do that without having to install or load the components of RSpec that you're not using.&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Unfortunately, Expertiza tests are really slow. If you check the TravisCI, it needs more than 9 min to run all tests.&lt;br /&gt;
 &lt;br /&gt;
One reason is that we use fixture to create records in test DB each time running tests.&lt;br /&gt;
 &lt;br /&gt;
For example, the codes in quiz_spec.rb contain too much create so that prolong testing time.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   # Create an assignment due date&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;signup&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create :assignment_due_date, due_at: (DateTime.now + 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
One solution is building an complete database to one time to support all RSpec test without create new records.&lt;br /&gt;
&lt;br /&gt;
== '''Task''' ==&lt;br /&gt;
Formally, we need to:&lt;br /&gt;
* Create the records in test DB according to the content in fixtures.&lt;br /&gt;
* Check each test file and delete certain DB records creation code that insert default records (eg. create(:deadline_type)).&lt;br /&gt;
* And keep all the test cases passing when using test DB and make sure the time running test cases is shorter than before.&lt;br /&gt;
* You should submit the sql file of test DB to Expertiza.&lt;br /&gt;
To finish these tasks, we need to modify all RSpec test files in Expertiza and using a new Database:Expertiza_test.&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
=== Database design ===&lt;br /&gt;
We design a expertiza_test database to save the test date used for Rspec. The test database owns the same structure as the real expertiza database, including the relations between tables and some restriction of attribute like it cannot be null or some other requirements for different attributes. Besides, the data in test database is the same as the data in factories part in spec, which includes FeedbackResponseMap.rb, Respone.rb, factories.rb, quiz_factory.rb. In this situation we do not need to create some data before testing, and we can use the data in test DB directly. Because of it, the overhead of testing cases will experience obvious decreasing.&lt;br /&gt;
like the Rspec statements in creating some User objects.:&lt;br /&gt;
  factory :admin, class: User do&lt;br /&gt;
    sequence(:name) {|n| &amp;quot;admin#{n}&amp;quot; }&lt;br /&gt;
    role { Role.where(name: 'Administrator').first || association(:role_of_administrator) }&lt;br /&gt;
    password &amp;quot;password&amp;quot;&lt;br /&gt;
    password_confirmation &amp;quot;password&amp;quot;&lt;br /&gt;
    sequence(:fullname) {|n| &amp;quot;#{n}, administrator&amp;quot; }&lt;br /&gt;
    email &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
    parent_id 1&lt;br /&gt;
    private_by_default  false&lt;br /&gt;
    mru_directory_path  nil&lt;br /&gt;
    email_on_review true&lt;br /&gt;
    email_on_submission true&lt;br /&gt;
    email_on_review_of_review true&lt;br /&gt;
    is_new_user false&lt;br /&gt;
    master_permission_granted 0&lt;br /&gt;
    handle &amp;quot;handle&amp;quot;&lt;br /&gt;
    leaderboard_privacy false&lt;br /&gt;
    digital_certificate nil&lt;br /&gt;
    timezonepref nil&lt;br /&gt;
    public_key nil&lt;br /&gt;
    copy_of_emails  false&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
then transfer this into SQL query and then add the information the same as designed for Rspec test into expertiza_test database.&lt;br /&gt;
INSERT INTO User VALUES (xxxxx, xxxxxx, xxxxx, xxxxxxxx, xxxxxxx, xxxxxxx, xxxx );&lt;br /&gt;
&lt;br /&gt;
=== feature test design ===&lt;br /&gt;
To accelerate the feature test, we have to eliminate pseudo data creation. Now all the feature tests have to create their own data before each test. After building a test database, all the pseudo data creation statement can be removed from the test files. Instead, the tests reference data stored in the test database.&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104786</id>
		<title>CSC/ECE 517 Fall 2016/E1701. Accelerate RSpec testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104786"/>
		<updated>2016-11-08T22:27:45Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Eexpertiza''' ==&lt;br /&gt;
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.&lt;br /&gt;
== '''Rspec''' ==&lt;br /&gt;
Rspec is a meta-gem, which depends on the rspec-core, rspec-expectations and rspec-mocks gems. Each of these can be installed separately and loaded in isolation using require. Among other benefits, this allows you to use rspec-expectations, for example, in Test::Unit::TestCase if you happen to prefer that style.&lt;br /&gt;
Conversely, if you like RSpec's approach to declaring example groups and examples (describe and it) but prefer Test::Unit assertions and mocha, rr or flexmock for mocking, you'll be able to do that without having to install or load the components of RSpec that you're not using.&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Unfortunately, Expertiza tests are really slow. If you check the TravisCI, it needs more than 9 min to run all tests.&lt;br /&gt;
 &lt;br /&gt;
One reason is that we use fixture to create records in test DB each time running tests.&lt;br /&gt;
 &lt;br /&gt;
For example, the codes in quiz_spec.rb contain too much create so that prolong testing time.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   # Create an assignment due date&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;signup&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create :assignment_due_date, due_at: (DateTime.now + 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
One solution is building an complete database to one time to support all RSpec test without create new records.&lt;br /&gt;
&lt;br /&gt;
== '''Task''' ==&lt;br /&gt;
Formally, we need to:&lt;br /&gt;
* Create the records in test DB according to the content in fixtures.&lt;br /&gt;
* Check each test file and delete certain DB records creation code that insert default records (eg. create(:deadline_type)).&lt;br /&gt;
* And keep all the test cases passing when using test DB and make sure the time running test cases is shorter than before.&lt;br /&gt;
* You should submit the sql file of test DB to Expertiza.&lt;br /&gt;
To finish these tasks we need to modify all RSpec test files in Expertiza and using a new Database:Expertiza_test.&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
=== Database design ===&lt;br /&gt;
We design a expertiza_test database to save the test date used for Rspec. The test database owns the same structure as the real expertiza database, including the relations between tables and some restriction of attribute like it cannot be null or some other requirements for different attributes. Besides, the data in test database is the same as the data in factories part in spec, which includes FeedbackResponseMap.rb, Respone.rb, factories.rb, quiz_factory.rb. In this situation we do not need to create some data before testing, and we can use the data in test DB directly. Because of it, the overhead of testing cases will experience obvious decreasing.&lt;br /&gt;
like the Rspec statements in creating some User objects.:&lt;br /&gt;
  factory :admin, class: User do&lt;br /&gt;
    sequence(:name) {|n| &amp;quot;admin#{n}&amp;quot; }&lt;br /&gt;
    role { Role.where(name: 'Administrator').first || association(:role_of_administrator) }&lt;br /&gt;
    password &amp;quot;password&amp;quot;&lt;br /&gt;
    password_confirmation &amp;quot;password&amp;quot;&lt;br /&gt;
    sequence(:fullname) {|n| &amp;quot;#{n}, administrator&amp;quot; }&lt;br /&gt;
    email &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
    parent_id 1&lt;br /&gt;
    private_by_default  false&lt;br /&gt;
    mru_directory_path  nil&lt;br /&gt;
    email_on_review true&lt;br /&gt;
    email_on_submission true&lt;br /&gt;
    email_on_review_of_review true&lt;br /&gt;
    is_new_user false&lt;br /&gt;
    master_permission_granted 0&lt;br /&gt;
    handle &amp;quot;handle&amp;quot;&lt;br /&gt;
    leaderboard_privacy false&lt;br /&gt;
    digital_certificate nil&lt;br /&gt;
    timezonepref nil&lt;br /&gt;
    public_key nil&lt;br /&gt;
    copy_of_emails  false&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
then transfer this into SQL query and then add the information the same as designed for Rspec test into expertiza_test database.&lt;br /&gt;
INSERT INTO User VALUES (xxxxx, xxxxxx, xxxxx, xxxxxxxx, xxxxxxx, xxxxxxx, xxxx );&lt;br /&gt;
&lt;br /&gt;
=== feature test design ===&lt;br /&gt;
To accelerate the feature test, we have to eliminate pseudo data creation. Now all the feature tests have to create their own data before each test. After building a test database, all the pseudo data creation statement can be removed from the test files. Instead, the tests reference data stored in the test database.&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104785</id>
		<title>CSC/ECE 517 Fall 2016/E1701. Accelerate RSpec testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104785"/>
		<updated>2016-11-08T22:25:46Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Eexpertiza''' ==&lt;br /&gt;
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.&lt;br /&gt;
== '''Rspec''' ==&lt;br /&gt;
Rspec is a meta-gem, which depends on the rspec-core, rspec-expectations and rspec-mocks gems. Each of these can be installed separately and loaded in isolation using require. Among other benefits, this allows you to use rspec-expectations, for example, in Test::Unit::TestCase if you happen to prefer that style.&lt;br /&gt;
Conversely, if you like RSpec's approach to declaring example groups and examples (describe and it) but prefer Test::Unit assertions and mocha, rr or flexmock for mocking, you'll be able to do that without having to install or load the components of RSpec that you're not using.&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Unfortunately, Expertiza tests are really slow. If you check the TravisCI, it needs more than 9 min to run all tests.&lt;br /&gt;
 &lt;br /&gt;
One reason is that we use fixture to create records in test DB each time running tests.&lt;br /&gt;
 &lt;br /&gt;
For example, the codes in quiz_spec.rb contain too much create so that prolong testing time.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   # Create an assignment due date&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;signup&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create :assignment_due_date, due_at: (DateTime.now + 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
One solution is building an complete database to one time to support all RSpec test without create new records.&lt;br /&gt;
== '''Related Work''' ==&lt;br /&gt;
* Classes involved:  All RSpec test files in Expertiza.&lt;br /&gt;
* Database involved: Expertiza_test &lt;br /&gt;
&lt;br /&gt;
== '''Task''' ==&lt;br /&gt;
Formally, we need to:&lt;br /&gt;
* Create the records in test DB according to the content in fixtures.&lt;br /&gt;
* Check each test file and delete certain DB records creation code that insert default records (eg. create(:deadline_type)).&lt;br /&gt;
* And keep all the test cases passing when using test DB and make sure the time running test cases is shorter than before.&lt;br /&gt;
* You should submit the sql file of test DB to Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
=== Database design ===&lt;br /&gt;
We design a expertiza_test database to save the test date used for Rspec. The test database owns the same structure as the real expertiza database, including the relations between tables and some restriction of attribute like it cannot be null or some other requirements for different attributes. Besides, the data in test database is the same as the data in factories part in spec, which includes FeedbackResponseMap.rb, Respone.rb, factories.rb, quiz_factory.rb. In this situation we do not need to create some data before testing, and we can use the data in test DB directly. Because of it, the overhead of testing cases will experience obvious decreasing.&lt;br /&gt;
like the Rspec statements in creating some User objects.:&lt;br /&gt;
  factory :admin, class: User do&lt;br /&gt;
    sequence(:name) {|n| &amp;quot;admin#{n}&amp;quot; }&lt;br /&gt;
    role { Role.where(name: 'Administrator').first || association(:role_of_administrator) }&lt;br /&gt;
    password &amp;quot;password&amp;quot;&lt;br /&gt;
    password_confirmation &amp;quot;password&amp;quot;&lt;br /&gt;
    sequence(:fullname) {|n| &amp;quot;#{n}, administrator&amp;quot; }&lt;br /&gt;
    email &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
    parent_id 1&lt;br /&gt;
    private_by_default  false&lt;br /&gt;
    mru_directory_path  nil&lt;br /&gt;
    email_on_review true&lt;br /&gt;
    email_on_submission true&lt;br /&gt;
    email_on_review_of_review true&lt;br /&gt;
    is_new_user false&lt;br /&gt;
    master_permission_granted 0&lt;br /&gt;
    handle &amp;quot;handle&amp;quot;&lt;br /&gt;
    leaderboard_privacy false&lt;br /&gt;
    digital_certificate nil&lt;br /&gt;
    timezonepref nil&lt;br /&gt;
    public_key nil&lt;br /&gt;
    copy_of_emails  false&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
then transfer this into SQL query and then add the information the same as designed for Rspec test into expertiza_test database.&lt;br /&gt;
INSERT INTO User VALUES (xxxxx, xxxxxx, xxxxx, xxxxxxxx, xxxxxxx, xxxxxxx, xxxx );&lt;br /&gt;
&lt;br /&gt;
=== feature test design ===&lt;br /&gt;
To accelerate the feature test, we have to eliminate pseudo data creation. Now all the feature tests have to create their own data before each test. After building a test database, all the pseudo data creation statement can be removed from the test files. Instead, the tests reference data stored in the test database.&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104784</id>
		<title>CSC/ECE 517 Fall 2016/E1701. Accelerate RSpec testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104784"/>
		<updated>2016-11-08T22:25:30Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Eexpertiza''' ==&lt;br /&gt;
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.&lt;br /&gt;
== '''Rspec''' ==&lt;br /&gt;
rspec is a meta-gem, which depends on the rspec-core, rspec-expectations and rspec-mocks gems. Each of these can be installed separately and loaded in isolation using require. Among other benefits, this allows you to use rspec-expectations, for example, in Test::Unit::TestCase if you happen to prefer that style.&lt;br /&gt;
Conversely, if you like RSpec's approach to declaring example groups and examples (describe and it) but prefer Test::Unit assertions and mocha, rr or flexmock for mocking, you'll be able to do that without having to install or load the components of RSpec that you're not using.&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Unfortunately, Expertiza tests are really slow. If you check the TravisCI, it needs more than 9 min to run all tests.&lt;br /&gt;
 &lt;br /&gt;
One reason is that we use fixture to create records in test DB each time running tests.&lt;br /&gt;
 &lt;br /&gt;
For example, the codes in quiz_spec.rb contain too much create so that prolong testing time.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   # Create an assignment due date&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;signup&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create :assignment_due_date, due_at: (DateTime.now + 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
One solution is building an complete database to one time to support all RSpec test without create new records.&lt;br /&gt;
== '''Related Work''' ==&lt;br /&gt;
* Classes involved:  All RSpec test files in Expertiza.&lt;br /&gt;
* Database involved: Expertiza_test &lt;br /&gt;
&lt;br /&gt;
== '''Task''' ==&lt;br /&gt;
Formally, we need to:&lt;br /&gt;
* Create the records in test DB according to the content in fixtures.&lt;br /&gt;
* Check each test file and delete certain DB records creation code that insert default records (eg. create(:deadline_type)).&lt;br /&gt;
* And keep all the test cases passing when using test DB and make sure the time running test cases is shorter than before.&lt;br /&gt;
* You should submit the sql file of test DB to Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
=== Database design ===&lt;br /&gt;
We design a expertiza_test database to save the test date used for Rspec. The test database owns the same structure as the real expertiza database, including the relations between tables and some restriction of attribute like it cannot be null or some other requirements for different attributes. Besides, the data in test database is the same as the data in factories part in spec, which includes FeedbackResponseMap.rb, Respone.rb, factories.rb, quiz_factory.rb. In this situation we do not need to create some data before testing, and we can use the data in test DB directly. Because of it, the overhead of testing cases will experience obvious decreasing.&lt;br /&gt;
like the Rspec statements in creating some User objects.:&lt;br /&gt;
  factory :admin, class: User do&lt;br /&gt;
    sequence(:name) {|n| &amp;quot;admin#{n}&amp;quot; }&lt;br /&gt;
    role { Role.where(name: 'Administrator').first || association(:role_of_administrator) }&lt;br /&gt;
    password &amp;quot;password&amp;quot;&lt;br /&gt;
    password_confirmation &amp;quot;password&amp;quot;&lt;br /&gt;
    sequence(:fullname) {|n| &amp;quot;#{n}, administrator&amp;quot; }&lt;br /&gt;
    email &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
    parent_id 1&lt;br /&gt;
    private_by_default  false&lt;br /&gt;
    mru_directory_path  nil&lt;br /&gt;
    email_on_review true&lt;br /&gt;
    email_on_submission true&lt;br /&gt;
    email_on_review_of_review true&lt;br /&gt;
    is_new_user false&lt;br /&gt;
    master_permission_granted 0&lt;br /&gt;
    handle &amp;quot;handle&amp;quot;&lt;br /&gt;
    leaderboard_privacy false&lt;br /&gt;
    digital_certificate nil&lt;br /&gt;
    timezonepref nil&lt;br /&gt;
    public_key nil&lt;br /&gt;
    copy_of_emails  false&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
then transfer this into SQL query and then add the information the same as designed for Rspec test into expertiza_test database.&lt;br /&gt;
INSERT INTO User VALUES (xxxxx, xxxxxx, xxxxx, xxxxxxxx, xxxxxxx, xxxxxxx, xxxx );&lt;br /&gt;
&lt;br /&gt;
=== feature test design ===&lt;br /&gt;
To accelerate the feature test, we have to eliminate pseudo data creation. Now all the feature tests have to create their own data before each test. After building a test database, all the pseudo data creation statement can be removed from the test files. Instead, the tests reference data stored in the test database.&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104781</id>
		<title>CSC/ECE 517 Fall 2016/E1701. Accelerate RSpec testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104781"/>
		<updated>2016-11-08T22:15:16Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Eexpertiza''' ==&lt;br /&gt;
== '''Rspec''' ==&lt;br /&gt;
rspec is a meta-gem, which depends on the rspec-core, rspec-expectations and rspec-mocks gems. Each of these can be installed separately and loaded in isolation using require. Among other benefits, this allows you to use rspec-expectations, for example, in Test::Unit::TestCase if you happen to prefer that style.&lt;br /&gt;
Conversely, if you like RSpec's approach to declaring example groups and examples (describe and it) but prefer Test::Unit assertions and mocha, rr or flexmock for mocking, you'll be able to do that without having to install or load the components of RSpec that you're not using.&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.Unfortunately, Expertiza tests are really slow. If you check the TravisCI, it needs more than 9 min to run all tests.&lt;br /&gt;
 &lt;br /&gt;
One reason is that we use fixture to create records in test DB each time running tests.&lt;br /&gt;
 &lt;br /&gt;
For example, the codes in quiz_spec.rb contain too much create so that prolong testing time.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   # Create an assignment due date&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;signup&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create :assignment_due_date, due_at: (DateTime.now + 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
One solution is building an complete database to one time to support all RSpec test without create new records.&lt;br /&gt;
== '''Related Work''' ==&lt;br /&gt;
* Classes involved:  All RSpec test files in Expertiza.&lt;br /&gt;
* Database involved: Expertiza_test &lt;br /&gt;
&lt;br /&gt;
== '''Task''' ==&lt;br /&gt;
Formally, you need to:&lt;br /&gt;
* Create the records in test DB according to the content in fixtures.&lt;br /&gt;
* Check each test file and delete certain DB records creation code that insert default records (eg. create(:deadline_type)).&lt;br /&gt;
* And keep all the test cases passing when using test DB and make sure the time running test cases is shorter than before.&lt;br /&gt;
* You should submit the sql file of test DB to Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
=== Database design ===&lt;br /&gt;
We design a expertiza_test database to save the test date used for Rspec. The test database owns the same structure as the real expertiza database, including the relations between tables and some restriction of attribute like it cannot be null or some other requirements for different attributes. Besides, the data in test database is the same as the data in factories part in spec, which includes FeedbackResponseMap.rb, Respone.rb, factories.rb, quiz_factory.rb. In this situation we do not need to create some data before testing, and we can use the data in test DB directly. Because of it, the overhead of testing cases will experience obvious decreasing.&lt;br /&gt;
like the Rspec statements in creating some User objects.:&lt;br /&gt;
  factory :admin, class: User do&lt;br /&gt;
    sequence(:name) {|n| &amp;quot;admin#{n}&amp;quot; }&lt;br /&gt;
    role { Role.where(name: 'Administrator').first || association(:role_of_administrator) }&lt;br /&gt;
    password &amp;quot;password&amp;quot;&lt;br /&gt;
    password_confirmation &amp;quot;password&amp;quot;&lt;br /&gt;
    sequence(:fullname) {|n| &amp;quot;#{n}, administrator&amp;quot; }&lt;br /&gt;
    email &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
    parent_id 1&lt;br /&gt;
    private_by_default  false&lt;br /&gt;
    mru_directory_path  nil&lt;br /&gt;
    email_on_review true&lt;br /&gt;
    email_on_submission true&lt;br /&gt;
    email_on_review_of_review true&lt;br /&gt;
    is_new_user false&lt;br /&gt;
    master_permission_granted 0&lt;br /&gt;
    handle &amp;quot;handle&amp;quot;&lt;br /&gt;
    leaderboard_privacy false&lt;br /&gt;
    digital_certificate nil&lt;br /&gt;
    timezonepref nil&lt;br /&gt;
    public_key nil&lt;br /&gt;
    copy_of_emails  false&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
then transfer this into SQL query and then add the information the same as designed for Rspec test into expertiza_test database.&lt;br /&gt;
=== feature test design ===&lt;br /&gt;
To accelerate the feature test, we have to eliminate pseudo data creation. Now all the feature tests have to create their own data before each test. After building a test database, all the pseudo data creation statement can be removed from the test files. Instead, the tests reference data stored in the test database.&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104780</id>
		<title>CSC/ECE 517 Fall 2016/E1701. Accelerate RSpec testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104780"/>
		<updated>2016-11-08T22:14:43Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Eexpertiza''' ==&lt;br /&gt;
== '''Rspec''' ==&lt;br /&gt;
rspec is a meta-gem, which depends on the rspec-core, rspec-expectations and rspec-mocks gems. Each of these can be installed separately and loaded in isolation using ''require''. Among other benefits, this allows you to use rspec-expectations, for example, in Test::Unit::TestCase if you happen to prefer that style.&lt;br /&gt;
Conversely, if you like RSpec's approach to declaring example groups and examples (describe and it) but prefer Test::Unit assertions and mocha, rr or flexmock for mocking, you'll be able to do that without having to install or load the components of RSpec that you're not using.&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.Unfortunately, Expertiza tests are really slow. If you check the TravisCI, it needs more than 9 min to run all tests.&lt;br /&gt;
 &lt;br /&gt;
One reason is that we use fixture to create records in test DB each time running tests.&lt;br /&gt;
 &lt;br /&gt;
For example, the codes in quiz_spec.rb contain too much create so that prolong testing time.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   # Create an assignment due date&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;signup&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create :assignment_due_date, due_at: (DateTime.now + 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
One solution is building an complete database to one time to support all RSpec test without create new records.&lt;br /&gt;
== '''Related Work''' ==&lt;br /&gt;
* Classes involved:  All RSpec test files in Expertiza.&lt;br /&gt;
* Database involved: Expertiza_test &lt;br /&gt;
&lt;br /&gt;
== '''Task''' ==&lt;br /&gt;
Formally, you need to:&lt;br /&gt;
* Create the records in test DB according to the content in fixtures.&lt;br /&gt;
* Check each test file and delete certain DB records creation code that insert default records (eg. create(:deadline_type)).&lt;br /&gt;
* And keep all the test cases passing when using test DB and make sure the time running test cases is shorter than before.&lt;br /&gt;
* You should submit the sql file of test DB to Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
=== Database design ===&lt;br /&gt;
We design a expertiza_test database to save the test date used for Rspec. The test database owns the same structure as the real expertiza database, including the relations between tables and some restriction of attribute like it cannot be null or some other requirements for different attributes. Besides, the data in test database is the same as the data in factories part in spec, which includes FeedbackResponseMap.rb, Respone.rb, factories.rb, quiz_factory.rb. In this situation we do not need to create some data before testing, and we can use the data in test DB directly. Because of it, the overhead of testing cases will experience obvious decreasing.&lt;br /&gt;
like the Rspec statements in creating some User objects.:&lt;br /&gt;
  factory :admin, class: User do&lt;br /&gt;
    sequence(:name) {|n| &amp;quot;admin#{n}&amp;quot; }&lt;br /&gt;
    role { Role.where(name: 'Administrator').first || association(:role_of_administrator) }&lt;br /&gt;
    password &amp;quot;password&amp;quot;&lt;br /&gt;
    password_confirmation &amp;quot;password&amp;quot;&lt;br /&gt;
    sequence(:fullname) {|n| &amp;quot;#{n}, administrator&amp;quot; }&lt;br /&gt;
    email &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
    parent_id 1&lt;br /&gt;
    private_by_default  false&lt;br /&gt;
    mru_directory_path  nil&lt;br /&gt;
    email_on_review true&lt;br /&gt;
    email_on_submission true&lt;br /&gt;
    email_on_review_of_review true&lt;br /&gt;
    is_new_user false&lt;br /&gt;
    master_permission_granted 0&lt;br /&gt;
    handle &amp;quot;handle&amp;quot;&lt;br /&gt;
    leaderboard_privacy false&lt;br /&gt;
    digital_certificate nil&lt;br /&gt;
    timezonepref nil&lt;br /&gt;
    public_key nil&lt;br /&gt;
    copy_of_emails  false&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
then transfer this into SQL query and then add the information the same as designed for Rspec test into expertiza_test database.&lt;br /&gt;
=== feature test design ===&lt;br /&gt;
To accelerate the feature test, we have to eliminate pseudo data creation. Now all the feature tests have to create their own data before each test. After building a test database, all the pseudo data creation statement can be removed from the test files. Instead, the tests reference data stored in the test database.&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104778</id>
		<title>CSC/ECE 517 Fall 2016/E1701. Accelerate RSpec testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104778"/>
		<updated>2016-11-08T22:11:50Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Eexpertiza''' ==&lt;br /&gt;
== '''Rspec''' ==&lt;br /&gt;
rspec is a meta-gem, which depends on the rspec-core, rspec-expectations and rspec-mocks gems. Each of these can be installed separately and loaded in isolation using require. Among other benefits, this allows you to use rspec-expectations, for example, in Test::Unit::TestCase if you happen to prefer that style.&lt;br /&gt;
Conversely, if you like RSpec's approach to declaring example groups and examples (describe and it) but prefer Test::Unit assertions and mocha, rr or flexmock for mocking, you'll be able to do that without having to install or load the components of RSpec that you're not using.&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.Unfortunately, Expertiza tests are really slow. If you check the TravisCI, it needs more than 9 min to run all tests.&lt;br /&gt;
 One reason is that we use fixture to create records in test DB each time running tests.&lt;br /&gt;
 For example, the codes in quiz_spec.rb contain too much create so that prolong testing time.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   # Create an assignment due date&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;signup&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create :assignment_due_date, due_at: (DateTime.now + 1)&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
One solution is building an complete database to one time to support all RSpec test without create new records.&lt;br /&gt;
== '''Related Work''' ==&lt;br /&gt;
* Classes involved:  All RSpec test files in Expertiza.&lt;br /&gt;
* Database involved: Expertiza_test &lt;br /&gt;
&lt;br /&gt;
== '''Task''' ==&lt;br /&gt;
Formally, you need to:&lt;br /&gt;
* Create the records in test DB according to the content in fixtures.&lt;br /&gt;
* Check each test file and delete certain DB records creation code that insert default records (eg. create(:deadline_type)).&lt;br /&gt;
* And keep all the test cases passing when using test DB and make sure the time running test cases is shorter than before.&lt;br /&gt;
* You should submit the sql file of test DB to Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
=== Database design ===&lt;br /&gt;
We design a expertiza_test database to save the test date used for Rspec. The test database owns the same structure as the real expertiza database, including the relations between tables and some restriction of attribute like it cannot be null or some other requirements for different attributes. Besides, the data in test database is the same as the data in factories part in spec, which includes FeedbackResponseMap.rb, Respone.rb, factories.rb, quiz_factory.rb. In this situation we do not need to create some data before testing, and we can use the data in test DB directly. Because of it, the overhead of testing cases will experience obvious decreasing.&lt;br /&gt;
like the Rspec statements in creating some User objects.:&lt;br /&gt;
  factory :admin, class: User do&lt;br /&gt;
    sequence(:name) {|n| &amp;quot;admin#{n}&amp;quot; }&lt;br /&gt;
    role { Role.where(name: 'Administrator').first || association(:role_of_administrator) }&lt;br /&gt;
    password &amp;quot;password&amp;quot;&lt;br /&gt;
    password_confirmation &amp;quot;password&amp;quot;&lt;br /&gt;
    sequence(:fullname) {|n| &amp;quot;#{n}, administrator&amp;quot; }&lt;br /&gt;
    email &amp;quot;expertiza@mailinator.com&amp;quot;&lt;br /&gt;
    parent_id 1&lt;br /&gt;
    private_by_default  false&lt;br /&gt;
    mru_directory_path  nil&lt;br /&gt;
    email_on_review true&lt;br /&gt;
    email_on_submission true&lt;br /&gt;
    email_on_review_of_review true&lt;br /&gt;
    is_new_user false&lt;br /&gt;
    master_permission_granted 0&lt;br /&gt;
    handle &amp;quot;handle&amp;quot;&lt;br /&gt;
    leaderboard_privacy false&lt;br /&gt;
    digital_certificate nil&lt;br /&gt;
    timezonepref nil&lt;br /&gt;
    public_key nil&lt;br /&gt;
    copy_of_emails  false&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
then transfer this into SQL query and then add the information the same as designed for Rspec test into expertiza_test database.&lt;br /&gt;
=== feature test design ===&lt;br /&gt;
To accelerate the feature test, we have to eliminate pseudo data creation. Now all the feature tests have to create their own data before each test. After building a test database, all the pseudo data creation statement can be removed from the test files. Instead, the tests reference data stored in the test database.&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104770</id>
		<title>CSC/ECE 517 Fall 2016/E1701. Accelerate RSpec testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104770"/>
		<updated>2016-11-08T22:00:25Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Eexpertiza''' ==&lt;br /&gt;
== '''Rspec''' ==&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.&lt;br /&gt;
Unfortunately, Expertiza tests are really slow. If you check the TravisCI, it needs more than 9 min to run all tests. &lt;br /&gt;
One reason is that we use fixture to create records in test DB each time running tests.&lt;br /&gt;
&lt;br /&gt;
== '''Related Work''' ==&lt;br /&gt;
* Classes involved:  All RSpec test files in Expertiza.&lt;br /&gt;
* Database involved: Expertiza_test &lt;br /&gt;
&lt;br /&gt;
== '''Task''' ==&lt;br /&gt;
Formally, you need to:&lt;br /&gt;
* Create the records in test DB according to the content in fixtures.&lt;br /&gt;
* Check each test file and delete certain DB records creation code that insert default records (eg. create(:deadline_type)) &lt;br /&gt;
* And keep all the test cases passing when using test DB and make sure the time running test cases is shorter than before.&lt;br /&gt;
* You should submit the sql file of test DB to expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
=== Database design ===&lt;br /&gt;
=== factories design ===&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104769</id>
		<title>CSC/ECE 517 Fall 2016/E1701. Accelerate RSpec testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104769"/>
		<updated>2016-11-08T22:00:04Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Eexpertiza==&lt;br /&gt;
== Rspec ==&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.&lt;br /&gt;
Unfortunately, Expertiza tests are really slow. If you check the TravisCI, it needs more than 9 min to run all tests. &lt;br /&gt;
One reason is that we use fixture to create records in test DB each time running tests.&lt;br /&gt;
&lt;br /&gt;
== '''Related Work''' ==&lt;br /&gt;
* Classes involved:  All RSpec test files in Expertiza.&lt;br /&gt;
* Database involved: Expertiza_test &lt;br /&gt;
&lt;br /&gt;
== '''Task''' ==&lt;br /&gt;
Formally, you need to:&lt;br /&gt;
* Create the records in test DB according to the content in fixtures.&lt;br /&gt;
* Check each test file and delete certain DB records creation code that insert default records (eg. create(:deadline_type)) &lt;br /&gt;
* And keep all the test cases passing when using test DB and make sure the time running test cases is shorter than before.&lt;br /&gt;
* You should submit the sql file of test DB to expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
=== Database design ===&lt;br /&gt;
=== factories design ===&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104768</id>
		<title>CSC/ECE 517 Fall 2016/E1701. Accelerate RSpec testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104768"/>
		<updated>2016-11-08T21:58:56Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Problem Statement''' ==&lt;br /&gt;
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.&lt;br /&gt;
Unfortunately, Expertiza tests are really slow. If you check the TravisCI, it needs more than 9 min to run all tests. &lt;br /&gt;
One reason is that we use fixture to create records in test DB each time running tests.&lt;br /&gt;
&lt;br /&gt;
== '''Related Work''' ==&lt;br /&gt;
* Classes involved:  All RSpec test files in Expertiza.&lt;br /&gt;
* Database involved: Expertiza_test &lt;br /&gt;
&lt;br /&gt;
== '''Task''' ==&lt;br /&gt;
Formally, you need to:&lt;br /&gt;
* Create the records in test DB according to the content in fixtures.&lt;br /&gt;
* Check each test file and delete certain DB records creation code that insert default records (eg. create(:deadline_type)) &lt;br /&gt;
* And keep all the test cases passing when using test DB and make sure the time running test cases is shorter than before.&lt;br /&gt;
* You should submit the sql file of test DB to expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
=== Database design ===&lt;br /&gt;
=== factories design ===&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104767</id>
		<title>CSC/ECE 517 Fall 2016/E1701. Accelerate RSpec testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104767"/>
		<updated>2016-11-08T21:57:50Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
Expertiza is a web application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.&lt;br /&gt;
Unfortunately, Expertiza tests are really slow. If you check the TravisCI, it needs more than 9 min to run all tests. &lt;br /&gt;
One reason is that we use fixture to create records in test DB each time running tests.&lt;br /&gt;
&lt;br /&gt;
== Related Work ==&lt;br /&gt;
* Classes involved:  All RSpec test files in Expertiza.&lt;br /&gt;
* Database involved: Expertiza_test &lt;br /&gt;
&lt;br /&gt;
== Task ==&lt;br /&gt;
Formally, you need to:&lt;br /&gt;
* Create the records in test DB according to the content in fixtures.&lt;br /&gt;
* Check each test file and delete certain DB records creation code that insert default records (eg. create(:deadline_type)) &lt;br /&gt;
* And keep all the test cases passing when using test DB and make sure the time running test cases is shorter than before.&lt;br /&gt;
* You should submit the sql file of test DB to expertiza.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
=== Database design ===&lt;br /&gt;
=== factories design ===&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104763</id>
		<title>CSC/ECE 517 Fall 2016/E1701. Accelerate RSpec testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1701._Accelerate_RSpec_testing&amp;diff=104763"/>
		<updated>2016-11-08T21:45:17Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
Expertiza tests are really slow. If you check the TravisCI, it needs more than 9 min to run all tests. &lt;br /&gt;
One reason is that we use fixture to create records in test DB each time running tests.&lt;br /&gt;
&lt;br /&gt;
== Related Work ==&lt;br /&gt;
* Classes involved:  All RSpec test files in Expertiza.&lt;br /&gt;
* Database involved: Expertiza_test &lt;br /&gt;
&lt;br /&gt;
== Task ==&lt;br /&gt;
Formally, you need to:&lt;br /&gt;
* Create the records in test DB according to the content in fixtures.&lt;br /&gt;
* Check each test file and delete certain DB records creation code that insert default records (eg. create(:deadline_type)) &lt;br /&gt;
* And keep all the test cases passing when using test DB and make sure the time running test cases is shorter than before.&lt;br /&gt;
* You should submit the sql file of test DB to expertiza.&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=104586</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=104586"/>
		<updated>2016-11-05T01:24:21Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite part of the codes in the Criterion.rb, Scale.rb, Checkbox.rb, Dropdown.rb, Text_response.rb, Text_area.rb, Text_field.rb. This is because some of codes have bad writing sytle, or not followingg OO language rules, which confuse others to understand these code. The detail of the requirements are list below: &lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop&lt;br /&gt;
&lt;br /&gt;
All of these requirements are based on a analysis software called [https://codeclimate.com code climate]&lt;br /&gt;
&lt;br /&gt;
==Result==&lt;br /&gt;
&lt;br /&gt;
[[File:Lzhang45_1.png]]&lt;br /&gt;
[[File:Lzhang45_2.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
===text_field.rb===&lt;br /&gt;
Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
&lt;br /&gt;
1. Short the long line&lt;br /&gt;
&lt;br /&gt;
2. Improve security by using safe_join&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
 html.html_safe&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
 safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
3. Short long method&lt;br /&gt;
&lt;br /&gt;
Previous &lt;br /&gt;
 html += '&amp;lt;label for=&amp;quot;responses_' + count.to_s + '&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/label&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;input id=&amp;quot;responses_' + count.to_s + '_score&amp;quot; name=&amp;quot;responses[' + count.to_s + '][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot;&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;input id=&amp;quot;responses_' + count.to_s + '_comments&amp;quot; label=' + self.txt + ' name=&amp;quot;responses[' + count.to_s + '][comment]&amp;quot; size=' + self.size.to_s + ' type=&amp;quot;text&amp;quot;'&lt;br /&gt;
    html += 'value=&amp;quot;' + answer.comments unless answer.nil?&lt;br /&gt;
    html += '&amp;quot;&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/li&amp;gt;&amp;lt;BR/&amp;gt;&amp;lt;BR/&amp;gt;' if self.type == 'TextField' and self.break_before == false&lt;br /&gt;
 def complete(count, answer = nil)&lt;br /&gt;
    html = if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
    html += combine(count, answer)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
 def combline(count, answer = nil)&lt;br /&gt;
    html = complete_helper_response_scores(count) + complete_helper_response_comments(count)&lt;br /&gt;
    html += complete_helper_text(answer) + complete_helper_response_comments&lt;br /&gt;
    html += complete_helper_final_judge&lt;br /&gt;
    html&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===text_response.rb===&lt;br /&gt;
It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
&lt;br /&gt;
1. Use new style validations&lt;br /&gt;
Previous&lt;br /&gt;
 validates_presence_of :size&lt;br /&gt;
Changed&lt;br /&gt;
 validates :size, presence: true&lt;br /&gt;
&lt;br /&gt;
2. Short the long line&lt;br /&gt;
&lt;br /&gt;
3. Improve security by safe_join&lt;br /&gt;
&lt;br /&gt;
Preivious&lt;br /&gt;
 html.html_safe&lt;br /&gt;
Changed&lt;br /&gt;
 safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
&lt;br /&gt;
4. Short long method&lt;br /&gt;
&lt;br /&gt;
Preivious&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (TextResponse does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;text area size &amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.size.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][size]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_size&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
Changed&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_link + edit_question_lable&lt;br /&gt;
    html += edit_question_textarea + edit_question_textarea_size&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===scale.rb===&lt;br /&gt;
1. Use each loop instead of for loop&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
  for j in questionnaire_min..questionnaire_max&lt;br /&gt;
      html += '&amp;lt;td width=&amp;quot;10%&amp;quot;&amp;gt;&amp;lt;input type=&amp;quot;radio&amp;quot; id=&amp;quot;' + j.to_s + '&amp;quot; value=&amp;quot;' + j.to_s + '&amp;quot; name=&amp;quot;Radio_' + self.id.to_s + '&amp;quot;'&lt;br /&gt;
      html += 'checked=&amp;quot;checked&amp;quot;' if (!answer.nil? and answer.answer == j) or (answer.nil? and questionnaire_min == j)&lt;br /&gt;
      html += '&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  (questionnaire_min..questionnaire_max).each do |j|&lt;br /&gt;
      html += '&amp;lt;td width=&amp;quot;10%&amp;quot;&amp;gt;&amp;lt;input type=&amp;quot;radio&amp;quot; id=&amp;quot;' + j.to_s + '&amp;quot; value=&amp;quot;' + j.to_s + '&amp;quot; name=&amp;quot;Radio_' + self.id.to_s + '&amp;quot;'&lt;br /&gt;
      html += 'checked=&amp;quot;checked&amp;quot;' if (!answer.nil? and answer.answer == j) or (answer.nil? and questionnaire_min == j)&lt;br /&gt;
      html += '&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
   end&lt;br /&gt;
2. Short the long line &lt;br /&gt;
&lt;br /&gt;
3. Use safe_join to be more security&lt;br /&gt;
&lt;br /&gt;
Previous &lt;br /&gt;
  html.html_safe&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  safe_join([&amp;quot;&amp;quot;.html_safe, &amp;quot;&amp;quot;.html_safe], html.html_safe&lt;br /&gt;
&lt;br /&gt;
4. Delete the code similar with other file and put the duplicate into parent class.&lt;br /&gt;
&lt;br /&gt;
5. Modify some method that is too long&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
   def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;2&amp;quot; value=&amp;quot;' + self.weight.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][weight]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_weight&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt; max_label &amp;lt;input size=&amp;quot;10&amp;quot; value=&amp;quot;' + self.max_label.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][max_label]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_max_label&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;  min_label &amp;lt;input size=&amp;quot;12&amp;quot; value=&amp;quot;' +    self.min_label.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][min_label]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_min_label&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  def edit(count)&lt;br /&gt;
    html = edit_remove_button(count) + edit_seq(count)&lt;br /&gt;
    html += edit_question_type(count) + edit_weight(count)&lt;br /&gt;
    html += edit_max_label(count) + edit_min_label(count)&lt;br /&gt;
    safe_join([raw(&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;), raw(&amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;)], raw(html))&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===checkbox.rb===&lt;br /&gt;
1. Short the long line&lt;br /&gt;
&lt;br /&gt;
2. Modify some method that is too long&lt;br /&gt;
Previous&lt;br /&gt;
&lt;br /&gt;
   def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (UnscoredQuestion does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
&lt;br /&gt;
  def edit(count)&lt;br /&gt;
    html = edit_remove_button(count) + edit_seq(count) + edit_question(count)&lt;br /&gt;
    html += edit_type(count) + edit_weight(count)&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
3. Use safe_join to be more security&lt;br /&gt;
&lt;br /&gt;
Previous &lt;br /&gt;
  html.html_safe&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  safe_join([&amp;quot;&amp;quot;.html_safe, &amp;quot;&amp;quot;.html_safe], html.html_safe&lt;br /&gt;
&lt;br /&gt;
===criterion.rb===&lt;br /&gt;
1.  Improve security by using safe_join&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
  html.html_safe&lt;br /&gt;
Changed&lt;br /&gt;
  safe_join([&amp;quot;&amp;quot;.html_safe, &amp;quot;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
&lt;br /&gt;
2. Modify some method that is too long&lt;br /&gt;
&lt;br /&gt;
3. Use new style validations&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
  validates_presence_of :size&lt;br /&gt;
Changed&lt;br /&gt;
  validates :size, presence: true&lt;br /&gt;
&lt;br /&gt;
4. Use each loop instead of for loop&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
  for j in questionnaire_min..questionnaire_max&lt;br /&gt;
Changed&lt;br /&gt;
  (questionnaire_min..questionnaire_max).each do |j|&lt;br /&gt;
&lt;br /&gt;
===dropdown.rb===&lt;br /&gt;
1. Use new style validations&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
  validates_presence_of :alternatives&lt;br /&gt;
Changed&lt;br /&gt;
  validates :alternatives, presence: true&lt;br /&gt;
&lt;br /&gt;
2. Modify some method that is too long&lt;br /&gt;
&lt;br /&gt;
3.  Improve security by using safe_join&lt;br /&gt;
&lt;br /&gt;
Previous &lt;br /&gt;
  html.html_safe&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  safe_join([&amp;quot;&amp;quot;.html_safe, &amp;quot;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
&lt;br /&gt;
===text_area.rb===&lt;br /&gt;
1. Replace condition statements in one line&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
  if self.size.nil?&lt;br /&gt;
    cols = '70'&lt;br /&gt;
    ows = '1'&lt;br /&gt;
  elsif&lt;br /&gt;
    cols = self.size.split(',')[0]&lt;br /&gt;
    rows = self.size.split(',')[1]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  def complete_get_cols_rows&lt;br /&gt;
    return '70', '1' if self.size.nil?&lt;br /&gt;
    [self.size.split(',')[0], self.size.split(',')[1]]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
2. Improve security by using safe_join&lt;br /&gt;
&lt;br /&gt;
Previous &lt;br /&gt;
  html.html_safe&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  safe_join([&amp;quot;&amp;quot;.html_safe, &amp;quot;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
&lt;br /&gt;
==Test from UI==&lt;br /&gt;
* Login in as an instructor or admin using credentials (admin with password: admin or instructor6 with password: password)&lt;br /&gt;
&lt;br /&gt;
*Click the Manage in the top bar,then click the Questionnaires which is down left of the the text:Manage content&lt;br /&gt;
&lt;br /&gt;
*Add the Name and click create&lt;br /&gt;
&lt;br /&gt;
*Click the any button you want&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=104573</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=104573"/>
		<updated>2016-11-05T00:50:52Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: /* Code Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite part of the codes in the Criterion.rb, Scale.rb, Checkbox.rb, Dropdown.rb, Text_response.rb, Text_area.rb, Text_field.rb. This is because some of codes have bad writing sytle, or not followingg OO language rules, which confuse others to understand these code. The detail of the requirements are list below: &lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop&lt;br /&gt;
&lt;br /&gt;
All of these requirements are based on a analysis software called [https://codeclimate.com code climate]&lt;br /&gt;
&lt;br /&gt;
==Result==&lt;br /&gt;
&lt;br /&gt;
[[File:Lzhang45_1.png]]&lt;br /&gt;
[[File:Lzhang45_2.png]]&lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
===text_field.rb===&lt;br /&gt;
Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
&lt;br /&gt;
1. Short the long line&lt;br /&gt;
&lt;br /&gt;
2. Improve security by using safe_join&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
 html.html_safe&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
 safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
3. Short long method&lt;br /&gt;
&lt;br /&gt;
Previous &lt;br /&gt;
 html += '&amp;lt;label for=&amp;quot;responses_' + count.to_s + '&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/label&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;input id=&amp;quot;responses_' + count.to_s + '_score&amp;quot; name=&amp;quot;responses[' + count.to_s + '][score]&amp;quot; type=&amp;quot;hidden&amp;quot; value=&amp;quot;&amp;quot;&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;input id=&amp;quot;responses_' + count.to_s + '_comments&amp;quot; label=' + self.txt + ' name=&amp;quot;responses[' + count.to_s + '][comment]&amp;quot; size=' + self.size.to_s + ' type=&amp;quot;text&amp;quot;'&lt;br /&gt;
    html += 'value=&amp;quot;' + answer.comments unless answer.nil?&lt;br /&gt;
    html += '&amp;quot;&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/li&amp;gt;&amp;lt;BR/&amp;gt;&amp;lt;BR/&amp;gt;' if self.type == 'TextField' and self.break_before == false&lt;br /&gt;
 def complete(count, answer = nil)&lt;br /&gt;
    html = if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
    html += combine(count, answer)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
 def combline(count, answer = nil)&lt;br /&gt;
    html = complete_helper_response_scores(count) + complete_helper_response_comments(count)&lt;br /&gt;
    html += complete_helper_text(answer) + complete_helper_response_comments&lt;br /&gt;
    html += complete_helper_final_judge&lt;br /&gt;
    html&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===text_response.rb===&lt;br /&gt;
It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
&lt;br /&gt;
1. Use new style validations&lt;br /&gt;
Previous&lt;br /&gt;
 validates_presence_of :size&lt;br /&gt;
Changed&lt;br /&gt;
 validates :size, presence: true&lt;br /&gt;
&lt;br /&gt;
2. Short the long line&lt;br /&gt;
&lt;br /&gt;
3. Improve security by safe_join&lt;br /&gt;
&lt;br /&gt;
Preivious&lt;br /&gt;
 html.html_safe&lt;br /&gt;
Changed&lt;br /&gt;
 safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
&lt;br /&gt;
4. Short long method&lt;br /&gt;
&lt;br /&gt;
Preivious&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (TextResponse does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;text area size &amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.size.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][size]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_size&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
Changed&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_link + edit_question_lable&lt;br /&gt;
    html += edit_question_textarea + edit_question_textarea_size&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===scale.rb===&lt;br /&gt;
1. Use each loop instead of for loop&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
  for j in questionnaire_min..questionnaire_max&lt;br /&gt;
      html += '&amp;lt;td width=&amp;quot;10%&amp;quot;&amp;gt;&amp;lt;input type=&amp;quot;radio&amp;quot; id=&amp;quot;' + j.to_s + '&amp;quot; value=&amp;quot;' + j.to_s + '&amp;quot; name=&amp;quot;Radio_' + self.id.to_s + '&amp;quot;'&lt;br /&gt;
      html += 'checked=&amp;quot;checked&amp;quot;' if (!answer.nil? and answer.answer == j) or (answer.nil? and questionnaire_min == j)&lt;br /&gt;
      html += '&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  (questionnaire_min..questionnaire_max).each do |j|&lt;br /&gt;
      html += '&amp;lt;td width=&amp;quot;10%&amp;quot;&amp;gt;&amp;lt;input type=&amp;quot;radio&amp;quot; id=&amp;quot;' + j.to_s + '&amp;quot; value=&amp;quot;' + j.to_s + '&amp;quot; name=&amp;quot;Radio_' + self.id.to_s + '&amp;quot;'&lt;br /&gt;
      html += 'checked=&amp;quot;checked&amp;quot;' if (!answer.nil? and answer.answer == j) or (answer.nil? and questionnaire_min == j)&lt;br /&gt;
      html += '&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
   end&lt;br /&gt;
2. Short the long line &lt;br /&gt;
&lt;br /&gt;
3. Use safe_join to be more security&lt;br /&gt;
&lt;br /&gt;
Previous &lt;br /&gt;
  html.html_safe&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  safe_join([&amp;quot;&amp;quot;.html_safe, &amp;quot;&amp;quot;.html_safe], html.html_safe&lt;br /&gt;
&lt;br /&gt;
4. Delete the code similar with other file and put the duplicate into parent class.&lt;br /&gt;
&lt;br /&gt;
5. Modify some method that is too long&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
   def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;2&amp;quot; value=&amp;quot;' + self.weight.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][weight]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_weight&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt; max_label &amp;lt;input size=&amp;quot;10&amp;quot; value=&amp;quot;' + self.max_label.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][max_label]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_max_label&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;  min_label &amp;lt;input size=&amp;quot;12&amp;quot; value=&amp;quot;' +    self.min_label.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][min_label]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_min_label&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  def edit(count)&lt;br /&gt;
    html = edit_remove_button(count) + edit_seq(count)&lt;br /&gt;
    html += edit_question_type(count) + edit_weight(count)&lt;br /&gt;
    html += edit_max_label(count) + edit_min_label(count)&lt;br /&gt;
    safe_join([raw(&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;), raw(&amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;)], raw(html))&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===checkbox.rb===&lt;br /&gt;
1. Short the long line&lt;br /&gt;
&lt;br /&gt;
2. Modify some method that is too long&lt;br /&gt;
Previous&lt;br /&gt;
&lt;br /&gt;
   def edit(_count)&lt;br /&gt;
    html = '&amp;lt;tr&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; data-method=&amp;quot;delete&amp;quot; href=&amp;quot;/questions/' + self.id.to_s + '&amp;quot;&amp;gt;Remove&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;6&amp;quot; value=&amp;quot;' + self.seq.to_s + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][seq]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_seq&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;textarea cols=&amp;quot;50&amp;quot; rows=&amp;quot;1&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][txt]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_txt&amp;quot; placeholder=&amp;quot;Edit question content here&amp;quot;&amp;gt;' + self.txt + '&amp;lt;/textarea&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;input size=&amp;quot;10&amp;quot; disabled=&amp;quot;disabled&amp;quot; value=&amp;quot;' + self.type + '&amp;quot; name=&amp;quot;question[' + self.id.to_s + '][type]&amp;quot; id=&amp;quot;question_' + self.id.to_s + '_type&amp;quot; type=&amp;quot;text&amp;quot;&amp;gt;''&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;td&amp;gt;&amp;lt;!--placeholder (UnscoredQuestion does not need weight)--&amp;gt;&amp;lt;/td&amp;gt;'&lt;br /&gt;
    html += '&amp;lt;/tr&amp;gt;'&lt;br /&gt;
    html.html_safe&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
&lt;br /&gt;
  def edit(count)&lt;br /&gt;
    html = edit_remove_button(count) + edit_seq(count) + edit_question(count)&lt;br /&gt;
    html += edit_type(count) + edit_weight(count)&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
3. Use safe_join to be more security&lt;br /&gt;
&lt;br /&gt;
Previous &lt;br /&gt;
  html.html_safe&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  safe_join([&amp;quot;&amp;quot;.html_safe, &amp;quot;&amp;quot;.html_safe], html.html_safe&lt;br /&gt;
&lt;br /&gt;
===criterion.rb===&lt;br /&gt;
1.  Improve security by using safe_join&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
  html.html_safe&lt;br /&gt;
Changed&lt;br /&gt;
  safe_join([&amp;quot;&amp;quot;.html_safe, &amp;quot;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
&lt;br /&gt;
2. Modify some method that is too long&lt;br /&gt;
&lt;br /&gt;
3. Use new style validations&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
  validates_presence_of :size&lt;br /&gt;
Changed&lt;br /&gt;
  validates :size, presence: true&lt;br /&gt;
&lt;br /&gt;
4. Use each loop instead of for loop&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
  for j in questionnaire_min..questionnaire_max&lt;br /&gt;
Changed&lt;br /&gt;
  (questionnaire_min..questionnaire_max).each do |j|&lt;br /&gt;
&lt;br /&gt;
===dropdown.rb===&lt;br /&gt;
1. Use new style validations&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
  validates_presence_of :alternatives&lt;br /&gt;
Changed&lt;br /&gt;
  validates :alternatives, presence: true&lt;br /&gt;
&lt;br /&gt;
2. Modify some method that is too long&lt;br /&gt;
&lt;br /&gt;
3.  Improve security by using safe_join&lt;br /&gt;
&lt;br /&gt;
Previous &lt;br /&gt;
  html.html_safe&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  safe_join([&amp;quot;&amp;quot;.html_safe, &amp;quot;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
&lt;br /&gt;
===text_area.rb===&lt;br /&gt;
1. Replace condition statements in one line&lt;br /&gt;
&lt;br /&gt;
Previous&lt;br /&gt;
  if self.size.nil?&lt;br /&gt;
    cols = '70'&lt;br /&gt;
    ows = '1'&lt;br /&gt;
  elsif&lt;br /&gt;
    cols = self.size.split(',')[0]&lt;br /&gt;
    rows = self.size.split(',')[1]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  def complete_get_cols_rows&lt;br /&gt;
    return '70', '1' if self.size.nil?&lt;br /&gt;
    [self.size.split(',')[0], self.size.split(',')[1]]&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
2. Improve security by using safe_join&lt;br /&gt;
&lt;br /&gt;
Previous &lt;br /&gt;
  html.html_safe&lt;br /&gt;
&lt;br /&gt;
Changed&lt;br /&gt;
  safe_join([&amp;quot;&amp;quot;.html_safe, &amp;quot;&amp;quot;.html_safe], html.html_safe)&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103717</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103717"/>
		<updated>2016-10-29T02:52:46Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: /* Code Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite part of the codes in the Criterion.rb, Scale.rb, Checkbox.rb, Dropdown.rb, Text_response.rb, Text_area.rb, Text_field.rb. This is because some of codes have bad writing sytle, or not followingg OO language rules, which confuse others to understand these code. The detail of the requirements are list below: &lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop&lt;br /&gt;
&lt;br /&gt;
All of these requirements are based on a analysis software called [https://codeclimate.com code climate]&lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
===text_field.rb===&lt;br /&gt;
Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
 def view_completed_question(count, answer)&lt;br /&gt;
    if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
      html = view_helper_true(count, answer)&lt;br /&gt;
      html += if Question.exists?(answer.question_id + 1) &amp;amp;&amp;amp; Question.find(answer.question_id + 1).break_before == true&lt;br /&gt;
    else&lt;br /&gt;
      html = view_helper_false(answer)&lt;br /&gt;
    end&lt;br /&gt;
    safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===text_response.rb===&lt;br /&gt;
It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_link + edit_question_lable&lt;br /&gt;
    html += edit_question_textarea + edit_question_textarea_size&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===scale.rb===&lt;br /&gt;
1. Use each loop instead of for loop&lt;br /&gt;
&lt;br /&gt;
2. Short the long line &lt;br /&gt;
&lt;br /&gt;
3. Use safe_join to be more security&lt;br /&gt;
&lt;br /&gt;
4. Delete the code similar with other file and put the duplicate into parent class.&lt;br /&gt;
&lt;br /&gt;
5. Modify some method that is too long&lt;br /&gt;
&lt;br /&gt;
===checkbox.rb===&lt;br /&gt;
1. Short the long line&lt;br /&gt;
&lt;br /&gt;
2. Modify some method that is too long&lt;br /&gt;
&lt;br /&gt;
3. Use safe_join to be more security&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103716</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103716"/>
		<updated>2016-10-29T02:52:14Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: /* Code Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite part of the codes in the Criterion.rb, Scale.rb, Checkbox.rb, Dropdown.rb, Text_response.rb, Text_area.rb, Text_field.rb. This is because some of codes have bad writing sytle, or not followingg OO language rules, which confuse others to understand these code. The detail of the requirements are list below: &lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop&lt;br /&gt;
&lt;br /&gt;
All of these requirements are based on a analysis software called [https://codeclimate.com code climate]&lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
===text_field.rb===&lt;br /&gt;
Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
 def view_completed_question(count, answer)&lt;br /&gt;
    if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
      html = view_helper_true(count, answer)&lt;br /&gt;
      html += if Question.exists?(answer.question_id + 1) &amp;amp;&amp;amp; Question.find(answer.question_id + 1).break_before == true&lt;br /&gt;
    else&lt;br /&gt;
      html = view_helper_false(answer)&lt;br /&gt;
    end&lt;br /&gt;
    safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===text_response.rb===&lt;br /&gt;
It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_link + edit_question_lable&lt;br /&gt;
    html += edit_question_textarea + edit_question_textarea_size&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===scale.rb===&lt;br /&gt;
1. Use each loop instead of for loop&lt;br /&gt;
2. Short the long line &lt;br /&gt;
3. Use safe_join to be more security&lt;br /&gt;
4. Delete the code similar with other file and put the duplicate into parent class.&lt;br /&gt;
5. Modify some method that is too long&lt;br /&gt;
&lt;br /&gt;
===checkbox.rb===&lt;br /&gt;
1. Short the long line&lt;br /&gt;
2. Modify some method that is too long&lt;br /&gt;
3. Use safe_join to be more security&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103690</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103690"/>
		<updated>2016-10-29T02:34:45Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: /* Reason for Refractor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite part of the codes in the Criterion.rb, Scale.rb, Checkbox.rb, Dropdown.rb, Text_response.rb, Text_area.rb, Text_field.rb. This is because some of codes have bad writing sytle, or not followingg OO language rules, which confuse others to understand these code. The detail of the requirements are list below: &lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop&lt;br /&gt;
&lt;br /&gt;
All of these requirements are based on a analysis software called [https://codeclimate.com code climate]&lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
===text_field.rb===&lt;br /&gt;
: Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
 def view_completed_question(count, answer)&lt;br /&gt;
    if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
      html = view_helper_true(count, answer)&lt;br /&gt;
      html += if Question.exists?(answer.question_id + 1) &amp;amp;&amp;amp; Question.find(answer.question_id + 1).break_before == true&lt;br /&gt;
    else&lt;br /&gt;
      html = view_helper_false(answer)&lt;br /&gt;
    end&lt;br /&gt;
    safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===text_response.rb===&lt;br /&gt;
: It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_link + edit_question_lable&lt;br /&gt;
    html += edit_question_textarea + edit_question_textarea_size&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103686</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103686"/>
		<updated>2016-10-29T02:33:21Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: /* Reason for Refractor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite part of the codes in the Criterion.rb, Scale.rb, Checkbox.rb, Dropdown.rb, Text_response.rb, Text_area.rb, Text_field.rb. This is because some of codes have bad writing sytle, or not followingg OO language rules, which confuse others to understand these code. The detail of the requirements are list below: &lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop&lt;br /&gt;
&lt;br /&gt;
All of these requirements are based on a analysis software called (code climate)[http://https://codeclimate.com code climate]&lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
===text_field.rb===&lt;br /&gt;
: Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
 def view_completed_question(count, answer)&lt;br /&gt;
    if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
      html = view_helper_true(count, answer)&lt;br /&gt;
      html += if Question.exists?(answer.question_id + 1) &amp;amp;&amp;amp; Question.find(answer.question_id + 1).break_before == true&lt;br /&gt;
    else&lt;br /&gt;
      html = view_helper_false(answer)&lt;br /&gt;
    end&lt;br /&gt;
    safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===text_response.rb===&lt;br /&gt;
: It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_link + edit_question_lable&lt;br /&gt;
    html += edit_question_textarea + edit_question_textarea_size&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103684</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103684"/>
		<updated>2016-10-29T02:32:07Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: /* Reason for Refractor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite part of the codes in the Criterion.rb, Scale.rb, Checkbox.rb, Dropdown.rb, Text_response.rb, Text_area.rb, Text_field.rb. This is because some of codes have bad writing sytle, or not followingg OO language rules, which confuse others to understand these code. The detail of the requirements are list below: &lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop&lt;br /&gt;
&lt;br /&gt;
All of these requirements are based on a analysis software called [code climate]&lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
===text_field.rb===&lt;br /&gt;
: Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
 def view_completed_question(count, answer)&lt;br /&gt;
    if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
      html = view_helper_true(count, answer)&lt;br /&gt;
      html += if Question.exists?(answer.question_id + 1) &amp;amp;&amp;amp; Question.find(answer.question_id + 1).break_before == true&lt;br /&gt;
    else&lt;br /&gt;
      html = view_helper_false(answer)&lt;br /&gt;
    end&lt;br /&gt;
    safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===text_response.rb===&lt;br /&gt;
: It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_link + edit_question_lable&lt;br /&gt;
    html += edit_question_textarea + edit_question_textarea_size&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103661</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103661"/>
		<updated>2016-10-29T02:20:10Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: /* Reason for Refractor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite part of the codes in the Criterion.rb, Scale.rb, Checkbox.rb, Dropdown.rb, Text_response.rb, Text_area.rb, Text_field.rb. This is because some of codes have bad writing sytle, or not followingg OO language rules, which confuse others to understand these code. The detail of the requirements are list below: &lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop&lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
===text_field.rb===&lt;br /&gt;
: Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
 def view_completed_question(count, answer)&lt;br /&gt;
    if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
      html = view_helper_true(count, answer)&lt;br /&gt;
      html += if Question.exists?(answer.question_id + 1) &amp;amp;&amp;amp; Question.find(answer.question_id + 1).break_before == true&lt;br /&gt;
    else&lt;br /&gt;
      html = view_helper_false(answer)&lt;br /&gt;
    end&lt;br /&gt;
    safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===text_response.rb===&lt;br /&gt;
: It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_link + edit_question_lable&lt;br /&gt;
    html += edit_question_textarea + edit_question_textarea_size&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103655</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103655"/>
		<updated>2016-10-29T02:17:07Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: /* Reason for Refractor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite the part of the codes in the Criterion.rb, Scale.rb, Checkbox.rb, Dropdown.rb, Text_response.rb, Text_area.rb, Text_field.rb, for some of codes have bad writing sytle, or not followingg OO language rules. The detail of the requirements are list below &lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop&lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
===text_field.rb===&lt;br /&gt;
: Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
 def view_completed_question(count, answer)&lt;br /&gt;
    if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
      html = view_helper_true(count, answer)&lt;br /&gt;
      html += if Question.exists?(answer.question_id + 1) &amp;amp;&amp;amp; Question.find(answer.question_id + 1).break_before == true&lt;br /&gt;
    else&lt;br /&gt;
      html = view_helper_false(answer)&lt;br /&gt;
    end&lt;br /&gt;
    safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===text_response.rb===&lt;br /&gt;
: It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_link + edit_question_lable&lt;br /&gt;
    html += edit_question_textarea + edit_question_textarea_size&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103121</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103121"/>
		<updated>2016-10-28T21:50:27Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: /* text_field.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite the code of seven file for several reason listed below.&lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop &lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
===text_field.rb===&lt;br /&gt;
: Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
 def view_completed_question(count, answer)&lt;br /&gt;
    if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
      html = '&amp;lt;b&amp;gt;' + count.to_s + &amp;quot;. &amp;quot; + self.txt + &amp;quot;&amp;lt;/b&amp;gt;&amp;quot;&lt;br /&gt;
      html += '&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;'&lt;br /&gt;
      html += answer.comments&lt;br /&gt;
      html += '&amp;lt;BR/&amp;gt;&amp;lt;BR/&amp;gt;' if Question.exists?(answer.question_id + 1) &amp;amp;&amp;amp; Question.find(answer.question_id + 1).break_before == true&lt;br /&gt;
    else&lt;br /&gt;
      html = view_helper(answer)&lt;br /&gt;
    end&lt;br /&gt;
    safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
  end&lt;br /&gt;
 def view_helper(answer)&lt;br /&gt;
    html = self.text&lt;br /&gt;
    html += answer.comments&lt;br /&gt;
    html += '&amp;lt;BR/&amp;gt;&amp;lt;BR/&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===text_response.rb===&lt;br /&gt;
: It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_1 + edit_2 + edit_3 + edit_4&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103118</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103118"/>
		<updated>2016-10-28T21:49:56Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite the code of seven file for several reason listed below.&lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop &lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
===text_field.rb===&lt;br /&gt;
: Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
 def view_completed_question(count, answer)&lt;br /&gt;
    if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
      html = '&amp;lt;b&amp;gt;' + count.to_s + &amp;quot;. &amp;quot; + self.txt + &amp;quot;&amp;lt;/b&amp;gt;&amp;quot;&lt;br /&gt;
      html += '&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;'&lt;br /&gt;
      html += answer.comments&lt;br /&gt;
      html += '&amp;lt;BR/&amp;gt;&amp;lt;BR/&amp;gt;' if Question.exists?(answer.question_id + 1) &amp;amp;&amp;amp; Question.find(answer.question_id + 1).break_before == true&lt;br /&gt;
    else&lt;br /&gt;
      html = view_helper(answer)&lt;br /&gt;
    end&lt;br /&gt;
    safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
  end&lt;br /&gt;
 def view_helper(answer)&lt;br /&gt;
    html = self.text&lt;br /&gt;
    html += answer.comments&lt;br /&gt;
    html += '&amp;lt;BR/&amp;gt;&amp;lt;BR/&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
; text_response.rb&lt;br /&gt;
: It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_1 + edit_2 + edit_3 + edit_4&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103109</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103109"/>
		<updated>2016-10-28T21:48:41Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: /* Code Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite the code of seven file for several reason listed below.&lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop &lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
; ===text_field.rb===&lt;br /&gt;
: Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
 def view_completed_question(count, answer)&lt;br /&gt;
    if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
      html = '&amp;lt;b&amp;gt;' + count.to_s + &amp;quot;. &amp;quot; + self.txt + &amp;quot;&amp;lt;/b&amp;gt;&amp;quot;&lt;br /&gt;
      html += '&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;'&lt;br /&gt;
      html += answer.comments&lt;br /&gt;
      html += '&amp;lt;BR/&amp;gt;&amp;lt;BR/&amp;gt;' if Question.exists?(answer.question_id + 1) &amp;amp;&amp;amp; Question.find(answer.question_id + 1).break_before == true&lt;br /&gt;
    else&lt;br /&gt;
      html = view_helper(answer)&lt;br /&gt;
    end&lt;br /&gt;
    safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
  end&lt;br /&gt;
 def view_helper(answer)&lt;br /&gt;
    html = self.text&lt;br /&gt;
    html += answer.comments&lt;br /&gt;
    html += '&amp;lt;BR/&amp;gt;&amp;lt;BR/&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
; text_response.rb&lt;br /&gt;
: It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_1 + edit_2 + edit_3 + edit_4&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103100</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103100"/>
		<updated>2016-10-28T21:46:27Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite the code of seven file for several reason listed below.&lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop &lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
; text_field.rb&lt;br /&gt;
: Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
 def view_completed_question(count, answer)&lt;br /&gt;
    if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
      html = '&amp;lt;b&amp;gt;' + count.to_s + &amp;quot;. &amp;quot; + self.txt + &amp;quot;&amp;lt;/b&amp;gt;&amp;quot;&lt;br /&gt;
      html += '&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;'&lt;br /&gt;
      html += answer.comments&lt;br /&gt;
      html += '&amp;lt;BR/&amp;gt;&amp;lt;BR/&amp;gt;' if Question.exists?(answer.question_id + 1) &amp;amp;&amp;amp; Question.find(answer.question_id + 1).break_before == true&lt;br /&gt;
    else&lt;br /&gt;
      html = view_helper(answer)&lt;br /&gt;
    end&lt;br /&gt;
    safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
  end&lt;br /&gt;
 def view_helper(answer)&lt;br /&gt;
    html = self.text&lt;br /&gt;
    html += answer.comments&lt;br /&gt;
    html += '&amp;lt;BR/&amp;gt;&amp;lt;BR/&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
; text_response.rb&lt;br /&gt;
: It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_1 + edit_2 + edit_3 + edit_4&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103092</id>
		<title>CSC/ECE 517 Fall 2016/E1673. Refactor question type.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1673._Refactor_question_type.rb&amp;diff=103092"/>
		<updated>2016-10-28T21:45:28Z</updated>

		<summary type="html">&lt;p&gt;Nzlu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1673. Refactor question type.rb'''&lt;br /&gt;
==Background==&lt;br /&gt;
Expertiza is an open source software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages. It has following features:&lt;br /&gt;
&lt;br /&gt;
*Enables students working together in a class and a topic&lt;br /&gt;
*Enables studnets to do peer review and improve both him/her and others' learn experience&lt;br /&gt;
&lt;br /&gt;
== Reason for Refractor==&lt;br /&gt;
The purpose of this work is to rewrite the code of seven file for several reason listed below.&lt;br /&gt;
&lt;br /&gt;
*Line is too long&lt;br /&gt;
*Some code found in other location and should put them in the parent class&lt;br /&gt;
*Method has too many lines&lt;br /&gt;
*Some of the code will cause security risk&lt;br /&gt;
*Using the old style validations&lt;br /&gt;
*Using a lower efficent way to do the loop &lt;br /&gt;
&lt;br /&gt;
== Code Changes ==&lt;br /&gt;
; text_field.rb&lt;br /&gt;
: Although it increase the number of classes, the length of function decrease and it's easy to read than before&lt;br /&gt;
 def view_completed_question(count, answer)&lt;br /&gt;
    if self.type == 'TextField' and self.break_before == true&lt;br /&gt;
      html = '&amp;lt;b&amp;gt;' + count.to_s + &amp;quot;. &amp;quot; + self.txt + &amp;quot;&amp;lt;/b&amp;gt;&amp;quot;&lt;br /&gt;
      html += '&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;'&lt;br /&gt;
      html += answer.comments&lt;br /&gt;
      html += '&amp;lt;BR/&amp;gt;&amp;lt;BR/&amp;gt;' if Question.exists?(answer.question_id + 1) &amp;amp;&amp;amp; Question.find(answer.question_id + 1).break_before == true&lt;br /&gt;
    else&lt;br /&gt;
      html = view_helper(answer)&lt;br /&gt;
    end&lt;br /&gt;
    safe_join([&amp;quot; &amp;quot;.html_safe, &amp;quot; &amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
  end&lt;br /&gt;
 def view_helper(answer)&lt;br /&gt;
    html = self.text&lt;br /&gt;
    html += answer.comments&lt;br /&gt;
    html += '&amp;lt;BR/&amp;gt;&amp;lt;BR/&amp;gt;'&lt;br /&gt;
    html&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
; text_response.rb&lt;br /&gt;
: It makes codes more readable. We also choose safe_join instead of html_safe to prevent security risks. However, we must use html_safe to keep the character encoding.&lt;br /&gt;
 def edit(_count)&lt;br /&gt;
    html = edit_1 + edit_2 + edit_3 + edit_4&lt;br /&gt;
    safe_join([&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;.html_safe, &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;.html_safe], html.html_safe)&lt;br /&gt;
 end&lt;/div&gt;</summary>
		<author><name>Nzlu</name></author>
	</entry>
</feed>