Skip to content
This repository was archived by the owner on Mar 15, 2018. It is now read-only.

Commit e1f0bf7

Browse files
author
Andy McKay
committed
remove MKT_CUT (bug 825245)
1 parent c63a3e5 commit e1f0bf7

File tree

4 files changed

+10
-27
lines changed

4 files changed

+10
-27
lines changed

apps/constants/base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,6 @@
467467
REVIEWED_REVIEW: 1,
468468
}
469469

470-
# Percentage of what developers earn after Marketplace's cut.
471-
MKT_CUT = .70
472-
473470
# Login credential source. We'll also include the site source in that.
474471
# All the old existing AMO users and anyone before we started tracking this.
475472
LOGIN_SOURCE_UNKNOWN = 0

mkt/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
from mkt.constants import platforms, ratingsbodies, regions
22
from mkt.constants.submit import *
3-
4-
MKT_CUT = .70

mkt/stats/search.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import amo
88
from amo.utils import create_es_index_if_missing
9-
from mkt import MKT_CUT
109
from mkt.inapp_pay.models import InappPayment
1110
from mkt.webapps.models import Installed
1211
from stats.models import Contribution
@@ -31,7 +30,7 @@ def get_finance_total(qs, addon, field=None, **kwargs):
3130
document = {
3231
'addon': addon,
3332
'count': sales[0]['sales'] if sales.count() else 0,
34-
'revenue': cut(revenue[0]['revenue'] if revenue.count() else 0),
33+
'revenue': revenue[0]['revenue'] if revenue.count() else 0,
3534
'refunds': refunds[0]['refunds'] if refunds.count() else 0,
3635
}
3736
if field:
@@ -43,7 +42,7 @@ def get_finance_total(qs, addon, field=None, **kwargs):
4342
# Non-USD-normalized revenue, calculated from currency's amount rather
4443
# than price tier.
4544
if field == 'currency':
46-
document['revenue_non_normalized'] = cut(qs.values('addon')
45+
document['revenue_non_normalized'] = (qs.values('addon')
4746
.filter(q, refund=None, **kwargs)
4847
.annotate(revenue=Sum('amount'))
4948
[0]['revenue'] if revenue.count() else 0)
@@ -73,7 +72,7 @@ def get_finance_total_inapp(qs, addon, inapp_name='', field=None, **kwargs):
7372
'addon': addon,
7473
'inapp': inapp_name,
7574
'count': sales[0]['sales'] if sales.count() else 0,
76-
'revenue': cut(revenue[0]['revenue'] if revenue.count() else 0),
75+
'revenue': revenue[0]['revenue'] if revenue.count() else 0,
7776
'refunds': refunds[0]['refunds'] if refunds.count() else 0,
7877
}
7978
if field:
@@ -111,15 +110,15 @@ def get_finance_daily(contribution):
111110
created__month=date.month,
112111
created__day=date.day).count() or 0,
113112
# TODO: non-USD-normalized revenue (daily_by_currency)?
114-
'revenue': cut(Contribution.objects.filter(
113+
'revenue': Contribution.objects.filter(
115114
addon__id=addon_id,
116115
refund=None,
117116
type=amo.CONTRIB_PURCHASE,
118117
created__year=date.year,
119118
created__month=date.month,
120119
created__day=date.day)
121120
.aggregate(revenue=Sum('price_tier__price'))['revenue']
122-
or 0),
121+
or 0,
123122
'refunds': Contribution.objects.filter(
124123
addon__id=addon_id,
125124
refund__isnull=False,
@@ -149,15 +148,15 @@ def get_finance_daily_inapp(payment):
149148
created__month=date.month,
150149
created__day=date.day).count() or 0,
151150
# TODO: non-USD-normalized revenue (daily_inapp_by_currency)?
152-
'revenue': cut(InappPayment.objects.filter(
151+
'revenue': InappPayment.objects.filter(
153152
config__addon__id=addon_id,
154153
contribution__refund=None,
155154
contribution__type=amo.CONTRIB_PURCHASE,
156155
created__year=date.year,
157156
created__month=date.month,
158157
created__day=date.day)
159158
.aggregate(rev=Sum('contribution__price_tier__price'))['rev']
160-
or 0),
159+
or 0,
161160
'refunds': InappPayment.objects.filter(
162161
contribution__addon__id=addon_id,
163162
contribution__refund__isnull=False,
@@ -216,14 +215,6 @@ def setup_mkt_indexes(index=None, aliased=True):
216215
es.put_mapping(model._meta.db_table, mapping, index)
217216

218217

219-
def cut(revenue):
220-
"""
221-
Takes away Marketplace's cut from developers' revenue.
222-
"""
223-
return Decimal(str(round(Decimal(str(revenue)) *
224-
Decimal(str(MKT_CUT)), 2)))
225-
226-
227218
def handle_kwargs(q, field, kwargs, join_field=None):
228219
"""
229220
Processes kwargs to combine '' and None values and make it ready for

mkt/stats/tests/test_views.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import csv
22
import datetime
3+
from decimal import Decimal
34
import json
45
import random
56

6-
from django.contrib.auth.models import AnonymousUser
7-
87
from nose.tools import eq_
98
from test_utils import RequestFactory
10-
import waffle
119

1210
from access.models import Group, GroupUser
1311
import amo
@@ -20,7 +18,6 @@
2018
from mkt.webapps.models import Installed
2119
from mkt.site.fixtures import fixture
2220
from mkt.stats import search, tasks, views
23-
from mkt.stats.search import cut
2421
from mkt.stats.views import (FINANCE_SERIES, get_series_column,
2522
get_series_line, pad_missing_stats)
2623
from stats.models import Contribution
@@ -335,7 +332,7 @@ def test_revenue(self):
335332
date__range=d_range))
336333

337334
for stat, day in zip(stats, sorted(self.expected_days, reverse=True)):
338-
expected_revenue = day * .99 * amo.MKT_CUT
335+
expected_revenue = day * .99
339336
eq_(round(stat['count'], 2), round(expected_revenue, 2))
340337

341338

@@ -364,7 +361,7 @@ def setUp(self):
364361
amount=random.randint(0, 10),
365362
currency=expected['currency'],
366363
price_tier=price_tier)
367-
expected['count'] += cut(price_tier.price)
364+
expected['count'] += Decimal(price_tier.price)
368365
expected['count'] = int(expected['count'])
369366
tasks.index_finance_total_by_currency([self.app.pk])
370367
self.refresh(timesleep=1)

0 commit comments

Comments
 (0)