CSC/ECE 517 Fall 2015/oss E1565 AAJ: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 55: Line 55:
|}
|}


=== Modified the methods <code>add_administrator</code> and <code>create_administrator</code> ===
=== Institution Controller ===
{| class="wikitable"
{| class="wikitable"
|-
|-
! |Before Refactoring
! style="width:13%;"|Method Name
! |After Refactoring
! style="width:33%;"|Changes Made
! style="width:43%;"|Reason For Change
|- style="vertical-align:top;"
|- style="vertical-align:top;"
|<pre>
| create
  def add_administrator
| Changed line<pre> @institution = Institution.new(params[:institution])</pre> to <pre>@institution = Institution.new(:name => params[:institution][:name])</pre>
    @user = User.new
| Was throwing error
  end
  def create_administrator
    save_administrator
  end
</pre>
|<pre>
  def add_administrator
    @user = User.new
    redirect_to 'users#new'
  end
  def create_administrator
    save_administrator
    redirect_to "users#new"
  end
</pre>
|}
|}

Revision as of 01:00, 1 November 2015

E1565: Refactoring Admin Controller and Course Controller

This page provides a description of the Expertiza based OSS project aimed at refactoring Admin Controller and Course Controller.

In order to run our code visit the link 152.46.16.123:3000 and use the following credentials - username: admin, password: admin.

Introduction to Expertiza

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.


Problem Statement

Files involved

admin_controller.rb
views in app/views/admin folder
user_controller

What they do:

The admin controller defines the changes that can be done on other types of users by super-admin and provides the view accordingly.

What needs to be done:

  • The text field for adding a new admin/instructor has to be removed, leaving only the button.
  • When the button is clicked, it should be redirected to new user creation view making the role (super-admin, admin or instructor) selected as default.
  • Make sure that user creation works for super-admin/admin/instructor.
  • Associate the users with the institution table
  • Add a drop down to the view of creating users so that new account creator can select the institute and save it.

Changes Made

Admin Controller

Method Name Changes Made Reason For Change
show_super_admin Added this method to controller This method helps in displaying the specified super_admin
show_admin Added this method to Admin Controller This method helps in displaying the specified admin
remove_instructor Added this method to Admin Controller This method helps in destroying an instructor.
remove_administrator Added this method to Admin Controller This method helps in destroying an administrator.
remove_super_administrator Added this method to Admin Controller. This method helps in destroying a super_admin.

Institution Controller

Method Name Changes Made Reason For Change
create Changed line
 @institution = Institution.new(params[:institution])
to
@institution = Institution.new(:name => params[:institution][:name])
Was throwing error