From c9f85a25896062833551550a6da8d4e83cd03d39 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 27 Mar 2013 17:38:05 +0100 Subject: [PATCH] Move excessive funds to WLF --- apps/funding/locale/pl/LC_MESSAGES/django.mo | Bin 4062 -> 4063 bytes apps/funding/locale/pl/LC_MESSAGES/django.po | 8 ++++---- apps/funding/templates/funding/wlfund.html | 4 ++-- apps/funding/views.py | 17 +++++++++++++---- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/apps/funding/locale/pl/LC_MESSAGES/django.mo b/apps/funding/locale/pl/LC_MESSAGES/django.mo index 537a35fb8e89c92f3be830d7c25265c5656f7cb8..3c69a40bbc1a8d9a92c34806886cd2864b7534dd 100644 GIT binary patch delta 1014 zcmYk)OK1~87{Ku_kETtN7#q~8wcV{^@FMuYdJ&&Uiw{~a)k9JG*pOA5l%z_H;)2?n zin1Q-!Hb|?stbBh5b;q3p(uLjMIjcX6hRafdh-97Ik?R3Z@!t?nQvzIll9rUcG9y% zBoh-^g`3dEZd{Ec*n>VsaTb#}hiUwc%^0f}p-3B#rIebN3jo|puV?)EZWh=HMkqIn8Q}Qf=BTlF2=@G z?bCQIRP-BW(Z=n_X5<(y!#rx{9_mrvK>cPl>qoNZ}p&rdN>d*55b!W52dDL+~P!n1(ahk#U6E~wKwiR`uUet~B86DJw z3#jv){nx%nG%S$oF@opRYd?byS`f^){sm5Rf5?o?r@ z)bEy^lHU{yf@i{M}?)Im_OB9^K&OI?&=Y|{2=n$*+}3}Qei z4la>5X%-g;aWEJV=^%oMil8WhI%&0Np@LAbpo{oF$pyp9``vRt&%O73j(&<3(}hkE zX$y$hxC47Ij&YpDF07&-zhV%Va2@`_cJw!i@JJ`Gjkp!HeK)SfVcdkHCO(VZ#Fv|- zApI0dRJ7qM+<*%>gsaFJvbR~p!h@*sh>4G33-L+xVH(%qjEOHGQ%D}ecoli%1}{zY zR&$}TV3`WtVGVVHm#7Q9K_23}7qN`B%L{x&%%e{H9EWikb=&~w-GN7N2q#fb zqKvwchmE)(Pblcb&rpx%HR{Ln4s~aX#%0ugE2s(mF>#pAQQ`<{V!Kcm8b#g6abprS z;c3))^7Z-yd=wOP;p@mFMHAmf&GZhkmfS~8=rQWYT0>pvqkGr4FT}R%KW%AoSAEgV zG|M*r>+ALZUolhcbqD+-p0GRTKkNxs-um}@+?|03T}QK-)Fpc&mz}m}61j6uB5hBc z&m?mRXEv3qEC%j*z5Ow_X!Swmku~LY2ZJwq;!Y~#ROgcUl%2Q7^VOTR(zuhom^y9e QPdQI3xie113cdIK108dB`~Uy| diff --git a/apps/funding/locale/pl/LC_MESSAGES/django.po b/apps/funding/locale/pl/LC_MESSAGES/django.po index 3e3e62aa0..c3f843cb5 100644 --- a/apps/funding/locale/pl/LC_MESSAGES/django.po +++ b/apps/funding/locale/pl/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-03-27 17:10+0100\n" -"PO-Revision-Date: 2013-03-27 17:10+0100\n" +"POT-Creation-Date: 2013-03-27 17:36+0100\n" +"PO-Revision-Date: 2013-03-27 17:36+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -198,8 +198,8 @@ msgid "Book" msgstr "Książka" #: templates/funding/wlfund.html:34 -msgid "Money from partial fundraiser" -msgstr "Pieniądze z częściowej zbiórki" +msgid "Excessive money from fundraiser" +msgstr "Pieniądze pozostałe ze zbiórki" #: templates/funding/tags/funding.html:10 msgid "Support a book:" diff --git a/apps/funding/templates/funding/wlfund.html b/apps/funding/templates/funding/wlfund.html index 8188f1a86..da35943c3 100755 --- a/apps/funding/templates/funding/wlfund.html +++ b/apps/funding/templates/funding/wlfund.html @@ -29,9 +29,9 @@ {% else %}
{{ entry.end }}
-
+{{ entry.sum }} zł
+
+{{ entry.wlfund }} zł
{{ entry.total }} zł
-
{% trans "Money from partial fundraiser" %}: +
{% trans "Excessive money from fundraiser" %}: {{ entry }}
diff --git a/apps/funding/views.py b/apps/funding/views.py index f54316208..c14cee3ee 100644 --- a/apps/funding/views.py +++ b/apps/funding/views.py @@ -21,7 +21,7 @@ def mix(*streams): else: substreams.append([read_date(item), item, iterstream, read_date, tag]) while substreams: - i, substream = max(enumerate(substreams), key=lambda x: x[0]) + i, substream = max(enumerate(substreams), key=lambda x: x[1][0]) yield substream[4], substream[1] try: item = next(substream[2]) @@ -41,12 +41,21 @@ class WLFundView(TemplateView): if tag == 'spent': total += e.amount else: - total -= e.sum() + total -= e.wlfund yield tag, e ctx = super(WLFundView, self).get_context_data() - offers = [o for o in Offer.objects.all() if o.state() == 'lose' and o.sum()] - amount = sum(o.sum() for o in offers) - sum(o.amount for o in Spent.objects.all()) + offers = [] + for o in Offer.objects.all(): + if o.state() == 'lose': + o.wlfund = o.sum() + if o.wlfund > 0: + offers.append(o) + elif o.state() == 'win': + o.wlfund = o.sum() - o.target + if o.wlfund > 0: + offers.append(o) + amount = sum(o.wlfund for o in offers) - sum(o.amount for o in Spent.objects.all()) print offers ctx['amount'] = amount -- 2.20.1