Skip to content
This repository was archived by the owner on May 28, 2024. It is now read-only.

Attempt at backend trial#3

Open
hbierlee wants to merge 4 commits intodeskbookers:masterfrom
hbierlee:master
Open

Attempt at backend trial#3
hbierlee wants to merge 4 commits intodeskbookers:masterfrom
hbierlee:master

Conversation

@hbierlee
Copy link
Copy Markdown

@hbierlee hbierlee commented Jul 5, 2016

I wanted to send in my work before the end of the day, although I'm aware it's far from perfect. I sort of solved the problem by using SQL get booking counts and turnover per month per booker, and then use some PHP array folding and grouping loops to proces it further to what I think is a LTV report.

That said, I might have misinterpreted the assignment. I have interpreted it like this (if we take a LTV period of 18 months and commission of 10%):

  • Profit is of course turnover * commission
  • A LTV report has LTV values for all the past months longer than 18 months ago.
  • A LTV value for a certain month X is basically the average profit made by only those bookers who made their first booking on month X, and only in the period of month X, X+1, ..., X+17 (so, an 18 month period starting from month X). So, for instance, turnover in that period made by a booker who has made their first booking in month X+2 does not count towards this value.

This last part is what made the whole thing a lot tougher, so if I understood this wrongly, I would very much like to hear it so I can solve it properly. Otherwise, I'd love to hear some pointers on how to tackle this problem, as I only got so far with SQL.

hbierlee added 4 commits July 5, 2016 16:52
… average

I use a query to retrieve all bookings and group the bookings of each booker per month. Then I use PHP to further process the results by folding the requested lifetime period of months to get booker counts, booking counts and averages.
@vdvleon
Copy link
Copy Markdown
Contributor

vdvleon commented Jul 6, 2016

I think you understood is correctly. Is your code ready to review in this case?

@hbierlee
Copy link
Copy Markdown
Author

hbierlee commented Jul 7, 2016

In that case, it is ready for review. Like I said, it's definitely not the optimal solution, and some of the requirements have not been met, but I think at this point it'd be better if you take a look at it and gave me some pointers.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants