Skip to content

Conversation

@Yogasuganya
Copy link

@Yogasuganya Yogasuganya commented May 17, 2019

Thank you so much for this exercise. I had fun working on it and learned couple of things along the way. Please find below the pros/cons of the original app and my summary of changes.

Pros:

  1. The code was clean and simple and had appropriate comments which helps new developers to quickly understand and make modifications to it
  2. The application had parameter validations for user input fields
  3. The app ran without issues and satisfied the original workflow requirements

Cons:

  1. I assume that the code was not modular and everything was put in single file intentionally to test new hires. If not, this would be a con
  2. The items(Revenue/Expense) that were once added cannot be edited

My Changes:

  1. Refactored the code into reusable components
    ROI-Calculator - renders child components(AddItem, Revenue, Expense, Totals )
    AddItem.js - renders add expense or revenue form
    Revenue.js - renders revenue table
    Expense.js - renders expenses table
    EditForm.js - renders expense or revenue items edit modal
    Totals.js - renders total results table	
    
  2. Implemented a node.js server with express for backend to handle calculations and modified the react components to fetch calculation results from the backend
    server/app.js - endpoints to POST to fetch results
    server/restApi/ROI-ResultsCalculation.js - ROI results calculation function  
    
  3. Enhanced the state management of the app with Redux
    Action -  to send data from application to store
    Reducers - describes how the application state changes in response to actions sent to store
    Selectors - to get state value from the store
    Store - object that brings all the above together 
    
  4. Added edit functionality for items (revenue/expense) and dynamically fetched ROI total from backend for the newly updated values
  5. For the final ROI total, added dynamic option for the user to change time period in months (12, 24, …) and fetched the ROI for monthly changes from backend server
  6. Modified the UI style to distinguish item rows
  7. Added comments to my changes in code

Test Plan:

  1. Tested cross browser UI compatibility in browsers :
    Google chrome (version 74.0.3729.157), Safari (version 12.1), Mozilla Firefox (version 66.0.5).
  2. Ran the app in windows 7 and MacOs Mojave

Todo:

  1. More error handling at backend servers calls
  2. Add unit tests
  3. Add functionality to locally save the items and their ROI results in browser storage and navigate them
  4. Add graph comparison for different ROI calculations using the local browser storage

To get started:

// Fork and clone the repo

$ cd developer-exercise/
$ yarn                       // to install dependencies
$ yarn start                 // to start the frontend react server
$ yarn server                // to start the backend express node server 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant