CSC/ECE 517 Fall 2019 - E1971. OSS project Finklestein: Instructors & Institutions: Difference between revisions
(→Test) |
|||
Line 107: | Line 107: | ||
===Test=== | ===Test=== | ||
=====Test for Task1===== | =====Test for Task1===== | ||
<font color="green">''''' 8''''' it "check if the courses are sorted alphabetically" do | |||
''''' 9''''' driver = Selenium::WebDriver.for :firefox | |||
'''''10''''' driver.get("http://localhost:3000/") | |||
'''''11''''' driver.find_element(:id, "login_name").send_keys("super_administrator2") | |||
'''''12''''' driver.find_element(:id, "login_password").send_keys("password") | |||
'''''13''''' driver.find_element(:name, "commit").click() | |||
'''''14''''' driver.get("http://localhost:3000/course/new?private=1") | |||
'''''15''''' institutions_eles = driver.find_element(:id, "course_institutions_id") | |||
'''''16''''' options = institutions_eles.find_elements(:tag_name, 'option') | |||
'''''17''''' result = true | |||
'''''18''''' for x in 0..options.size-2 | |||
'''''19''''' if (options[x].text.downcase <=> options[x+1].text.downcase) > 0 | |||
'''''20''''' result = false | |||
'''''21''''' break | |||
'''''22''''' end | |||
'''''23''''' end | |||
'''''24''''' expect(result).to be(true) | |||
'''''25''''' end</font> | |||
=====Test for Task2===== | |||
<font color="green">''''' 8''''' it "check if the courses are sorted alphabetically" do | <font color="green">''''' 8''''' it "check if the courses are sorted alphabetically" do | ||
''''' 9''''' driver = Selenium::WebDriver.for :firefox | ''''' 9''''' driver = Selenium::WebDriver.for :firefox |
Revision as of 03:08, 28 October 2019
E1971. OSS project Finklestein: Instructors & Institutions
Expertiza is an open-source project based on Ruby on Rails framework. Expertiza allows instructors to manager courses and assignments for students. Students can form up teams in Expertiza to work on different projects and assignments and do peer review about other students' submissions.
Introduction
- E1971 Project aims to fix the associations problems between the Institution and Instructor class.
- The forked git repository for this project can be found Expertiza-E1971
Problem Statement
The following tasks were accomplished in E1971 project:
- Task1: The institution list should be sorted alphabetically.
- Details: When creating a course, the drop-down list for selecting the institution does not show in alphabetical order.
- Task2: Adding a new institution during creation of an instructor profile.
- Details: The admin can attempt to create a new institution when creating a new instructor. But, after one types in the name of the institution & clicks create, it crashes.
- Task3: Listing of instructors should show their institutions on the same line as their new feature.
- Details: When listing users, there is currently no column to display the user’s associated institution.
Task1
As the issue is the Institution drop-down list is not alphabetically sorted. We simply added a step of sort when the Institution list was retrieved from the Database.
Changed files: _course.html.erb line3 <%= select("course", "institutions_id", Institution.all.order(:name).collect{ |c| [ c.name, c.id] }) %>
Task2
The issue occurs when the admin trying to create a new instructor with a new institution name. To fix this problem, we added a function to create a new institution and a confirmation prompt to alert the admin.
Changed files: app/controllers/users_controller.rb 116 # if the user name already exists, register the user by email address 117 check = User.find_by(name: params[:user][:name]) 118 params[:user][:name] = params[:user][:email] unless check.nil? 119 if params[:user][:institution_id].empty? 120 institution = Institution.find_or_create_by(name: params[:institution][:name]) 121 params[:user][:institution_id] = institution.id 122 end 123 @user = User.new(user_params) 124 @user.institution_id = params[:user][:institution_id] ------------------------------------------------------------------------------------------------- 142 else 143 foreign144 render action: 'new'144 flash[:error] = "Create Instructor Error!" 145 redirect_to '/admin/list_instructors' 146 end
Changed files: app/views/users/new.html.erb 8 <ρ style="color: red; font-weight: bold">* Please Make Sure All Information is Correct</ρ> 9 <%= submit_tag "Create" %>
Task3
The issue is that the user page is not displaying the user's associated institution. To fix this issue, we added an 'institution' column in the HTML file retrieving the institution names of each user.
Changed files: app/models/user.rb 111 def institution(ip_address = nil) 112 if User.anonymized_view?(ip_address) 113 self.role.name + ', ' + self.id.to_s 114 else 115 if self[:role_id] == 2 116 self[:institution_id].nil? ? "" : Institution.find(self[:institution_id]).name 117 end 118 end 119 end
Changed files: app/views/users/list.html.erb
20 21 Name 22 Full Name 23 Institution 24 Email Address 25 Role 26 Parent 27 Review 28 Submission 29 Metareview 30 31 <% for user in @users %> 32 <% if ((params[:show] != 'true' && !user.name(session[:ip]).include?("_hidden")) || params[:show] == 'true')%> 33 34 <%= link_to user.name(session[:ip]), impersonate_impersonate_path(:user => {:name => user.name(session[:ip])}), :method => :post %> 35 <%= link_to user.fullname(session[:ip]), :controller=> 'users', :action => 'show', :id => user.id %> 36 <%= user.institution(session[:ip]) %> 37 <%= user.email(session[:ip]) %> 38 <%= link_to user.role.name, :controller => 'roles', :action => 'show', :id => user.role.id %> 39 <%= user.parent.try :name %> 40 <%= User.yesorno(user.email_on_review) %> 41 <%= User.yesorno(user.email_on_submission) %> 42 <%= User.yesorno(user.email_on_review_of_review) %> 43 44 <% end %> 45 <% end -%>
Test
=====Test for Task1===== 8 it "check if the courses are sorted alphabetically" do 9 driver = Selenium::WebDriver.for :firefox 10 driver.get("http://localhost:3000/") 11 driver.find_element(:id, "login_name").send_keys("super_administrator2") 12 driver.find_element(:id, "login_password").send_keys("password") 13 driver.find_element(:name, "commit").click() 14 driver.get("http://localhost:3000/course/new?private=1") 15 institutions_eles = driver.find_element(:id, "course_institutions_id") 16 options = institutions_eles.find_elements(:tag_name, 'option') 17 result = true 18 for x in 0..options.size-2 19 if (options[x].text.downcase <=> options[x+1].text.downcase) > 0 20 result = false 21 break 22 end 23 end 24 expect(result).to be(true) 25 end =====Test for Task2===== 8 it "check if the courses are sorted alphabetically" do 9 driver = Selenium::WebDriver.for :firefox 10 driver.get("http://localhost:3000/") 11 driver.find_element(:id, "login_name").send_keys("super_administrator2") 12 driver.find_element(:id, "login_password").send_keys("password") 13 driver.find_element(:name, "commit").click() 14 driver.get("http://localhost:3000/course/new?private=1") 15 institutions_eles = driver.find_element(:id, "course_institutions_id") 16 options = institutions_eles.find_elements(:tag_name, 'option') 17 result = true 18 for x in 0..options.size-2 19 if (options[x].text.downcase <=> options[x+1].text.downcase) > 0 20 result = false 21 break 22 end 23 end 24 expect(result).to be(true) 25 end
Process Video
Video Demonstration for Testing Task1: Task1-Video
Team Information
Team_4430: Ruiwen Wu (rwu5@ncsu.edu) Yongjian Zhu (yzhu48@ncsu.edu) Ling Li (lli46@ncsu.edu) Mentor: Carmen Bentley (cnaiken@ncsu.edu)
References
Expertiza project documentation wiki