Skip to content

herbert-rms/technical_test

Repository files navigation

Current RMS tech test

For this test we would like you to add some additional functionality to a basic rails app. The app is a simple rental management system. Currently it allows users to create customers, products and contracts. We would like the system to be extended to allow contract items to be added to a contract. Please make the changes that you think are required and then submit a pull request. Try to spend no longer than a few hours on this task.

A contract item should have a product and a charge. The charge should be calculated using the duration of the contract and the product's price and rate.

There are three different rates:

  • Daily: charge is the product price times the days it is to be hired for
  • Weekly: charge is the product price times the weeks it is to be hired for
  • Three Day: charge is the full product price times the number of days the product is to be hired for up to three days. Subsequent days are charges at a 20% discount

To get the app up and running all you need is to run the following commands(after cd'ing to the project):

  • docker build -t test_app .
  • docker compose run app rails db:migrate
  • docker compose run app rails db:seed
  • docker compose up - at which point the app should be running at http://localhost:3000/

Assessment

The work submitted will be graded against these criteria in an attempt to provide a transparent and objective framework for assessment:

  • Models, associations and routes set up (1pt)

  • Item addition and charge calculation

    • Contract item can be added with no charge (1pt)
    • Charge calculation implemented for some rates (2pt)
    • Charge calculation implemented for all rates with some errors (3pt)
    • Charge calculation fully implemented (4pt)
  • Testing

    • Some tests are included (1pt)
    • Comprehensive set of tests (2pt)
  • Miscellaneous

    • Pull request submitted with appropriate level of detail (1pt)
    • Code is well ordered including comments where appropriate (1pt)

Refactoring task/discussion

In the root of this repo is refactor_this_update.rb, as the name suggests file contains a update method that is quite complex. Please have a look at this file and generate some thoughts into a text format in the root of this repo as to what you might do to improve both the readability of the file, and what design patterns a refactor might use. The method it's self is quite messy and uses lots of proprietary names/classes/models so do not stress the minor details of it, try to mentally black box as much of it as you can and look at the code from the highest level of abstraction that you can. Try to spend no longer than 2 hours around this specific task, and do not feel the need to actually write code to refactor anything in the file unless it will aid your own understanding.

About

Klipboard Technical Test for Candidates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published