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>Plan: {{ plan.name }}</p>
<p>Price: {{ plan.price }}&euro;</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>
<li> <li>
<p> <p>

View File

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

View File

@@ -32,6 +32,10 @@
{% else %} {% else %}
<p>Price: {{ plan.price }}&euro;</p> <p>Price: {{ plan.price }}&euro;</p>
{% endif %} {% 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> </li>
{% if form %} {% if form %}
<li class="grid_2"> <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 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". target from the targets list, and select "plan by target".
</p> </p>
{% if plan.price == 0 %} {% if plan.price|discounted:rower == 0 %}
<form enctype="multipart/form-data" action="" method="post"> <form enctype="multipart/form-data" action="" method="post">
{% else %} {% else %}
<form enctype="multipart/form-data" action="/rowers/buyplan/{{ plan.id }}/" method="post"> <form enctype="multipart/form-data" action="/rowers/buyplan/{{ plan.id }}/" method="post">
@@ -56,7 +60,7 @@
{{ form.as_table }} {{ form.as_table }}
</table> </table>
{% csrf_token %} {% 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> <p><input class="button" type="submit" value="Create Plan and Add Sessions"></p>
{% else %} {% else %}
<p><input class="button" type="submit" action="/rowers/buyplan/{{ plan.id }}/" value="BUY NOW and Add Sessions"></p> <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 from taggit.models import Tag
import rowers.garmin_stuff as gs import rowers.garmin_stuff as gs
from rowers import credits
@login_required @login_required
@permission_required('plannedsession.view_session',fn=get_session_by_pk,raise_exception=True) @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") raise Http404("Plan does not exist")
plan = InstantPlan.objects.get(uuid=id) plan = InstantPlan.objects.get(uuid=id)
discountedprice = credits.discounted(plan.price,r)
authorizationstring = 'Bearer '+settings.WORKOUTS_FIT_TOKEN authorizationstring = 'Bearer '+settings.WORKOUTS_FIT_TOKEN
url = settings.WORKOUTS_FIT_URL+"/trainingplan/"+id url = settings.WORKOUTS_FIT_URL+"/trainingplan/"+id