CSC/ECE 517 Spring 2013/FINAL PROJECT E736 UNDO DELIVERABLE

From Expertiza_Wiki
Jump to navigation Jump to search

E736. Undo Functionality for Expertiza

Team Members

  • Chun Sing Tsui (ctsui@ncsu.edu)
  • Kenny Yarboro (kbyarbor@ncsu.edu)
  • Meng Cao (mcao2@ncsu.edu)
  • Travis Folsom (twfolsom@ncsu.edu)

Design Document

Overview of Undo Functionality

  • Undo allows the user to undo their most recent actions for any items that offer the undo functionality.
  • The undo of file submissions was not required; however, we did or did not do these....depends on if we complete it...
  • If an undo is attempted on an item already modified by another user, a message is displayed stating why undo cannot be performed. Otherwise, the user is able to undo any changes to an item with the undo functionality.
  • When multiple actions are performed in one step, the undo functionality groups all of the changes together for the purposes of restoring all items affected by the action previously performed.

List of Items to be Supported by Undo Functionality

  • Courses
    • Create
    • Delete
    • Edit
  • Import
    • Import Participants
    • Import Teams
    • Import Users
  • Teams
    • Create (Manual)
    • Create (Random)
    • Edit

Design Patterns and Designs

  • DRY
    • "Don't Repeat Yourself" practice was followed.
  • Memento
    • The memento pattern is a software design pattern that provides the ability to restore an object to its previous state (undo via rollback). The memento pattern is implemented with two objects: the originator and a caretaker. The originator is some object that has an internal state. The caretaker is going to do something to the originator, but wants to be able to undo the change. The caretaker first asks the originator for a memento object. Then it does whatever operation (or sequence of operations) it was going to do. To roll back to the state before the operations, it returns the memento object to the originator. The memento object itself is an opaque object (one which the caretaker cannot, or should not, change). When using this pattern, care should be taken if the originator may change other objects or resources - the memento pattern operates on a single object. Classic examples of the memento pattern include the seed of a pseudorandom number generator (it will always produce the same sequence thereafter when initialized with the seed state) and the state in a finite state machine.
    • The Memento pattern will be followed through PaperTrail, an open-source Ruby gem leveraged by the project.

Framework Leveraged & Enhanced

  • Paper Trail(https://github.com/airblade/paper_trail)
    • Paper Trail allows for tracking changes to model data.
      • Good for auditing or versioning.
    • Offers many functionalities including:
        • Viewing a model at any stage in its lifecycle.
        • Reverting a model to any version.
        • Undeleting items after they have been destroyed.
    • Compatible with Rails-2.3.15, which is the version Expertiza uses.
    • There is a Railscast showing how to implement the undo feature with Paper Trail.
    • Ranked as the most popular framework for Active Record versioning feature in here
  • Enhancement
    • Paper Trail only supported undo of the most recent action and did not restore associations.
    • Paper Trail customized to add support for restoring associations within the Expertiza system.
      • Description of modification...

Classes Modified

  • apps/
    • controllers/
      • course_controller.rb
      • import_file_controller.rb
      • participants_controller.rb
      • team_controller.rb
      • teams_users_controller.rb
    • models/
      • participant.rb
      • ta_mapping.rb
      • team_node.rb
      • teams_user.rb

Unit Tests

  • Modified Tests
    • test file
      • test method
  • New Tests
    • test file
      • test method

Functional Testing Plans

  • Modified Tests
    • test file
      • test method
  • New Tests
    • test file
      • test method