Main Page

From Expertiza_Wiki
Jump to navigation Jump to search

E1746. [Test First Development] Refactor user.rb

Expertiza

Expertiza is an open source project based on Ruby on Rails framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.


problem Statement

The following tasks were accomplished in this project:

  • 1.Complete the pending tests in user_spec.rb
  • 2.Refactor get_user_list method.Move if conditions to corresponding subclasses (eg. ta.rb, instructor.rb) with same method name,replace the conditional with the relevant method calls.
  • 3.Refactor self.search_users method,Extract duplicated code to a new method.
  • 4.Rename following method and change all other places it is used.
 is_recursively_parent_of → recursively_parent_of?
 is_creator_of? →  creator_of?
 is_teaching_assistant_for? →  teaching_assistant_for?
 is_teaching_assistant? →  teaching_assistant?
  • 5.Use find_by instead of dynamic method.

Drawbacks and solutions

  • 1.finish the pending test.
  • There are many pending tests needed to be completed.The file is the following and all the pending tests has passed.
https://github.com/AnranZhou/expertiza/blob/master/spec/models/user_spec.rb

new implementation

  • sends email when particpant is added in assignment.
  • sends email when suggestion is given by student.


code improvement

  • 1
  • 2


Application Behavior

Metaprogramming