Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better expected sales calculation #33

Closed
wants to merge 9 commits into from

Conversation

spraot
Copy link
Contributor

@spraot spraot commented Mar 15, 2016

This solves #4

@spraot
Copy link
Contributor Author

spraot commented Mar 16, 2016

This only makes a difference for server add-ons.

@thecatontheflat
Copy link
Owner

Thank you @rachetfoot

I will have a detailed look during this weekend

@thecatontheflat
Copy link
Owner

Expected amount of sales is different for my vendor (Cloud Add-Ons only).

Before merge:
screenshot 2016-03-20 19 45 46

After:
screenshot 2016-03-20 19 45 52

Could you please explain the logic of "guessing"? In my current version it simply takes the last sale by a license (either monthly or annually) and projects it to the current month. For example, in this month there are 5 expiring licenses: 4 monthly subscriptions and 1 annual. The logic takes last sales of those licenses (4 monthly + 1 annual).

How does it work exactly in the proposed solution?
Do you think it should be possible to unify it for both server and cloud versions?

@spraot
Copy link
Contributor Author

spraot commented Mar 20, 2016

Well, I haven't properly handled the case of annual cloud licenses (I don't
have any), which I expect would explain the entire difference for you. I
take the current renewal prices for the add-ons rather than the last sale
price, but I couldn't see how to tell whether the last sale was annual or
monthly, so I assumed monthly. If there is no better solution, we could go
back to using the last sale price for cloud addons.

The proposed solution is unified for cloud and server versions, expect for
the annual/monthly issue I mentioned.

The reason for guessing is that only about 1% of my server users renew
exactly on the expiry date. I've fitted a normal distribution (bell curve)
to when people renew relative to license expiry date and base my estimate
on that. This is applied to all AUTO_QUOTE licenses, while I assume that
all AUTO_RENEW licenses will be renewed exactly on the expiry date (cloud
addons are always AUTO_RENEW). The normal distribution isn't a perfect fit,
but it's certainly a much better guess than the original.

On Sun, Mar 20, 2016 at 7:50 PM Vitaliy Zurian notifications@github.com
wrote:

Expected amount of sales is different for my vendor (Cloud Add-Ons only).

Before merge:
[image: screenshot 2016-03-20 19 45 46]
https://cloud.githubusercontent.com/assets/727581/13906349/67b95cd2-eed4-11e5-876c-9dd2e8d3fc5a.png

After:
[image: screenshot 2016-03-20 19 45 52]
https://cloud.githubusercontent.com/assets/727581/13906351/6eb53d6c-eed4-11e5-9730-85c5c1c07e7b.png

Could you please explain the logic of "guessing"? In my current version it
simply takes the last sale by a license (either monthly or annually) and
projects it to the current month. For example, in this month there are 5
expiring licenses: 4 monthly subscriptions and 1 annual. The logic
takes last sales of those licenses (4 monthly + 1 annual).

How does it work exactly in the proposed solution?
Do you think it should be possible to unify it for both server and cloud
versions?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#33 (comment)

@spraot
Copy link
Contributor Author

spraot commented Mar 22, 2016

I made a few updates and tested it for the past few months. The estimates looked fairly good. Let me know if it fixed the discrepancy you saw.

I also don't know whether the distribution parameters and renewal rate I selected are suitable for all vendors. They could potentially be a input parameter instead of constants.

@thecatontheflat
Copy link
Owner

@rachetfoot I am waiting until this issue is resolved:
https://ecosystem.atlassian.net/browse/AMKT-15693

Then I could test it properly. At this moment, I cannot rely on the AMKT data

I will merge it once I am able to get "clean" results. So far even my local version is different from what I have in production

@thecatontheflat
Copy link
Owner

I have this error when I try to load homepage:

screenshot 2016-04-02 11 40 39

@spraot
Copy link
Contributor Author

spraot commented Apr 2, 2016

I guess you have sales with a null maintenance end date. Is that expected?

On Sat, Apr 2, 2016 at 10:41 AM Vitaliy Zurian notifications@github.com
wrote:

I have this error when I try to load homepage:

[image: screenshot 2016-04-02 11 40 39]
https://cloud.githubusercontent.com/assets/727581/14225329/c62b88c4-f8c7-11e5-8b62-f393a4ec3052.png


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#33 (comment)

$total = 0;
foreach ($licenses as $license) {
$lastSales = $this->getEntityManager()->getRepository('AppBundle:Sale')->findLastSalesByLicenses(array($license));
$lastSale = reset($lastSales);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When $lastSales is empty array, reset() returns false.

The login then fails later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I've fixed it now.

@thecatontheflat
Copy link
Owner

thecatontheflat commented May 1, 2016

Hey @rachetfoot
Sorry, I've been away for a while

I've checked the forecast today (first day of the month).
Current logic: $6,564.75
Logic in the PR: $11,030.00

I definitely like the latter :D But it seems that there is a problem somewhere

I have only cloud Add-Ons

$userCnt = $lastSale['licenseSize'];
if ($lastSale['maintenanceEndDate']->diff($lastSale['maintenanceStartDate'])->days < 45) {
$renewalLength = 1;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing that the wrong estimate you see is due to reading the wrong renewalLength here. My php installation is messed up at the moment, so I can't look at this now, but this is where I think you should look if you have time.

@thecatontheflat
Copy link
Owner

Outdated

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.

None yet

2 participants