CSC/ECE 517 Fall 2019 - E1971. OSS project Finklestein: Instructors & Institutions: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 50: Line 50:


  '''Changed files:''' <font color="blue">app/views/users/new.html.erb</font>
  '''Changed files:''' <font color="blue">app/views/users/new.html.erb</font>
  <ρ style="color: red; font-weight: bold">* Please Make Sure All Information is Correct</ρ>
  <font color="red"><ρ style="color: red; font-weight: bold">* Please Make Sure All Information is Correct</ρ></font>
  <%= submit_tag "Create" %>
  <%= submit_tag "Create" %>



Revision as of 01:56, 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.

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

<%= 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

# if the user name already exists, register the user by email address
check = User.find_by(name: params[:user][:name])
params[:user][:name] = params[:user][:email] unless check.nil?
if params[:user][:institution_id].empty?
  institution = Institution.find_or_create_by(name: params[:institution][:name])
  params[:user][:institution_id] = institution.id
end
@user = User.new(user_params)
@user.institution_id = params[:user][:institution_id]
Changed files: app/views/users/new.html.erb
<ρ style="color: red; font-weight: bold">* Please Make Sure All Information is Correct</ρ>
<%= 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

def institution(ip_address = nil)
  if User.anonymized_view?(ip_address)
    self.role.name + ', ' + self.id.to_s
  else
    if self[:role_id] == 2
      self[:institution_id].nil? ? "" : Institution.find(self[:institution_id]).name
    end
  end
end
Changed files: app/views/users/list.html.erb
 

Name Full Name Institution Email Address Role Parent Review Submission Metareview <% for user in @users %> <% if ((params[:show] != 'true' && !user.name(session[:ip]).include?("_hidden")) || params[:show] == 'true')%> <%= link_to user.name(session[:ip]), impersonate_impersonate_path(:user => {:name => user.name(session[:ip])}), :method => :post %> <%= link_to user.fullname(session[:ip]), :controller=> 'users', :action => 'show', :id => user.id %> <%= user.institution(session[:ip]) %> <%= user.email(session[:ip]) %> <%= link_to user.role.name, :controller => 'roles', :action => 'show', :id => user.role.id %> <%= user.parent.try :name %> <%= User.yesorno(user.email_on_review) %> <%= User.yesorno(user.email_on_submission) %> <%= User.yesorno(user.email_on_review_of_review) %> <% end %> <% end -%>

Test

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 on GitHub

Expertiza website

Expertiza project documentation wiki

GitHub Project Repository Fork

Rspec Documentation