Changeset - ed73d84e572c
[Not reviewed]
default
0 1 0
Dennis Fink - 3 years ago 2022-08-30 10:16:54
dennis.fink@c3l.lu
Remove bug in price calculation
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
c3l_membership/views.py
Show inline comments
 
@@ -40,49 +40,51 @@ def index():
 
        choices.append(("digicash", gettext("by DigiCash/Payconiq")))
 

	
 
    if current_app.config["SATISPAY_ENABLED"]:
 
        choices.append(("satispay", gettext("by Satispay")))
 

	
 
    choices.extend(
 
        (cryptocurrency_label, " ".join((gettext("by"), cryptocurrency_label.title())))
 
        for cryptocurrency_label, options in current_app.config[
 
            "CRYPTOCURRENCIES"
 
        ].items()
 
        if options["ENABLED"]
 
    )
 

	
 
    form.payment.choices = choices
 

	
 
    if form.validate_on_submit():
 

	
 
        if form.birthday.data:
 
            if calculate_age(form.birthday.data) < 18:
 
                minor_member = True
 
                form.student.data = True
 
            else:
 
                minor_member = False
 

	
 
        if minor_member or form.student.data or form.membership.data == "supporting":
 
        if (
 
            minor_member or form.student.data or form.membership.data == "supporting"
 
        ) and not form.starving.data:
 
            price = current_app.config["SUPPORTING_FEE"]
 
        elif form.starving.data:
 
            price = 1
 
        else:
 
            price = current_app.config["REGULAR_FEE"]
 

	
 
        if form.starving.data:
 
            status = "Starving"
 
        elif minor_member or form.student.data:
 
            status = "Student"
 
        elif form.membership.data == "supporting":
 
            status = "Supporter"
 
        else:
 
            status = "Regular"
 

	
 
        if form.payment.data in current_app.config["CRYPTOCURRENCIES"]:
 
            try:
 
                current_conversion_r = requests.get(
 
                    current_app.config["CONVERSION_URL"], timeout=30
 
                )
 
                current_conversion_r.raise_for_status()
 
            except:
 
                return render_template("index.html", form=form, crypto_error=True), 503
 
            else:
0 comments (0 inline, 0 general)