Changeset - b314c40f5920
[Not reviewed]
default
0 1 0
Dennis Fink - 3 years ago 2022-01-19 20:41:46
dennis.fink@c3l.lu
Fix xml_data voting flag
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
c3l_membership/views.py
Show inline comments
 
@@ -37,52 +37,56 @@ def index():
 

	
 
    if current_app.config["DIGICASH_ENABLED"]:
 
        choices.append(("digicash", gettext("by DigiCash")))
 

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

	
 
    form.payment.choices = choices
 

	
 
    if form.validate_on_submit():
 

	
 
        xml_data = {}
 

	
 
        if (
 
            form.minor_member.data
 
            or form.student.data
 
            or form.membership.data == "supporting"
 
        ):
 

	
 
            price = current_app.config["SUPPORTING_FEE"]
 
        else:
 
            price = current_app.config["REGULAR_FEE"]
 

	
 
        if form.membership.data == "supporting":
 
            xml_data["voting"] = 0
 
        elif form.membership.data == "regular":
 
            price = current_app.config["REGULAR_FEE"]
 
            xml_data["voting"] = 1
 

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

	
 
        xml_data["status"] = status
 
        xml_data["name"] = form.fullname.data
 
        xml_data["birthday"] = (
 
            form.birthday.data if form.birthday.data is not None else date(9999, 12, 12)
 
        )
 
        xml_data["username"] = form.username.data
 
        xml_data["email"] = form.email.data
 
        xml_data["address"] = " ".join(
 
            (
 
                form.street.data,
 
                form.zip.data,
 
                form.city.data,
0 comments (0 inline, 0 general)