mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-02-03 19:25:01 -05:00
Gold gifts don't record pennies, calculate them from days.
This commit is contained in:
@@ -31,7 +31,7 @@ from r2.models import Flair, FlairTemplate, FlairTemplateBySubredditIndex
|
||||
from r2.models import USER_FLAIR, LINK_FLAIR
|
||||
from r2.models import GoldPartnerDealCode
|
||||
from r2.models.bidding import Bid
|
||||
from r2.models.gold import gold_payments_by_user, gold_received_by_user
|
||||
from r2.models.gold import gold_payments_by_user, gold_received_by_user, days_to_pennies
|
||||
from r2.models.promo import NO_TRANSACTION, PromotionLog, PromotedLinkRoadblock
|
||||
from r2.models.token import OAuth2Client, OAuth2AccessToken
|
||||
from r2.models import traffic
|
||||
@@ -1775,7 +1775,8 @@ class ServerSecondsBar(Templated):
|
||||
|
||||
for payment in gold_gifts:
|
||||
rate = self.get_rate(payment.date)
|
||||
seconds += self.subtract_fees(payment.pennies) / rate
|
||||
pennies = days_to_pennies(payment.days)
|
||||
seconds += self.subtract_fees(pennies) / rate
|
||||
self.gift_message = self.make_message(seconds, self.my_gift_message,
|
||||
self.their_gift_message)
|
||||
|
||||
|
||||
@@ -485,6 +485,15 @@ def gold_received_by_user(user):
|
||||
return transactions
|
||||
|
||||
|
||||
def days_to_pennies(days):
|
||||
if days < 366:
|
||||
months = days / 31
|
||||
return months * g.gold_month_price.pennies
|
||||
else:
|
||||
years = days / 366
|
||||
return years * g.gold_year_price.pennies
|
||||
|
||||
|
||||
def append_random_bottlecap_phrase(message):
|
||||
"""Appends a random "bottlecap" phrase from the wiki page.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user