mirror of https://codeberg.org/dribdat/dribdat.git
User profile next event
This commit is contained in:
parent
d2d9ef5c64
commit
be9e3e8803
|
@ -38,6 +38,7 @@ nosetests.xml
|
||||||
.cache
|
.cache
|
||||||
tests/.cache
|
tests/.cache
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
|
.vscode/
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
*.mo
|
*.mo
|
||||||
|
|
|
@ -12,7 +12,7 @@ from dribdat.aggregation import GetEventUsers
|
||||||
from dribdat.user import getProjectStages, isUserActive
|
from dribdat.user import getProjectStages, isUserActive
|
||||||
from urllib.parse import quote, quote_plus, urlparse
|
from urllib.parse import quote, quote_plus, urlparse
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from sqlalchemy import or_
|
from sqlalchemy import and_, or_
|
||||||
import re
|
import re
|
||||||
|
|
||||||
blueprint = Blueprint('public', __name__, static_folder="../static")
|
blueprint = Blueprint('public', __name__, static_folder="../static")
|
||||||
|
@ -143,8 +143,18 @@ def user(username):
|
||||||
submissions = user.posted_challenges()
|
submissions = user.posted_challenges()
|
||||||
projects = user.joined_projects(True)
|
projects = user.joined_projects(True)
|
||||||
posts = user.latest_posts(20)
|
posts = user.latest_posts(20)
|
||||||
|
today = datetime.utcnow()
|
||||||
|
events_next = Event.query.filter(and_(
|
||||||
|
Event.is_hidden.isnot(True),
|
||||||
|
Event.lock_resources.isnot(True),
|
||||||
|
Event.ends_at > today
|
||||||
|
))
|
||||||
|
events_next = events_next.order_by(Event.starts_at.desc())
|
||||||
|
if events_next.count() == 0: events_next = None
|
||||||
|
# Filter out by today's date
|
||||||
return render_template("public/userprofile.html", active="profile",
|
return render_template("public/userprofile.html", active="profile",
|
||||||
user=user, projects=projects, posts=posts,
|
user=user, projects=projects, posts=posts,
|
||||||
|
events_next=events_next,
|
||||||
score=user.get_score(),
|
score=user.get_score(),
|
||||||
submissions=submissions,
|
submissions=submissions,
|
||||||
may_certify=user.may_certify()[0])
|
may_certify=user.may_certify()[0])
|
||||||
|
|
|
@ -120,7 +120,6 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if user.my_story %}
|
{% if user.my_story %}
|
||||||
|
@ -140,6 +139,14 @@
|
||||||
<div class="alert alert-success">
|
<div class="alert alert-success">
|
||||||
No projects here yet. Time to <b>Join</b> or <b>Start</b> something awesome!
|
No projects here yet. Time to <b>Join</b> or <b>Start</b> something awesome!
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if events_next %}
|
||||||
|
<div class="row events-next mt-4 mb-4">
|
||||||
|
{% for event in events_next %}
|
||||||
|
{{ misc.render_home_event(event) }}
|
||||||
|
{% endfor %}
|
||||||
|
</div><!-- /.row events-next -->
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<a name="projects"><h1>Projects</h1></a>
|
<a name="projects"><h1>Projects</h1></a>
|
||||||
|
|
Loading…
Reference in New Issue