From 7546b786103670e00bf33b9f97c3aa42a1d6b69c Mon Sep 17 00:00:00 2001 From: "O. D." Date: Thu, 12 Sep 2024 14:35:52 -0600 Subject: [PATCH] added leaderboard page, improved dashboard, centered QR invite --- app.py | 13 ++++++++----- static/styles.css | 8 ++++++++ templates/dashboard.html | 33 ++++++++++++++++++--------------- templates/leaderboard.html | 19 ++++++++++++++++--- 4 files changed, 50 insertions(+), 23 deletions(-) diff --git a/app.py b/app.py index f9d3943..a5dffe5 100644 --- a/app.py +++ b/app.py @@ -246,8 +246,8 @@ def create_app(config=Config): { "$lookup": { "from": "users", - "localField": "_id", - "foreignField": "_id", + "localField": "added_by", + "foreignField": "added_by", "as": "user_info" } }, @@ -263,14 +263,17 @@ def create_app(config=Config): } } ]) - print(leaders) - for leader in leaders: + #print(list(leaders)) + cleaned_leaders=list() + for leader in list(leaders): leader["username"] = leader["username"][0]+"***"+leader["username"][-1] + cleaned_leaders.append(leader) if current_user.is_authenticated: username = user.username else: username = None - return render_template('leaderboard.html', leaders=leaders, username=username) + + return render_template('leaderboard.html', leaders=cleaned_leaders, username=username) return app diff --git a/static/styles.css b/static/styles.css index 5182ef4..6708dd9 100644 --- a/static/styles.css +++ b/static/styles.css @@ -44,6 +44,14 @@ div.leaflet-popup-content { } +div#qrgen img { + padding-left: 0; + padding-right: 0; + margin-left: auto; + margin-right: auto; + display: block; +} + section#pinner-modal { position: absolute; top: 7vh; diff --git a/templates/dashboard.html b/templates/dashboard.html index 6d43849..40c470e 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -9,22 +9,25 @@

Hola {{current_user.username}}

-

Aquí puedes ver los pines que has agregado y ver tu enlace/QR de invitación. Cada vez que recargas esta página, tu enlace de invitacón cambia y el anterior se vuelve inválido.

-
+

Aquí puedes ver los pines que has agregado y consultar tu enlace/QR de invitación. Cada vez que recargas esta página, tu enlace de invitacón cambia y el anterior se vuelve inválido.

+
+
+
+ +
+

Tu link es:

+

https://baches.qro.mx/registrame/{{current_user.referral_code}}

+
- -

Tu link es:

-

https://baches.qro.mx/registrame/{{current_user.referral_code}}

- {% if pins %} {% for pin in pins %} diff --git a/templates/leaderboard.html b/templates/leaderboard.html index 6d5d33b..5669b70 100644 --- a/templates/leaderboard.html +++ b/templates/leaderboard.html @@ -1,6 +1,19 @@ {% extends 'secondbase.html' %} -
    +{% block content %} +

    Aquí puedes consultar quiénes están contribuyendo. Por cuestiones de privacidad, los nombres están modificados, pero si sabes, sabes

    + + + + + + + + {% for leader in leaders %} - {% if username != None and leader.username == username %}
  • ¡Felicidades, estás aquí!{{ leader.username }} -> {{leader.count}}
  • {% else %}{{leader.username}} -> {{leader.count}}{% endif %} + + {% endfor %} - \ No newline at end of file + +
    MapistaMarcador
    {{leader.username}}{{leader.count}}
    + +{% endblock %} \ No newline at end of file