Private
Public Access
1
0

credits seem to work

This commit is contained in:
Sander Roosendaal
2021-11-11 11:37:01 +01:00
parent 4785beca1f
commit db1f10368a
4 changed files with 15 additions and 6 deletions

View File

@@ -21,6 +21,10 @@
<p>Plan: {{ plan.name }}</p>
<p>Price: {{ plan.price }}&euro;</p>
{% if rower.eurocredits > 0 %}
<p>Your Discount: {{ plan.price|discount:rower }}</p>
<p>You will pay: {{ plan.price|discounted:rower }}</p>
{% endif %}
</li>
<li>
<p>

View File

@@ -37,7 +37,7 @@
<th>Plan</th><td>{{ plan.name }}</td>
</tr>
<tr>
<th>Total</th><td>&euro; {{ plan.price|currency }}
<th>Total</th><td>&euro; {{ plan.price|discounted:rower|currency }}
</td>
</tr>
</tbody>
@@ -70,7 +70,7 @@
<label for="amount">
<div class="input-wrapper amount-wrapper">
<input id="amount" name="amount" type="hidden" min="1" placeholder="Amount"
value="{{ plan.price }}" readonly>
value="{{ plan.price|discounted:rower }}" readonly>
</div>
</label>
<div class="bt-drop-in-wrapper">
@@ -91,7 +91,7 @@
Policy and agree with the <a href="/rowers/legal/" target="_blank">Terms of Service</a>.
</p>
{% csrf_token %}
<button type="submit" id="submit-button"><span>Purchase for &euro; {{ plan.price|currency }}</span></button>
<button type="submit" id="submit-button"><span>Purchase for &euro; {{ plan.price|discounted:rower|currency }}</span></button>
</form>
</li>
<li class="grid_4">

View File

@@ -32,6 +32,10 @@
{% else %}
<p>Price: {{ plan.price }}&euro;</p>
{% endif %}
{% if rower.eurocredits and plan.price > 0 %}
<p>Your discount: {{ plan.price|discount:rower }}&euro;</p>
<p>You pay: {{ plan.price|discounted:rower }}&euro;</p>
{% endif %}
</li>
{% if form %}
<li class="grid_2">
@@ -47,7 +51,7 @@
If you have <a href="/rowers/createplan/">set a training target</a>, you can also ask to plan by that target. Select the
target from the targets list, and select "plan by target".
</p>
{% if plan.price == 0 %}
{% if plan.price|discounted:rower == 0 %}
<form enctype="multipart/form-data" action="" method="post">
{% else %}
<form enctype="multipart/form-data" action="/rowers/buyplan/{{ plan.id }}/" method="post">
@@ -56,7 +60,7 @@
{{ form.as_table }}
</table>
{% csrf_token %}
{% if plan.price == 0 %}
{% if plan.price|discounted:rower == 0 %}
<p><input class="button" type="submit" value="Create Plan and Add Sessions"></p>
{% else %}
<p><input class="button" type="submit" action="/rowers/buyplan/{{ plan.id }}/" value="BUY NOW and Add Sessions"></p>

View File

@@ -9,6 +9,7 @@ import json
from taggit.models import Tag
import rowers.garmin_stuff as gs
from rowers import credits
@login_required
@permission_required('plannedsession.view_session',fn=get_session_by_pk,raise_exception=True)
@@ -2575,7 +2576,7 @@ def rower_view_instantplan(request,id='',userid=0):
raise Http404("Plan does not exist")
plan = InstantPlan.objects.get(uuid=id)
discountedprice = credits.discounted(plan.price,r)
authorizationstring = 'Bearer '+settings.WORKOUTS_FIT_TOKEN
url = settings.WORKOUTS_FIT_URL+"/trainingplan/"+id