This task is to build the fake business model and predict revenue. Find detailed task description at the bottom of this document. If something is unclear or incorrect in the description below - change it the way you think it should be. If something is taking too much time for you - drop, don't waste your time, work on other tasks.
- Company - we are the company
- Client (meaning a set of clients) - the one who pay us money
- Job - Company does some job for a Client using one subcontractor
- Subcontractor (set of subscontractors) - Guys who actually do all the job behind the scenes. Client does not know anything about contractor. Only Company deals with Subcontractor (always 1 Subcontractor for every single Job)
- One of our clients requests a job
- Job can be accepted or rejected by our Company
- Company accepted
start_date
of this job set by Client - Company starts working on this job starting from requested
start_date
- Company estimates and sets
end_date
to this Job - Company sends invoice to the Client
- Invoice
due_amount
is equal torate_set_for_the_client$ * (end_date - start_date).days
- Invoice gets
pending
status - Client has to pay for this invoice on any date before
end_date
- Invoice hasn't been paid in time scenario:
- Invoice gets status
overdue
- On each day after
end_date
we addrate_set_for_the_client$
amount to the invoice - The Client can't request any new job
- Invoice gets status
- Invoice has been paid in time scenario:
- Invoice gets status
paid
- Client has an ability to add a new job
- Invoice gets status
- Invoice
- Company finds Subcontractor who is not too busy with other jobs: should have less than 3 jobs assigned
- The Subcontractor gets paid once the job assigned to him is done
- The Subcontractor is paid only for number of days he actually worked:
- Amount paid to subcontractor:
subcontractor.rate * (end_date - start_date).days
- Company can change Job's
end_date
:- Invoice
due_amount
should be recalculated accordingly - If Client already paid for the Invoice:
- If
paid_amount > due_amount
then send money to virtual Client's "local" account (stored in our db) - If
paid_amount < due_amount
changeinvoice_status
back topending
- If
- Invoice
- Client gets discount once they paid for 3 jobs (as regular customer)
- Discount percentage is set in application config
config/application.yml
- Client may loose discount if one of their invoices is marked as
overdue
- Company rejected Client's request
- Client has to create new job, the one which is rejected is no longer in use
Calculate the following values:
Revenue is calculated as SUM(invoices.paid_amount) - SUM(subcontractor_payouts.amount)
.
Gross sales is equal to SUM(invoices.paid_amount)
Percentage of jobs rejected by the Company
Predict revenue for: next month, next year. Take any valid acceptable algorythm.
Also include in report:
- Standard deviation (if possible)
- Worst case / best case revenue
Calculate for any given period (set by user):
- Top 5 best clients (based on total revenue impact)
- Top 5 worst clients
- Best subcontractor (based on total revenue impact). Think more about this one.
- Worst Client by number of overdue days at the current moment
Take 100000 Clients and 50000 working Subcontractors. Performance is acceptable if you feel comfortable with it :)
This app utilizes Framework v0.0.7 and rocks MIT license.