Compare commits
7 Commits
V0.6.5
...
ae055841e7
| Author | SHA1 | Date | |
|---|---|---|---|
| ae055841e7 | |||
| 11ebb568db | |||
| 03d3a50169 | |||
| 8cab2d1929 | |||
| 0eb1024b0f | |||
| e4589df111 | |||
| dba87ebcf2 |
@@ -224,11 +224,13 @@ Putzliga nutzt echte Web-Push-Benachrichtigungen mit Service Worker und VAPID.
|
||||
```bash
|
||||
flask --app app.py notify-due
|
||||
flask --app app.py notify-monthly-winner
|
||||
flask --app app.py notify-all
|
||||
```
|
||||
|
||||
`notify-due`:
|
||||
|
||||
- prüft offene Aufgaben, die heute oder morgen fällig sind
|
||||
- sendet ab 09:00 Uhr genau einen Sammel-Push pro Nutzer und Tag
|
||||
- berücksichtigt nur offene Aufgaben, die heute fällig sind
|
||||
- berücksichtigt die Nutzeroption `notification_task_due_enabled`
|
||||
|
||||
`notify-monthly-winner`:
|
||||
@@ -237,12 +239,24 @@ flask --app app.py notify-monthly-winner
|
||||
- verweist auf das Scoreboard/Archiv des letzten Monats
|
||||
- berücksichtigt `notification_monthly_winner_enabled`
|
||||
|
||||
Badge-Pushes:
|
||||
|
||||
- werden direkt beim Freischalten eines neuen Badges verschickt
|
||||
- berücksichtigen `notification_badge_enabled`
|
||||
- funktionieren für Aufgaben-Badges und Monats-Badges
|
||||
|
||||
Für iPhone/iPad muss zusätzlich sichergestellt sein, dass der Server ausgehend Apple Web Push erreichen kann. Laut WebKit sollten dafür Verbindungen zu `*.push.apple.com` möglich sein.
|
||||
|
||||
### Produktiver Betrieb
|
||||
|
||||
Auf Cloudron oder einem anderen Server solltest du diese Kommandos regelmäßig per Cronjob oder Task ausführen, zum Beispiel:
|
||||
|
||||
```bash
|
||||
flask --app /app/app.py notify-all
|
||||
```
|
||||
|
||||
Wenn du lieber getrennt schedulen willst, funktionieren auch weiterhin:
|
||||
|
||||
```bash
|
||||
flask --app /app/app.py notify-due
|
||||
flask --app /app/app.py notify-monthly-winner
|
||||
|
||||
@@ -90,6 +90,7 @@ def create_app(config_class: type[Config] = Config) -> Flask:
|
||||
"nav_items": [
|
||||
("tasks.my_tasks", "Meine Aufgaben", "house"),
|
||||
("tasks.all_tasks", "Alle", "list"),
|
||||
("tasks.archive_view", "Archiv", "check-double"),
|
||||
("tasks.create", "Neu", "plus"),
|
||||
("tasks.calendar_view", "Kalender", "calendar"),
|
||||
("scoreboard.index", "Highscore", "trophy"),
|
||||
@@ -98,6 +99,7 @@ def create_app(config_class: type[Config] = Config) -> Flask:
|
||||
"mobile_nav_items": [
|
||||
("tasks.my_tasks", "Meine Aufgaben", "house"),
|
||||
("tasks.all_tasks", "Alle Aufgaben", "list"),
|
||||
("tasks.archive_view", "Archiv", "check-double"),
|
||||
("tasks.calendar_view", "Kalender", "calendar"),
|
||||
("scoreboard.index", "Highscore", "trophy"),
|
||||
("settings.index", "Optionen", "gear"),
|
||||
|
||||
@@ -5,7 +5,7 @@ import click
|
||||
from .extensions import db
|
||||
from .models import BadgeDefinition, User
|
||||
from .services.monthly import archive_months_missing_up_to_previous
|
||||
from .services.notifications import send_due_notifications, send_monthly_winner_notifications
|
||||
from .services.notifications import run_scheduled_notifications, send_due_notifications, send_monthly_winner_notifications
|
||||
|
||||
|
||||
DEFAULT_BADGES = [
|
||||
@@ -175,3 +175,14 @@ def register_cli(app) -> None:
|
||||
def notify_monthly_winner_command():
|
||||
result = send_monthly_winner_notifications()
|
||||
click.echo(f"Winner-Push: sent={result.sent} skipped={result.skipped} failed={result.failed}")
|
||||
|
||||
@app.cli.command("notify-all")
|
||||
def notify_all_command():
|
||||
results = run_scheduled_notifications()
|
||||
daily = results["daily_due"]
|
||||
monthly = results["monthly_winner"]
|
||||
click.echo(
|
||||
"Scheduled-Pushes: "
|
||||
f"daily(sent={daily.sent}, skipped={daily.skipped}, failed={daily.failed}) "
|
||||
f"monthly(sent={monthly.sent}, skipped={monthly.skipped}, failed={monthly.failed})"
|
||||
)
|
||||
|
||||
@@ -89,8 +89,9 @@ class SettingsProfileForm(FlaskForm):
|
||||
"Avatar",
|
||||
validators=[Optional(), FileAllowed(["png", "jpg", "jpeg", "gif", "webp", "svg"], "Bitte ein Bild hochladen.")],
|
||||
)
|
||||
notification_task_due_enabled = BooleanField("Push bei bald fälligen Aufgaben")
|
||||
notification_task_due_enabled = BooleanField("Push bei heutigen offenen Aufgaben")
|
||||
notification_monthly_winner_enabled = BooleanField("Push zum Monatssieger")
|
||||
notification_badge_enabled = BooleanField("Push bei neuen Badges")
|
||||
submit = SubmitField("Einstellungen speichern")
|
||||
|
||||
def __init__(self, original_email: str | None = None, *args, **kwargs):
|
||||
|
||||
@@ -28,6 +28,7 @@ class User(UserMixin, TimestampMixin, db.Model):
|
||||
calendar_feed_token = db.Column(db.String(255), nullable=True, unique=True, index=True)
|
||||
notification_task_due_enabled = db.Column(db.Boolean, nullable=False, default=True)
|
||||
notification_monthly_winner_enabled = db.Column(db.Boolean, nullable=False, default=True)
|
||||
notification_badge_enabled = db.Column(db.Boolean, nullable=False, default=True)
|
||||
|
||||
assigned_task_templates = db.relationship(
|
||||
"TaskTemplate",
|
||||
|
||||
@@ -57,6 +57,7 @@ def index():
|
||||
current_user.email = form.email.data.lower().strip()
|
||||
current_user.notification_task_due_enabled = form.notification_task_due_enabled.data
|
||||
current_user.notification_monthly_winner_enabled = form.notification_monthly_winner_enabled.data
|
||||
current_user.notification_badge_enabled = form.notification_badge_enabled.data
|
||||
if form.password.data:
|
||||
current_user.set_password(form.password.data)
|
||||
if form.avatar.data:
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import calendar
|
||||
from collections import defaultdict
|
||||
from datetime import date
|
||||
from datetime import date, timedelta
|
||||
|
||||
from flask import Blueprint, flash, redirect, render_template, request, url_for
|
||||
from flask_login import current_user, login_required
|
||||
@@ -33,10 +33,76 @@ def _secondary_user_choices() -> list[tuple[int, str]]:
|
||||
return [(0, "Keine zweite Person")] + _user_choices()
|
||||
|
||||
|
||||
def _my_tasks_soon_priority(task: TaskInstance) -> int:
|
||||
order = {
|
||||
"due_tomorrow": 0,
|
||||
"due_day_after_tomorrow": 1,
|
||||
"open": 2,
|
||||
}
|
||||
return order.get(task.status, 99)
|
||||
|
||||
|
||||
def _task_sort_key(task: TaskInstance, sort: str) -> tuple:
|
||||
if sort == "points":
|
||||
return (-task.points_awarded, task.due_date, task.title.lower())
|
||||
if sort == "user":
|
||||
return (task.assignee_label.lower(), task.due_date, task.title.lower())
|
||||
return (task.due_date, task.title.lower())
|
||||
|
||||
|
||||
def _group_active_tasks(tasks: list[TaskInstance], *, sort: str = "due") -> dict[str, list[TaskInstance]]:
|
||||
sections = {
|
||||
"overdue": [],
|
||||
"today": [],
|
||||
"soon": [],
|
||||
"open": [],
|
||||
}
|
||||
|
||||
for task in tasks:
|
||||
if task.is_completed:
|
||||
continue
|
||||
if task.status == "overdue":
|
||||
sections["overdue"].append(task)
|
||||
elif task.status == "due_today":
|
||||
sections["today"].append(task)
|
||||
elif task.status in {"due_tomorrow", "due_day_after_tomorrow"}:
|
||||
sections["soon"].append(task)
|
||||
else:
|
||||
sections["open"].append(task)
|
||||
|
||||
sections["overdue"].sort(key=lambda task: _task_sort_key(task, sort))
|
||||
sections["today"].sort(key=lambda task: _task_sort_key(task, sort))
|
||||
sections["soon"].sort(
|
||||
key=lambda task: (_my_tasks_soon_priority(task),) + _task_sort_key(task, sort)
|
||||
)
|
||||
sections["open"].sort(key=lambda task: _task_sort_key(task, sort))
|
||||
return sections
|
||||
|
||||
|
||||
def _archive_day_priority(day: date, today: date) -> tuple[int, int]:
|
||||
if day == today:
|
||||
return (0, 0)
|
||||
if day == today - timedelta(days=1):
|
||||
return (1, 0)
|
||||
if day == today - timedelta(days=2):
|
||||
return (2, 0)
|
||||
return (3, -day.toordinal())
|
||||
|
||||
|
||||
def _archive_day_label(day: date, today: date) -> str:
|
||||
if day == today:
|
||||
return "Heute"
|
||||
if day == today - timedelta(days=1):
|
||||
return "Gestern"
|
||||
if day == today - timedelta(days=2):
|
||||
return "Vorgestern"
|
||||
return day.strftime("%d.%m.%Y")
|
||||
|
||||
|
||||
@bp.route("/my-tasks")
|
||||
@login_required
|
||||
def my_tasks():
|
||||
tasks = (
|
||||
all_tasks = (
|
||||
TaskInstance.query.filter(
|
||||
or_(
|
||||
TaskInstance.assigned_user_id == current_user.id,
|
||||
@@ -46,26 +112,15 @@ def my_tasks():
|
||||
.order_by(TaskInstance.completed_at.is_(None).desc(), TaskInstance.due_date.asc())
|
||||
.all()
|
||||
)
|
||||
refresh_task_statuses(tasks)
|
||||
refresh_task_statuses(all_tasks)
|
||||
sections = _group_active_tasks(all_tasks)
|
||||
|
||||
sections = {
|
||||
"open": [],
|
||||
"due_today": [],
|
||||
"due_tomorrow": [],
|
||||
"due_day_after_tomorrow": [],
|
||||
"overdue": [],
|
||||
"completed": [],
|
||||
}
|
||||
for task in tasks:
|
||||
sections[task.status].append(task)
|
||||
|
||||
completed_count = len(sections["completed"])
|
||||
completed_count = len([task for task in all_tasks if task.is_completed])
|
||||
active_count = (
|
||||
len(sections["open"])
|
||||
+ len(sections["due_today"])
|
||||
+ len(sections["due_tomorrow"])
|
||||
+ len(sections["due_day_after_tomorrow"])
|
||||
+ len(sections["overdue"])
|
||||
len(sections["overdue"])
|
||||
+ len(sections["today"])
|
||||
+ len(sections["soon"])
|
||||
+ len(sections["open"])
|
||||
)
|
||||
completion_ratio = 0 if completed_count + active_count == 0 else round(completed_count / (completed_count + active_count) * 100)
|
||||
|
||||
@@ -113,10 +168,9 @@ def all_tasks():
|
||||
|
||||
if status != "all":
|
||||
if status == "soon":
|
||||
tasks = [task for task in tasks if task.status in {"due_today", "due_tomorrow", "due_day_after_tomorrow"}]
|
||||
tasks = [task for task in tasks if task.status in {"due_tomorrow", "due_day_after_tomorrow"}]
|
||||
else:
|
||||
status_map = {
|
||||
"completed": "completed",
|
||||
"overdue": "overdue",
|
||||
"open": "open",
|
||||
"today": "due_today",
|
||||
@@ -126,15 +180,58 @@ def all_tasks():
|
||||
selected = status_map.get(status)
|
||||
if selected:
|
||||
tasks = [task for task in tasks if task.status == selected]
|
||||
tasks = [task for task in tasks if not task.is_completed]
|
||||
else:
|
||||
tasks = [task for task in tasks if not task.is_completed]
|
||||
|
||||
sections = _group_active_tasks(tasks, sort=sort)
|
||||
|
||||
return render_template(
|
||||
"tasks/all_tasks.html",
|
||||
tasks=tasks,
|
||||
sections=sections,
|
||||
users=User.query.order_by(User.name.asc()).all(),
|
||||
filters={"status": status, "mine": mine, "user_id": user_filter, "sort": sort},
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/archive")
|
||||
@login_required
|
||||
def archive_view():
|
||||
selected_user_id = request.args.get("user_id", type=int) or current_user.id
|
||||
archive_users = User.query.order_by(User.name.asc()).all()
|
||||
selected_user = next((user for user in archive_users if user.id == selected_user_id), current_user)
|
||||
ordered_users = sorted(archive_users, key=lambda user: (user.id != current_user.id, user.name.lower()))
|
||||
|
||||
completed_tasks = (
|
||||
TaskInstance.query.filter_by(completed_by_user_id=selected_user.id)
|
||||
.filter(TaskInstance.completed_at.isnot(None))
|
||||
.order_by(TaskInstance.completed_at.desc(), TaskInstance.updated_at.desc())
|
||||
.all()
|
||||
)
|
||||
|
||||
today = today_local()
|
||||
grouped: dict[date, list[TaskInstance]] = defaultdict(list)
|
||||
for task in completed_tasks:
|
||||
grouped[task.completed_at.date()].append(task)
|
||||
|
||||
archive_sections = [
|
||||
{
|
||||
"label": _archive_day_label(day, today),
|
||||
"day": day,
|
||||
"tasks": grouped[day],
|
||||
}
|
||||
for day in sorted(grouped.keys(), key=lambda value: _archive_day_priority(value, today))
|
||||
]
|
||||
|
||||
return render_template(
|
||||
"tasks/archive.html",
|
||||
archive_users=ordered_users,
|
||||
selected_user=selected_user,
|
||||
archive_sections=archive_sections,
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/tasks/new", methods=["GET", "POST"])
|
||||
@login_required
|
||||
def create():
|
||||
|
||||
@@ -25,24 +25,30 @@ def _max_day_streak(days: set[date]) -> int:
|
||||
return best
|
||||
|
||||
|
||||
def award_badge(user: User, badge_key: str, *, awarded_at: datetime | None = None, context: dict | None = None) -> bool:
|
||||
def award_badge(
|
||||
user: User,
|
||||
badge_key: str,
|
||||
*,
|
||||
awarded_at: datetime | None = None,
|
||||
context: dict | None = None,
|
||||
) -> UserBadge | None:
|
||||
definition = BadgeDefinition.query.filter_by(key=badge_key, active=True).first()
|
||||
if not definition:
|
||||
return False
|
||||
return None
|
||||
|
||||
existing = UserBadge.query.filter_by(user_id=user.id, badge_definition_id=definition.id).first()
|
||||
if existing:
|
||||
return False
|
||||
return None
|
||||
|
||||
db.session.add(
|
||||
UserBadge(
|
||||
user_id=user.id,
|
||||
badge_definition_id=definition.id,
|
||||
awarded_at=awarded_at or datetime.utcnow(),
|
||||
context=json.dumps(context, sort_keys=True) if context else None,
|
||||
)
|
||||
award = UserBadge(
|
||||
user_id=user.id,
|
||||
badge_definition_id=definition.id,
|
||||
awarded_at=awarded_at or datetime.utcnow(),
|
||||
context=json.dumps(context, sort_keys=True) if context else None,
|
||||
)
|
||||
return True
|
||||
db.session.add(award)
|
||||
db.session.flush()
|
||||
return award
|
||||
|
||||
|
||||
def badge_awards_for_month(user_id: int, year: int, month: int) -> list[UserBadge]:
|
||||
@@ -101,20 +107,26 @@ def _completion_metrics(user: User) -> dict[str, int]:
|
||||
return metrics
|
||||
|
||||
|
||||
def evaluate_task_badges(user: User) -> list[str]:
|
||||
def evaluate_task_badges(user: User, *, notify: bool = False) -> list[UserBadge]:
|
||||
definitions = BadgeDefinition.query.filter_by(active=True).all()
|
||||
metrics = _completion_metrics(user)
|
||||
unlocked: list[str] = []
|
||||
unlocked: list[UserBadge] = []
|
||||
|
||||
for definition in definitions:
|
||||
metric_value = metrics.get(definition.trigger_type)
|
||||
if metric_value is None:
|
||||
continue
|
||||
if metric_value >= definition.threshold and award_badge(user, definition.key):
|
||||
unlocked.append(definition.name)
|
||||
if metric_value >= definition.threshold:
|
||||
award = award_badge(user, definition.key)
|
||||
if award:
|
||||
unlocked.append(award)
|
||||
|
||||
if unlocked:
|
||||
db.session.commit()
|
||||
if notify:
|
||||
from .notifications import send_badge_notifications_for_awards
|
||||
|
||||
send_badge_notifications_for_awards(unlocked)
|
||||
return unlocked
|
||||
|
||||
|
||||
@@ -151,31 +163,39 @@ def _winner_user_ids(year: int, month: int) -> set[int]:
|
||||
return {row.user_id for row in rows}
|
||||
|
||||
|
||||
def evaluate_monthly_badges(year: int, month: int) -> list[str]:
|
||||
def evaluate_monthly_badges(year: int, month: int, *, notify: bool = False) -> list[UserBadge]:
|
||||
award_time = _month_end_award_time(year, month)
|
||||
unlocked: list[str] = []
|
||||
unlocked: list[UserBadge] = []
|
||||
winners = _winner_user_ids(year, month)
|
||||
previous_year, previous_month_value = previous_month(year, month)
|
||||
previous_winners = _winner_user_ids(previous_year, previous_month_value)
|
||||
|
||||
for user in User.query.order_by(User.id.asc()).all():
|
||||
if user.id in winners:
|
||||
if award_badge(user, "monthly_champion", awarded_at=award_time, context={"year": year, "month": month}):
|
||||
unlocked.append(f"{user.name}: Monatssieger")
|
||||
award = award_badge(user, "monthly_champion", awarded_at=award_time, context={"year": year, "month": month})
|
||||
if award:
|
||||
unlocked.append(award)
|
||||
|
||||
if user.id in previous_winners:
|
||||
if award_badge(user, "title_defender", awarded_at=award_time, context={"year": year, "month": month}):
|
||||
unlocked.append(f"{user.name}: Titelverteidiger")
|
||||
award = award_badge(user, "title_defender", awarded_at=award_time, context={"year": year, "month": month})
|
||||
if award:
|
||||
unlocked.append(award)
|
||||
elif MonthlyScoreSnapshot.query.filter_by(year=previous_year, month=previous_month_value, user_id=user.id).first():
|
||||
if award_badge(user, "comeback_kid", awarded_at=award_time, context={"year": year, "month": month}):
|
||||
unlocked.append(f"{user.name}: Comeback Kid")
|
||||
award = award_badge(user, "comeback_kid", awarded_at=award_time, context={"year": year, "month": month})
|
||||
if award:
|
||||
unlocked.append(award)
|
||||
|
||||
if _user_had_clean_month(user.id, year, month):
|
||||
if award_badge(user, "white_glove", awarded_at=award_time, context={"year": year, "month": month}):
|
||||
unlocked.append(f"{user.name}: Weiße Weste")
|
||||
award = award_badge(user, "white_glove", awarded_at=award_time, context={"year": year, "month": month})
|
||||
if award:
|
||||
unlocked.append(award)
|
||||
|
||||
if unlocked:
|
||||
db.session.commit()
|
||||
if notify:
|
||||
from .notifications import send_badge_notifications_for_awards
|
||||
|
||||
send_badge_notifications_for_awards(unlocked)
|
||||
return unlocked
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ def ensure_schema_and_admins() -> None:
|
||||
db.session.execute(text("ALTER TABLE user ADD COLUMN calendar_feed_token VARCHAR(255)"))
|
||||
db.session.commit()
|
||||
|
||||
if "notification_badge_enabled" not in column_names:
|
||||
db.session.execute(text("ALTER TABLE user ADD COLUMN notification_badge_enabled BOOLEAN NOT NULL DEFAULT 1"))
|
||||
db.session.commit()
|
||||
|
||||
task_template_columns = {column["name"] for column in inspector.get_columns("task_template")}
|
||||
if "default_assigned_user_secondary_id" not in task_template_columns:
|
||||
db.session.execute(text("ALTER TABLE task_template ADD COLUMN default_assigned_user_secondary_id INTEGER"))
|
||||
|
||||
@@ -97,7 +97,7 @@ def archive_months_missing_up_to_previous() -> None:
|
||||
)
|
||||
)
|
||||
db.session.commit()
|
||||
evaluate_monthly_badges(year, month)
|
||||
evaluate_monthly_badges(year, month, notify=True)
|
||||
year, month = next_month(year, month)
|
||||
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@ from __future__ import annotations
|
||||
|
||||
import json
|
||||
from dataclasses import dataclass
|
||||
from datetime import timedelta
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from flask import current_app
|
||||
from pywebpush import WebPushException, webpush
|
||||
from sqlalchemy import or_
|
||||
|
||||
from ..extensions import db
|
||||
from ..models import NotificationLog, PushSubscription, TaskInstance, User
|
||||
from ..models import NotificationLog, PushSubscription, TaskInstance, User, UserBadge
|
||||
from .monthly import archive_months_missing_up_to_previous, get_snapshot_rows
|
||||
from .dates import local_now, previous_month
|
||||
|
||||
@@ -60,56 +60,96 @@ def _send_subscription(subscription: PushSubscription, payload: dict) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def _subscriptions_for_user(user_id: int) -> list[PushSubscription]:
|
||||
return PushSubscription.query.filter_by(user_id=user_id).all()
|
||||
|
||||
|
||||
def _send_payload_to_user(user: User, notification_type: str, marker: dict, payload: dict) -> NotificationResult:
|
||||
result = NotificationResult()
|
||||
subscriptions = _subscriptions_for_user(user.id)
|
||||
if not subscriptions:
|
||||
result.skipped += 1
|
||||
return result
|
||||
|
||||
if _notification_exists(user.id, notification_type, marker):
|
||||
result.skipped += 1
|
||||
return result
|
||||
|
||||
sent_any = False
|
||||
for subscription in subscriptions:
|
||||
if _send_subscription(subscription, payload):
|
||||
sent_any = True
|
||||
result.sent += 1
|
||||
else:
|
||||
result.failed += 1
|
||||
|
||||
if sent_any:
|
||||
_log_notification(user.id, notification_type, marker)
|
||||
db.session.commit()
|
||||
elif result.failed == 0:
|
||||
result.skipped += 1
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def _merge_results(base: NotificationResult, extra: NotificationResult) -> NotificationResult:
|
||||
base.sent += extra.sent
|
||||
base.skipped += extra.skipped
|
||||
base.failed += extra.failed
|
||||
return base
|
||||
|
||||
|
||||
def send_due_notifications() -> NotificationResult:
|
||||
result = NotificationResult()
|
||||
if not push_enabled():
|
||||
result.skipped += 1
|
||||
return result
|
||||
|
||||
today = local_now().date()
|
||||
now = local_now()
|
||||
if now.hour < 9:
|
||||
result.skipped += 1
|
||||
return result
|
||||
|
||||
today = now.date()
|
||||
relevant_tasks = TaskInstance.query.filter(
|
||||
TaskInstance.completed_at.is_(None),
|
||||
TaskInstance.assigned_user_id.isnot(None),
|
||||
TaskInstance.due_date <= today + timedelta(days=1),
|
||||
TaskInstance.due_date == today,
|
||||
or_(
|
||||
TaskInstance.assigned_user_id.isnot(None),
|
||||
TaskInstance.assigned_user_secondary_id.isnot(None),
|
||||
),
|
||||
).all()
|
||||
|
||||
tasks_by_user: dict[int, list[TaskInstance]] = {}
|
||||
for task in relevant_tasks:
|
||||
user = task.assigned_user
|
||||
if not user or not user.notification_task_due_enabled:
|
||||
for assigned_user in task.assigned_users:
|
||||
tasks_by_user.setdefault(assigned_user.id, []).append(task)
|
||||
|
||||
for user in User.query.order_by(User.name.asc()).all():
|
||||
if not user.notification_task_due_enabled:
|
||||
result.skipped += 1
|
||||
continue
|
||||
|
||||
payload_marker = {"task_instance_id": task.id, "due_date": task.due_date.isoformat()}
|
||||
if _notification_exists(user.id, "task_due", payload_marker):
|
||||
personal_tasks = tasks_by_user.get(user.id, [])
|
||||
if not personal_tasks:
|
||||
result.skipped += 1
|
||||
continue
|
||||
|
||||
subscriptions = PushSubscription.query.filter_by(user_id=user.id).all()
|
||||
if not subscriptions:
|
||||
result.skipped += 1
|
||||
continue
|
||||
|
||||
body = "Heute ist ein guter Tag für Punkte." if task.due_date <= today else "Morgen wird's fällig."
|
||||
task_count = len(personal_tasks)
|
||||
payload = {
|
||||
"title": f"Putzliga erinnert: {task.title}",
|
||||
"body": body,
|
||||
"title": "Putzliga für heute",
|
||||
"body": (
|
||||
"Heute wartet 1 offene Aufgabe auf dich. Zeit zum Punkte sammeln."
|
||||
if task_count == 1
|
||||
else f"Heute warten {task_count} offene Aufgaben auf dich. Zeit zum Punkte sammeln."
|
||||
),
|
||||
"icon": _absolute_url("/static/images/pwa-icon-192.png"),
|
||||
"badge": _absolute_url("/static/images/pwa-badge.png"),
|
||||
"url": _absolute_url("/my-tasks"),
|
||||
"tag": f"task-{task.id}",
|
||||
"tag": f"due-{today.isoformat()}-{user.id}",
|
||||
}
|
||||
|
||||
sent_any = False
|
||||
for subscription in subscriptions:
|
||||
if _send_subscription(subscription, payload):
|
||||
sent_any = True
|
||||
result.sent += 1
|
||||
else:
|
||||
result.failed += 1
|
||||
|
||||
if sent_any:
|
||||
_log_notification(user.id, "task_due", payload_marker)
|
||||
db.session.commit()
|
||||
marker = {"date": today.isoformat()}
|
||||
_merge_results(result, _send_payload_to_user(user, "task_due_daily", marker, payload))
|
||||
return result
|
||||
|
||||
|
||||
@@ -140,14 +180,6 @@ def send_monthly_winner_notifications() -> NotificationResult:
|
||||
if not user.notification_monthly_winner_enabled:
|
||||
result.skipped += 1
|
||||
continue
|
||||
if _notification_exists(user.id, "monthly_winner", marker):
|
||||
result.skipped += 1
|
||||
continue
|
||||
|
||||
subscriptions = PushSubscription.query.filter_by(user_id=user.id).all()
|
||||
if not subscriptions:
|
||||
result.skipped += 1
|
||||
continue
|
||||
|
||||
payload = {
|
||||
"title": "Der Haushalts-Champion des letzten Monats steht fest",
|
||||
@@ -157,16 +189,43 @@ def send_monthly_winner_notifications() -> NotificationResult:
|
||||
"url": _absolute_url(f"/scoreboard?archive={target_year}-{target_month:02d}"),
|
||||
"tag": f"winner-{target_year}-{target_month}",
|
||||
}
|
||||
sent_any = False
|
||||
for subscription in subscriptions:
|
||||
if _send_subscription(subscription, payload):
|
||||
sent_any = True
|
||||
result.sent += 1
|
||||
else:
|
||||
result.failed += 1
|
||||
|
||||
if sent_any:
|
||||
_log_notification(user.id, "monthly_winner", marker)
|
||||
db.session.commit()
|
||||
_merge_results(result, _send_payload_to_user(user, "monthly_winner", marker, payload))
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def send_badge_notifications_for_awards(awards: list[UserBadge]) -> NotificationResult:
|
||||
result = NotificationResult()
|
||||
if not push_enabled():
|
||||
result.skipped += len(awards) or 1
|
||||
return result
|
||||
|
||||
for award in awards:
|
||||
user = award.user
|
||||
definition = award.badge_definition
|
||||
if not user or not definition:
|
||||
result.skipped += 1
|
||||
continue
|
||||
if not user.notification_badge_enabled:
|
||||
result.skipped += 1
|
||||
continue
|
||||
|
||||
marker = {"user_badge_id": award.id}
|
||||
payload = {
|
||||
"title": "Neues Badge freigeschaltet",
|
||||
"body": f"{definition.name}: {definition.description}",
|
||||
"icon": _absolute_url("/static/images/pwa-icon-192.png"),
|
||||
"badge": _absolute_url("/static/images/pwa-badge.png"),
|
||||
"url": _absolute_url("/settings"),
|
||||
"tag": f"badge-{award.id}",
|
||||
}
|
||||
_merge_results(result, _send_payload_to_user(user, "badge_award", marker, payload))
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def run_scheduled_notifications() -> dict[str, NotificationResult]:
|
||||
return {
|
||||
"daily_due": send_due_notifications(),
|
||||
"monthly_winner": send_monthly_winner_notifications(),
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ def complete_task(task: TaskInstance, completed_by_user_id: int) -> TaskInstance
|
||||
ensure_next_recurring_task(task)
|
||||
db.session.commit()
|
||||
if task.completed_by_user:
|
||||
evaluate_task_badges(task.completed_by_user)
|
||||
evaluate_task_badges(task.completed_by_user, notify=True)
|
||||
return task
|
||||
|
||||
|
||||
|
||||
@@ -295,6 +295,22 @@ p {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.brand__mark {
|
||||
width: 58px;
|
||||
height: 58px;
|
||||
flex: 0 0 58px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
border-radius: 20px;
|
||||
background: radial-gradient(circle at 50% 42%, rgba(112, 207, 255, 0.38), rgba(37, 99, 235, 0.08));
|
||||
box-shadow:
|
||||
0 18px 38px rgba(37, 99, 235, 0.18),
|
||||
inset 0 0 0 1px rgba(255, 255, 255, 0.24);
|
||||
}
|
||||
|
||||
.brand strong {
|
||||
@@ -308,8 +324,37 @@ p {
|
||||
}
|
||||
|
||||
.brand__logo {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.brand--public .brand__mark {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
flex-basis: 64px;
|
||||
border-radius: 22px;
|
||||
}
|
||||
|
||||
.hero-card__brand-mark {
|
||||
width: 108px;
|
||||
height: 108px;
|
||||
margin-bottom: 18px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
border-radius: 32px;
|
||||
background: radial-gradient(circle at 50% 40%, rgba(112, 207, 255, 0.42), rgba(37, 99, 235, 0.12));
|
||||
box-shadow:
|
||||
0 22px 48px rgba(37, 99, 235, 0.22),
|
||||
inset 0 0 0 1px rgba(255, 255, 255, 0.26);
|
||||
}
|
||||
|
||||
.hero-card__brand-mark img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.flash-stack {
|
||||
@@ -429,8 +474,8 @@ p {
|
||||
|
||||
.task-card {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
padding: 20px;
|
||||
gap: 14px;
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.task-card__top {
|
||||
@@ -460,7 +505,7 @@ p {
|
||||
}
|
||||
|
||||
.task-card h3 {
|
||||
font-size: 1.35rem;
|
||||
font-size: 1.24rem;
|
||||
line-height: 1.08;
|
||||
overflow-wrap: break-word;
|
||||
hyphens: auto;
|
||||
@@ -532,8 +577,8 @@ p {
|
||||
|
||||
.task-meta {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
|
||||
gap: 10px 14px;
|
||||
}
|
||||
|
||||
.task-meta dt {
|
||||
@@ -549,11 +594,16 @@ p {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.task-card--compact .task-meta {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.task-assignee {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
color: var(--muted);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.task-assignee__avatars {
|
||||
@@ -566,6 +616,10 @@ p {
|
||||
border: 2px solid var(--surface-strong);
|
||||
}
|
||||
|
||||
.task-assignee span:last-child {
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
@@ -712,6 +766,46 @@ p {
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.quick-actions {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.archive-user-tabs {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 4px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.archive-user-tab {
|
||||
flex: 0 0 auto;
|
||||
min-width: 108px;
|
||||
display: grid;
|
||||
justify-items: center;
|
||||
gap: 8px;
|
||||
padding: 14px 16px;
|
||||
border-radius: 20px;
|
||||
border: 1px solid var(--border);
|
||||
background: var(--surface);
|
||||
box-shadow: var(--shadow);
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.archive-user-tab span {
|
||||
font-size: 0.92rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
.archive-user-tab.is-active {
|
||||
color: var(--text);
|
||||
border-color: rgba(37, 99, 235, 0.22);
|
||||
background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(52, 211, 153, 0.1));
|
||||
}
|
||||
|
||||
.panel--toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -1281,6 +1375,41 @@ p {
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.brand {
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.brand__mark {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
flex-basis: 50px;
|
||||
border-radius: 18px;
|
||||
}
|
||||
|
||||
.brand--public .brand__mark,
|
||||
.hero-card__brand-mark {
|
||||
width: 88px;
|
||||
height: 88px;
|
||||
flex-basis: 88px;
|
||||
border-radius: 28px;
|
||||
}
|
||||
|
||||
.archive-user-tabs {
|
||||
gap: 10px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.archive-user-tab {
|
||||
min-width: 92px;
|
||||
padding: 12px 12px;
|
||||
gap: 6px;
|
||||
border-radius: 18px;
|
||||
}
|
||||
|
||||
.archive-user-tab span {
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.task-card {
|
||||
gap: 14px;
|
||||
padding: 18px;
|
||||
@@ -1405,8 +1534,8 @@ p {
|
||||
right: 8px;
|
||||
bottom: calc(10px + env(safe-area-inset-bottom));
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 4px;
|
||||
grid-template-columns: repeat(6, minmax(0, 1fr));
|
||||
gap: 3px;
|
||||
padding: 8px 8px;
|
||||
border-radius: 22px;
|
||||
background: var(--nav-bg);
|
||||
@@ -1420,13 +1549,13 @@ p {
|
||||
.nav-link {
|
||||
display: grid;
|
||||
justify-items: center;
|
||||
gap: 5px;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
padding: 10px 4px 9px;
|
||||
padding: 10px 3px 9px;
|
||||
color: var(--muted);
|
||||
border-radius: 16px;
|
||||
text-align: center;
|
||||
font-size: 0.66rem;
|
||||
font-size: 0.61rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.05;
|
||||
}
|
||||
@@ -1434,7 +1563,7 @@ p {
|
||||
.bottom-nav__item span {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-height: 2.1em;
|
||||
min-height: 2.3em;
|
||||
white-space: normal;
|
||||
word-break: keep-all;
|
||||
overflow-wrap: break-word;
|
||||
@@ -1448,8 +1577,8 @@ p {
|
||||
|
||||
.nav-icon,
|
||||
.nav-icon svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
@@ -1501,7 +1630,7 @@ p {
|
||||
.fab-quick-task {
|
||||
position: fixed;
|
||||
right: max(16px, env(safe-area-inset-right));
|
||||
bottom: calc(72px + var(--safe-bottom));
|
||||
bottom: calc(86px + var(--safe-bottom));
|
||||
width: 62px;
|
||||
height: 62px;
|
||||
border: 2px solid rgba(255, 255, 255, 0.55);
|
||||
|
||||
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 631 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 587 KiB |
@@ -1,8 +1,10 @@
|
||||
const CACHE_NAME = "putzliga-shell-v2";
|
||||
const CACHE_NAME = "putzliga-shell-v4";
|
||||
const ASSETS = [
|
||||
"/static/css/style.css",
|
||||
"/static/js/app.js",
|
||||
"/static/images/logo.svg",
|
||||
"/static/images/favicon.png",
|
||||
"/static/images/apple-touch-icon.png",
|
||||
"/static/images/logo-mark.png",
|
||||
"/static/images/pwa-icon-192.png",
|
||||
"/static/images/pwa-icon-512.png"
|
||||
];
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
{% block content %}
|
||||
<section class="auth-layout">
|
||||
<div class="hero-card hero-card--brand">
|
||||
<div class="hero-card__brand-mark">
|
||||
<img src="{{ url_for('static', filename='images/logo-mark.png') }}" alt="Putzliga Logo">
|
||||
</div>
|
||||
<p class="eyebrow">Leichtgewichtige Haushalts-App</p>
|
||||
<h2>Putzliga bringt Punkte, Rhythmus und ein bisschen Liga-Stimmung in den Alltag.</h2>
|
||||
<p>Mehrere Nutzer, wiederkehrende Aufgaben, Monats-Highscore, Archiv, Kalender und PWA-Pushs in einer bewusst schlanken Flask-App.</p>
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
{% block content %}
|
||||
<section class="auth-layout">
|
||||
<div class="hero-card hero-card--brand">
|
||||
<div class="hero-card__brand-mark">
|
||||
<img src="{{ url_for('static', filename='images/logo-mark.png') }}" alt="Putzliga Logo">
|
||||
</div>
|
||||
<p class="eyebrow">Gemeinsam sauberer</p>
|
||||
<h2>Erstelle dein Konto und steig direkt in die Liga ein.</h2>
|
||||
<p>Nach dem Login landest du sofort bei „Meine Aufgaben“ und kannst Aufgaben anlegen, verteilen und Punkte sammeln.</p>
|
||||
@@ -39,4 +42,3 @@
|
||||
</section>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
<meta name="description" content="Putzliga macht Haushaltsaufgaben leichter, motivierender und fair verteilt.">
|
||||
<title>{% block title %}{{ app_name }}{% endblock %}</title>
|
||||
<link rel="manifest" href="{{ url_for('main.manifest') }}">
|
||||
<link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='images/favicon.svg') }}">
|
||||
<link rel="icon" type="image/png" sizes="128x128" href="{{ url_for('static', filename='images/favicon.png') }}">
|
||||
<link rel="shortcut icon" href="{{ url_for('static', filename='images/favicon.png') }}">
|
||||
<link rel="apple-touch-icon" href="{{ url_for('static', filename='images/apple-touch-icon.png') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css', v=asset_version('css/style.css')) }}">
|
||||
</head>
|
||||
@@ -26,7 +27,9 @@
|
||||
{% if current_user.is_authenticated %}
|
||||
<aside class="sidebar">
|
||||
<a class="brand" href="{{ url_for('tasks.my_tasks') }}">
|
||||
<img src="{{ url_for('static', filename='images/logo.svg') }}" alt="Putzliga Logo" class="brand__logo">
|
||||
<span class="brand__mark">
|
||||
<img src="{{ url_for('static', filename='images/logo-mark.png') }}" alt="Putzliga Logo" class="brand__logo">
|
||||
</span>
|
||||
<div>
|
||||
<strong>Putzliga</strong>
|
||||
<span>Haushalt mit Punktestand</span>
|
||||
@@ -68,7 +71,9 @@
|
||||
</a>
|
||||
{% else %}
|
||||
<a class="brand brand--public" href="{{ url_for('auth.login') }}">
|
||||
<img src="{{ url_for('static', filename='images/logo.svg') }}" alt="Putzliga Logo" class="brand__logo">
|
||||
<span class="brand__mark">
|
||||
<img src="{{ url_for('static', filename='images/logo-mark.png') }}" alt="Putzliga Logo" class="brand__logo">
|
||||
</span>
|
||||
<div>
|
||||
<strong>Putzliga</strong>
|
||||
<span>Haushaltsaufgaben mit Liga-Gefühl</span>
|
||||
|
||||
@@ -66,18 +66,10 @@
|
||||
<dt>Fällig</dt>
|
||||
<dd>{{ task.due_date|date_de }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Zuständig</dt>
|
||||
<dd>{{ task.assignee_label }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Rhythmus</dt>
|
||||
<dd>{{ task.task_template.recurrence_label }}</dd>
|
||||
</div>
|
||||
{% if task.completed_at %}
|
||||
<div>
|
||||
<dt>Erledigt von</dt>
|
||||
<dd>{{ task.completed_by_user.name if task.completed_by_user else '—' }}</dd>
|
||||
<dt>Erledigt</dt>
|
||||
<dd>{{ task.completed_at|datetime_de }}</dd>
|
||||
</div>
|
||||
{% endif %}
|
||||
</dl>
|
||||
|
||||
@@ -40,12 +40,16 @@
|
||||
</div>
|
||||
<label class="checkbox">
|
||||
{{ form.notification_task_due_enabled() }}
|
||||
<span>Push für heute oder morgen fällige Aufgaben</span>
|
||||
<span>Täglicher Push um 09:00 Uhr, wenn heute Aufgaben für dich offen sind</span>
|
||||
</label>
|
||||
<label class="checkbox">
|
||||
{{ form.notification_monthly_winner_enabled() }}
|
||||
<span>Push zum Monatssieger am 1. um 09:00 Uhr</span>
|
||||
</label>
|
||||
<label class="checkbox">
|
||||
{{ form.notification_badge_enabled() }}
|
||||
<span>Push, wenn du ein neues Badge freischaltest</span>
|
||||
</label>
|
||||
{{ form.submit(class_='button') }}
|
||||
</form>
|
||||
</article>
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
<option value="tomorrow" {% if filters.status == 'tomorrow' %}selected{% endif %}>Morgen fällig</option>
|
||||
<option value="day_after_tomorrow" {% if filters.status == 'day_after_tomorrow' %}selected{% endif %}>Übermorgen fällig</option>
|
||||
<option value="overdue" {% if filters.status == 'overdue' %}selected{% endif %}>Überfällig</option>
|
||||
<option value="completed" {% if filters.status == 'completed' %}selected{% endif %}>Erledigt</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field field--compact">
|
||||
@@ -43,11 +42,69 @@
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="task-grid">
|
||||
{% for task in tasks %}
|
||||
{{ task_card(task, current_user) }}
|
||||
{% else %}
|
||||
<div class="empty-state">Für diese Filter gibt es gerade keine Aufgaben.</div>
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% if filters.status == 'all' %}
|
||||
<section class="stack">
|
||||
<div class="section-heading">
|
||||
<h2>Überfällig</h2>
|
||||
<span class="section-heading__count">{{ sections.overdue|length }}</span>
|
||||
</div>
|
||||
<div class="task-grid">
|
||||
{% for task in sections.overdue %}
|
||||
{{ task_card(task, current_user) }}
|
||||
{% else %}
|
||||
<div class="empty-state">Für diese Auswahl ist nichts überfällig.</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="stack">
|
||||
<div class="section-heading">
|
||||
<h2>Heute</h2>
|
||||
<span class="section-heading__count">{{ sections.today|length }}</span>
|
||||
</div>
|
||||
<div class="task-grid">
|
||||
{% for task in sections.today %}
|
||||
{{ task_card(task, current_user) }}
|
||||
{% else %}
|
||||
<div class="empty-state">Heute ist hier gerade nichts offen.</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="stack">
|
||||
<div class="section-heading">
|
||||
<h2>Bald fällig</h2>
|
||||
<span class="section-heading__count">{{ sections.soon|length }}</span>
|
||||
</div>
|
||||
<div class="task-grid">
|
||||
{% for task in sections.soon %}
|
||||
{{ task_card(task, current_user) }}
|
||||
{% else %}
|
||||
<div class="empty-state">In den nächsten Tagen ist hier gerade nichts fällig.</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="stack">
|
||||
<div class="section-heading">
|
||||
<h2>Offen</h2>
|
||||
<span class="section-heading__count">{{ sections.open|length }}</span>
|
||||
</div>
|
||||
<div class="task-grid">
|
||||
{% for task in sections.open %}
|
||||
{{ task_card(task, current_user) }}
|
||||
{% else %}
|
||||
<div class="empty-state">Keine weiteren offenen Aufgaben für diese Auswahl.</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% else %}
|
||||
<section class="task-grid">
|
||||
{% for task in tasks %}
|
||||
{{ task_card(task, current_user) }}
|
||||
{% else %}
|
||||
<div class="empty-state">Für diese Filter gibt es gerade keine Aufgaben.</div>
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "partials/macros.html" import avatar, task_card %}
|
||||
{% block title %}Archiv · Putzliga{% endblock %}
|
||||
{% block page_title %}Archiv{% endblock %}
|
||||
{% block content %}
|
||||
<section class="hero-grid">
|
||||
<article class="hero-card">
|
||||
<p class="eyebrow">Erledigte Aufgaben</p>
|
||||
<h2>Was schon geschafft wurde</h2>
|
||||
<p>Hier landen alle erledigten Aufgaben. Du kannst pro Person sehen, was heute, gestern, vorgestern und davor erledigt wurde.</p>
|
||||
</article>
|
||||
<article class="panel highlight-panel">
|
||||
<p class="eyebrow">Ansicht</p>
|
||||
<h2>{{ selected_user.name }}</h2>
|
||||
<p class="muted">Wechsle über die Tabs direkt zwischen den erledigten Aufgaben der einzelnen Nutzer.</p>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="archive-user-tabs" aria-label="Archiv nach Nutzer">
|
||||
{% for user in archive_users %}
|
||||
<a
|
||||
href="{{ url_for('tasks.archive_view', user_id=user.id) }}"
|
||||
class="archive-user-tab {% if selected_user.id == user.id %}is-active{% endif %}"
|
||||
>
|
||||
{{ avatar(user) }}
|
||||
<span>{{ user.name }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</section>
|
||||
|
||||
{% for section in archive_sections %}
|
||||
<section class="stack">
|
||||
<div class="section-heading">
|
||||
<h2>{{ section.label }}</h2>
|
||||
<span class="section-heading__count">{{ section.tasks|length }}</span>
|
||||
</div>
|
||||
<div class="task-grid">
|
||||
{% for task in section.tasks %}
|
||||
{{ task_card(task, current_user, compact=true) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% else %}
|
||||
<section class="panel">
|
||||
<div class="empty-state">Für {{ selected_user.name }} gibt es im Archiv noch keine erledigten Aufgaben.</div>
|
||||
</section>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
@@ -18,14 +18,20 @@
|
||||
</article>
|
||||
<article class="panel highlight-panel">
|
||||
<p class="eyebrow">Schnellzugriff</p>
|
||||
<a class="button button--wide" href="{{ url_for('tasks.create') }}">
|
||||
{{ nav_icon('plus') }}
|
||||
<span>Neue Aufgabe anlegen</span>
|
||||
</a>
|
||||
<a class="button button--secondary button--wide" href="{{ url_for('scoreboard.index') }}">
|
||||
{{ nav_icon('trophy') }}
|
||||
<span>Zum aktuellen Highscore</span>
|
||||
</a>
|
||||
<div class="quick-actions">
|
||||
<a class="button button--wide" href="{{ url_for('tasks.create') }}">
|
||||
{{ nav_icon('plus') }}
|
||||
<span>Neue Aufgabe anlegen</span>
|
||||
</a>
|
||||
<a class="button button--ghost button--wide" href="{{ url_for('tasks.archive_view') }}">
|
||||
{{ nav_icon('check-double') }}
|
||||
<span>Archiv</span>
|
||||
</a>
|
||||
<a class="button button--secondary button--wide" href="{{ url_for('scoreboard.index') }}">
|
||||
{{ nav_icon('trophy') }}
|
||||
<span>Zum aktuellen Highscore</span>
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
@@ -43,44 +49,30 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="stack">
|
||||
<div class="section-heading">
|
||||
<h2>Heute</h2>
|
||||
<span class="section-heading__count">{{ sections.today|length }}</span>
|
||||
</div>
|
||||
<div class="task-grid">
|
||||
{% for task in sections.today %}
|
||||
{{ task_card(task, current_user) }}
|
||||
{% else %}
|
||||
<div class="empty-state">Heute ist gerade nichts mehr offen. Sehr stark.</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="stack">
|
||||
<div class="section-heading">
|
||||
<h2>Bald fällig</h2>
|
||||
<span class="section-heading__count">{{ sections.due_today|length }}</span>
|
||||
<span class="section-heading__count">{{ sections.soon|length }}</span>
|
||||
</div>
|
||||
<div class="task-grid">
|
||||
{% for task in sections.due_today %}
|
||||
{% for task in sections.soon %}
|
||||
{{ task_card(task, current_user) }}
|
||||
{% else %}
|
||||
<div class="empty-state">Heute ist gerade nichts mehr auf Kante.</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="stack">
|
||||
<div class="section-heading">
|
||||
<h2>Morgen fällig</h2>
|
||||
<span class="section-heading__count">{{ sections.due_tomorrow|length }}</span>
|
||||
</div>
|
||||
<div class="task-grid">
|
||||
{% for task in sections.due_tomorrow %}
|
||||
{{ task_card(task, current_user) }}
|
||||
{% else %}
|
||||
<div class="empty-state">Für morgen sieht es gerade entspannt aus.</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="stack">
|
||||
<div class="section-heading">
|
||||
<h2>Übermorgen fällig</h2>
|
||||
<span class="section-heading__count">{{ sections.due_day_after_tomorrow|length }}</span>
|
||||
</div>
|
||||
<div class="task-grid">
|
||||
{% for task in sections.due_day_after_tomorrow %}
|
||||
{{ task_card(task, current_user) }}
|
||||
{% else %}
|
||||
<div class="empty-state">Auch übermorgen ist noch nichts Drängendes drin.</div>
|
||||
<div class="empty-state">Gerade ist nichts in den nächsten Tagen fällig.</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
@@ -98,18 +90,4 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="stack">
|
||||
<div class="section-heading">
|
||||
<h2>Erledigt</h2>
|
||||
<span class="section-heading__count">{{ sections.completed|length }}</span>
|
||||
</div>
|
||||
<div class="task-grid">
|
||||
{% for task in sections.completed %}
|
||||
{{ task_card(task, current_user, compact=true) }}
|
||||
{% else %}
|
||||
<div class="empty-state">Noch keine erledigten Aufgaben in deiner Liste.</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||