Lumipunkte for activity checks and a daily reward, Lumishop layout polish

- Activity check: configurable Lumipunkte for "Ich bin da", awarded once after the check is
  closed (on the website right away, otherwise on the next dashboard/points/activity page load)
- Daily reward: 5 Lumipunkte on the first page view of the day, one shared award per day
- Lumishop: equal hero buttons, category box as tall as the item list, "Meine Anträge" as tiles,
  spacing between the tabs and the order list in the management view

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Maaxxs 2026-09-22 10:25:56 +02:00
parent c62c996a3f
commit 83e858987c
11 changed files with 309 additions and 5 deletions

View file

@ -6,6 +6,7 @@
*/
require_once __DIR__ . '/includes/bootstrap.php';
require_once __DIR__ . '/includes/activity_api.php';
require_once __DIR__ . '/includes/activity_points.php';
require_permission('activity.manage');
$detailId = (int) ($_GET['id'] ?? 0);
@ -24,6 +25,13 @@ try {
if ($detailId > 0 && !$detail && !$apiError) {
show_not_found();
}
// Lumipunkte fuer abgeschlossene Checks vergeben (der angezeigte sofort, sonst alle mit abgelaufener Frist)
if (!$apiError) {
foreach (activity_process_points($detail && $detail['status'] !== 'open' ? (int) $detail['check_id'] : null, $detail) as $pointsMessage) {
set_flash('success', $pointsMessage);
}
}
$detailPoints = $detail ? activity_points_get((int) $detail['check_id']) : null;
// Kanaele und Rollen fuer das Formular
$channels = [];
@ -136,6 +144,10 @@ include __DIR__ . '/includes/header.php';
if (!empty($detail['add_role_id'])) $parts[] = '➕ @' . ($detail['add_role_name'] ?? $detail['add_role_id']) . ' geben';
?>
<?= $parts ? e(implode(' · ', $parts)) : '<span class="text-muted">keine - nur Liste im Log-Kanal</span>' ?>
<?php if ($detailPoints): ?>
<br><strong>Belohnung:</strong> <?= contribution_coin(16) ?> <?= (int) $detailPoints['points_present'] ?> Lumipunkte für „Ich bin da“
<span class="text-muted">- <?= $detailPoints['processed_at'] ? e((string) $detailPoints['result']) : 'werden nach dem Abschluss vergeben' ?></span>
<?php endif; ?>
<?php if (!$isOpen && !empty($detail['result']) && $detail['status'] === 'closed'): ?>
<br><span class="text-muted">Ergebnis: <?= (int) ($detail['result']['dm_sent'] ?? 0) ?> PN verschickt<?= !empty($detail['result']['dm_failed']) ? ' (' . (int) $detail['result']['dm_failed'] . ' mit geschlossenen PNs)' : '' ?>,
<?= (int) ($detail['result']['roles_changed'] ?? 0) ?> Rollen geändert<?= !empty($detail['result']['role_errors']) ? ', ' . (int) $detail['result']['role_errors'] . ' Fehler (fehlen dem Bot Rechte?)' : '' ?></span>
@ -240,6 +252,13 @@ Bitte meldet euch kurz zurück, ob ihr noch aktiv dabei seid. Einfach unten auf
</select></label>
</div>
</fieldset>
<fieldset>
<legend>Belohnung</legend>
<label><span>Lumipunkte für „Ich bin da“ <span class="text-muted">(0 = keine)</span></span>
<input type="number" name="points_present" min="0" max="<?= CONTRIBUTION_MAX_POINTS ?>" value="0">
</label>
<p class="field-hint">Werden nach dem Abschluss an alle mit „Ich bin da“ und Website-Konto vergeben - auch wenn der Bot den Check nach Ablauf der Frist schließt. Bei einem Abbruch gibt es keine Punkte.</p>
</fieldset>
<fieldset>
<legend>Was passiert ohne Rückmeldung?</legend>
<label class="checkbox-label"><input type="checkbox" name="dm_enabled" value="1" data-toggle-dm> Private Nachricht (PN) schicken</label>

View file

@ -4,6 +4,7 @@
*/
require_once __DIR__ . '/includes/bootstrap.php';
require_once __DIR__ . '/includes/activity_api.php';
require_once __DIR__ . '/includes/activity_points.php';
require_permission('activity.manage');
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
@ -65,7 +66,10 @@ try {
'apply_to_absent' => !empty($_POST['apply_to_absent']),
'created_by' => (int) ($me['discord_id'] ?? 0),
];
$points = max(0, min(CONTRIBUTION_MAX_POINTS, (int) ($_POST['points_present'] ?? 0)));
$result = activity_api_request('POST', '', [], $body);
// Belohnung fuer "Ich bin da" merken - vergeben wird nach dem Abschluss
activity_points_save((int) ($result['check_id'] ?? 0), $points, time() + $minutes * 60);
$consequences = array_filter([
$dmEnabled ? 'PN' : null,
$body['remove_role_id'] ? 'Rolle entfernen' : null,
@ -75,6 +79,7 @@ try {
'Titel' => $body['title'],
'Dauer' => $minutes >= 1440 ? ($minutes / 1440) . ' Tage' : ($minutes / 60) . ' Stunden',
'Folgen' => $consequences ? implode(', ', $consequences) : 'keine',
'Belohnung' => $points > 0 ? $points . ' Lumipunkte für „Ich bin da“' : null,
], 'info', 'events');
set_flash('success', 'Aktivitätscheck gepostet - die Leute können sich jetzt im Discord zurückmelden.');
redirect('/activity.php?id=' . (int) ($result['check_id'] ?? 0));
@ -90,6 +95,10 @@ try {
admin_log($action === 'cancel' ? '🚫 Aktivitätscheck abgebrochen' : '📋 Aktivitätscheck abgeschlossen', [
'Check' => '#' . $id,
], $action === 'cancel' ? 'warning' : 'success', 'events');
// Lumipunkte gleich vergeben (bzw. beim Abbruch verwerfen) - nicht erst nach Ablauf der Frist
foreach (activity_process_points($id) as $pointsMessage) {
set_flash('success', $pointsMessage);
}
set_flash('success', $action === 'cancel'
? 'Aktivitätscheck abgebrochen - ohne Folgen.'
: (($response['state'] ?? '') === 'closing'

View file

@ -2438,6 +2438,8 @@ a.contribution-card-add:hover { text-decoration: none; }
.contribution-badge-raid { border-color: #d9534f; color: #ff8a86; }
.contribution-badge-event { border-color: var(--discord); color: #9aa3ff; }
.contribution-badge-other { border-color: var(--border); }
.contribution-badge-activity { border-color: var(--success); color: #7ddc8a; }
.contribution-badge-daily { border-color: #c9a227; color: #f3d77a; }
.contribution-award-members { margin-top: 0.4rem; font-size: 0.85rem; }
.contribution-award-members summary { cursor: pointer; color: var(--text-muted); }
@ -2713,6 +2715,17 @@ a.button-small:hover { text-decoration: none; }
.shop-reserved { font-size: 0.75rem; margin-top: 0.1rem; }
.shop-hero-actions { display: flex; flex-direction: column; gap: 0.4rem; }
/* Beide Buttons ("Antraege", "Shop verwalten") gleich breit und hoch */
.shop-hero-actions .button {
display: inline-flex;
align-items: center;
justify-content: center;
width: 11.5rem;
max-width: 100%;
min-height: 2.75rem;
border: 1px solid transparent;
}
.shop-hero-actions .button-secondary { border-color: var(--border); }
.shop-count {
display: inline-block;
@ -2784,6 +2797,28 @@ a.button-small:hover { text-decoration: none; }
/* Antraege */
.shop-orders { display: flex; flex-direction: column; gap: 0.6rem; }
/* Abstand zwischen den Reitern (Offen / Zur Uebergabe / Erledigt) und der Antragsliste */
.filter-tabs + .shop-orders { margin-top: 1rem; }
/* "Meine Antraege" als Kacheln: Bild + Angaben oben, Preis und Knopf unten; Statusfarbe als Linie oben */
.shop-orders-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 0.75rem; }
.shop-orders-tiles .shop-order {
display: grid;
grid-template-columns: auto minmax(0, 1fr);
grid-template-areas: "icon body" "price actions";
align-items: start;
gap: 0.7rem 0.8rem;
border-left-width: 1px;
border-top: 3px solid var(--border);
}
.shop-orders-tiles .shop-order-icon { grid-area: icon; }
.shop-orders-tiles .shop-order-body { grid-area: body; }
.shop-orders-tiles .shop-order-price { grid-area: price; align-self: center; margin-left: 0; }
.shop-orders-tiles .shop-order-actions { grid-area: actions; justify-self: end; align-self: center; margin-left: 0; }
.shop-orders-tiles .shop-order-pending { border-top-color: var(--gold); }
.shop-orders-tiles .shop-order-approved { border-top-color: #5fa8ff; }
.shop-orders-tiles .shop-order-delivered { border-top-color: var(--success); }
.shop-orders-tiles .shop-order-rejected { border-top-color: var(--danger); }
.shop-order {
display: flex;
@ -6192,12 +6227,13 @@ html.has-scroll-progress::-webkit-scrollbar { display: none; }
}
/* ---- Lumishop: Kategorien links, Suche und Gegenstaende rechts ---- */
.shop-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
/* Kategorien und Gegenstandsliste gleich hoch */
.shop-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.25rem; align-items: stretch; }
.shop-layout-single { grid-template-columns: minmax(0, 1fr); }
.shop-layout > .panel { margin-bottom: 0; }
.shop-layout + .panel { margin-top: 1.25rem; }
.shop-categories { position: sticky; top: 1rem; padding: 1rem 0.75rem; }
.shop-categories { padding: 1rem 0.75rem; }
.shop-categories h2 { display: flex; align-items: center; gap: 0.45rem; margin: 0 0.5rem 0.75rem; font-size: 1.05rem; }
.shop-categories h2 .icon { width: 18px; height: 18px; color: var(--gold); }
.shop-category-list { display: flex; flex-direction: column; gap: 0.2rem; }

View file

@ -6,6 +6,9 @@ require_permission('contributions.view');
// Automatische Punkte fuer inzwischen archivierte Raids, bevor die Punktestaende angezeigt werden.
raid_process_auto_points();
// Lumipunkte fuer abgeschlossene Aktivitaetschecks (includes/activity_points.php)
require_once __DIR__ . '/includes/activity_points.php';
activity_process_points();
$canManage = user_has_permission('contributions.manage');
$canViewAll = $canManage || user_has_permission('contributions.view_all');

View file

@ -3,6 +3,7 @@ require_once __DIR__ . '/includes/bootstrap.php';
require_once __DIR__ . '/includes/raids_api.php';
require_once __DIR__ . '/includes/contributions.php';
require_once __DIR__ . '/includes/bugs.php';
require_once __DIR__ . '/includes/activity_points.php';
require_permission('dashboard.view');
$user = current_user();
@ -23,6 +24,9 @@ $roleStmt = db()->prepare(
$roleStmt->execute([$user['id']]);
$roleNames = array_column($roleStmt->fetchAll(), 'name');
// Lumipunkte fuer abgeschlossene Aktivitaetschecks (fragt den Bot nur, wenn eine Frist abgelaufen ist)
activity_process_points();
$upcomingRaids = [];
$raidsError = null;
if ($canViewRaids) {

View file

@ -0,0 +1,142 @@
<?php
declare(strict_types=1);
/**
* Lumipunkte fuer "Ich bin da" beim Aktivitaetscheck.
*
* Den Check selbst verwaltet der Bot (includes/activity_api.php). Die Website merkt sich hier je
* Check die Punkte und vergibt sie einmal, sobald der Check abgeschlossen ist - egal ob er auf der
* Website beendet wurde oder der Bot ihn nach Ablauf der Frist geschlossen hat. Wie bei den
* Raid-Punkten passiert das beim naechsten Aufruf von Dashboard, Lumipunkte- oder Aktivitaetsseite.
*/
require_once __DIR__ . '/activity_api.php';
require_once __DIR__ . '/contributions.php';
/** Punkte fuer einen neuen Check merken (Frist = spaetester Zeitpunkt, ab dem nachgesehen wird). */
function activity_points_save(int $checkId, int $points, int $deadline): void
{
if ($checkId <= 0 || $points <= 0) {
return;
}
db()->prepare(
'INSERT INTO activity_settings (check_id, points_present, deadline_at) VALUES (?, ?, ?)
ON DUPLICATE KEY UPDATE points_present = VALUES(points_present), deadline_at = VALUES(deadline_at)'
)->execute([$checkId, $points, date('Y-m-d H:i:s', $deadline)]);
}
/** @return array{points_present: int, processed_at: ?string, result: ?string}|null */
function activity_points_get(int $checkId): ?array
{
try {
$stmt = db()->prepare('SELECT points_present, processed_at, result FROM activity_settings WHERE check_id = ?');
$stmt->execute([$checkId]);
$row = $stmt->fetch();
} catch (PDOException $e) {
return null;
}
return $row ? ['points_present' => (int) $row['points_present'], 'processed_at' => $row['processed_at'], 'result' => $row['result']] : null;
}
/**
* Offene Punkte vergeben: alle Checks, deren Frist vorbei ist (oder den einen, der gerade auf der
* Website beendet wurde), beim Bot nachsehen und bei "abgeschlossen" die Punkte gutschreiben.
*
* @param int|null $checkId nur diesen Check (sofort, ohne auf die Frist zu warten)
* @param array|null $detail schon geladene Daten des Checks (spart die Abfrage beim Bot)
* @return string[] Meldungen je verarbeitetem Check
*/
function activity_process_points(?int $checkId = null, ?array $detail = null): array
{
try {
$pending = $checkId !== null
? db()->prepare('SELECT check_id, points_present FROM activity_settings WHERE processed_at IS NULL AND check_id = ?')
: db()->prepare('SELECT check_id, points_present FROM activity_settings WHERE processed_at IS NULL AND deadline_at <= NOW()');
$pending->execute($checkId !== null ? [$checkId] : []);
$rows = $pending->fetchAll();
} catch (PDOException $e) {
return []; // Tabelle kommt erst mit dem naechsten Schema-Abgleich
}
$messages = [];
foreach ($rows as $row) {
$id = (int) $row['check_id'];
try {
$check = ($detail !== null && (int) ($detail['check_id'] ?? 0) === $id)
? $detail
: (activity_api_request('GET', '/' . $id)['check'] ?? null);
} catch (Throwable $e) {
continue; // Bot nicht erreichbar - beim naechsten Aufruf erneut
}
$message = activity_award_points($id, (int) $row['points_present'], $check);
if ($message !== '') {
$messages[] = $message;
}
}
return $messages;
}
/** Punkte fuer einen Check gutschreiben (einmalig, per Zeilensperre gegen Doppelvergabe). */
function activity_award_points(int $checkId, int $points, ?array $check): string
{
$status = (string) ($check['status'] ?? '');
if ($check !== null && $status === 'open') {
return ''; // laeuft noch (Frist gerade erst vorbei, der Bot schliesst gleich)
}
$pdo = db();
$pdo->beginTransaction();
$lock = $pdo->prepare('SELECT processed_at FROM activity_settings WHERE check_id = ? FOR UPDATE');
$lock->execute([$checkId]);
if ($lock->fetchColumn() !== null) {
$pdo->commit();
return '';
}
$finish = static function (string $result) use ($pdo, $checkId): string {
$pdo->prepare('UPDATE activity_settings SET processed_at = NOW(), result = ? WHERE check_id = ?')
->execute([mb_substr($result, 0, 255), $checkId]);
$pdo->commit();
return $result;
};
if ($check === null) {
return $finish('Keine Punkte: Der Check existiert beim Bot nicht mehr.');
}
$title = (string) ($check['title'] ?? 'Aktivitätscheck');
if ($status === 'cancelled') {
return $finish('Keine Punkte für „' . $title . '“: Der Check wurde abgebrochen.');
}
// Wer "Ich bin da" gewaehlt hat und ein Website-Konto mit Discord-Verknuepfung besitzt
$discordIds = [];
foreach ($check['responses'] ?? [] as $response) {
if (($response['status'] ?? '') === 'present' && !empty($response['user_id'])) {
$discordIds[] = (string) $response['user_id'];
}
}
$userIds = [];
if ($discordIds) {
$stmt = $pdo->prepare("SELECT id FROM users WHERE status = 'active' AND discord_id IN ("
. implode(',', array_fill(0, count($discordIds), '?')) . ')');
$stmt->execute(array_values(array_unique($discordIds)));
$userIds = array_map('intval', $stmt->fetchAll(PDO::FETCH_COLUMN));
}
if (!$userIds) {
return $finish('Keine Punkte für „' . $title . '“: niemand mit „Ich bin da“ und Website-Konto.');
}
$closedAt = (int) ($check['closed_at'] ?? 0);
$pdo->prepare(
"INSERT INTO contribution_awards (category, title, note, awarded_at, created_by) VALUES ('activity', ?, ?, ?, NULL)"
)->execute([
mb_substr($title, 0, 150),
'Automatisch für „Ich bin da“ beim Aktivitätscheck',
date('Y-m-d H:i:s', $closedAt > 0 ? $closedAt : time()),
]);
$awardId = (int) $pdo->lastInsertId();
$insert = $pdo->prepare('INSERT INTO contribution_entries (award_id, user_id, points) VALUES (?, ?, ?)');
foreach ($userIds as $userId) {
$insert->execute([$awardId, $userId, $points]);
}
return $finish('Lumipunkte für „' . $title . '“ vergeben: ' . count($userIds) . '× +' . $points . '.');
}

View file

@ -22,6 +22,16 @@ const CONTRIBUTION_SYSTEM_CATEGORIES = [
'shop' => 'Lumishop',
];
// Anlaesse, die automatisch entstehen (nicht im Formular waehlbar), sich aber wie normale
// Vergaben auf der Lumipunkte-Seite loeschen lassen.
const CONTRIBUTION_AUTO_CATEGORIES = [
'activity' => 'Aktivitätscheck',
'daily' => 'Tägliche Belohnung',
];
// Taegliche Belohnung: so viele Punkte beim ersten Besuch der Website an einem Tag
const CONTRIBUTION_DAILY_POINTS = 5;
// So viele Plaetze zeigt die Rangliste. Mit contributions.view sieht man nur diese, mit
// contributions.view_all (oder contributions.manage) laesst sich der Rest aufklappen und durchsuchen.
const CONTRIBUTION_PUBLIC_RANKS = 24;
@ -31,7 +41,7 @@ const CONTRIBUTION_MAX_POINTS = 10000;
function contribution_category_label(string $key): string
{
return CONTRIBUTION_CATEGORIES[$key] ?? CONTRIBUTION_SYSTEM_CATEGORIES[$key] ?? $key;
return CONTRIBUTION_CATEGORIES[$key] ?? CONTRIBUTION_SYSTEM_CATEGORIES[$key] ?? CONTRIBUTION_AUTO_CATEGORIES[$key] ?? $key;
}
/** Das Muenz-Symbol der Lumipunkte. */
@ -156,3 +166,50 @@ function contribution_format_time(?string $value): string
$time = $value ? strtotime($value) : false;
return $time ? date('d.m.Y H:i', $time) : '-';
}
/**
* Taegliche Belohnung: beim ersten Seitenaufruf eines Tages CONTRIBUTION_DAILY_POINTS Punkte.
* Pro Tag gibt es eine gemeinsame Vergabe ("Tägliche Belohnung"), an die jedes Mitglied beim
* ersten Besuch angehaengt wird - so bleibt der Verlauf uebersichtlich. Der eindeutige Schluessel
* (award_id, user_id) verhindert doppelte Punkte, auch bei mehreren Tabs oder Geraeten.
*
* @return bool true = gerade gutgeschrieben (fuer die Meldung)
*/
function contribution_daily_reward(int $userId): bool
{
$today = date('Y-m-d');
// Pro Sitzung nur einmal am Tag nachsehen
if (($_SESSION['daily_reward_checked'] ?? '') === $today . ':' . $userId) {
return false;
}
$_SESSION['daily_reward_checked'] = $today . ':' . $userId;
$pdo = db();
try {
$find = $pdo->prepare("SELECT id FROM contribution_awards WHERE category = 'daily' AND awarded_at = ? ORDER BY id LIMIT 1");
$find->execute([$today . ' 00:00:00']);
$awardId = (int) $find->fetchColumn();
if ($awardId === 0) {
// Gleichzeitige erste Besuche des Tages duerfen die Vergabe nicht doppelt anlegen
$pdo->query("SELECT GET_LOCK('lumina_daily_reward', 5)");
$find->execute([$today . ' 00:00:00']);
$awardId = (int) $find->fetchColumn();
if ($awardId === 0) {
$pdo->prepare(
"INSERT INTO contribution_awards (category, title, note, awarded_at, created_by) VALUES ('daily', ?, ?, ?, NULL)"
)->execute([
'Tägliche Belohnung ' . date('d.m.Y'),
'Automatisch beim ersten Besuch der Website an diesem Tag',
$today . ' 00:00:00',
]);
$awardId = (int) $pdo->lastInsertId();
}
$pdo->query("SELECT RELEASE_LOCK('lumina_daily_reward')");
}
$insert = $pdo->prepare('INSERT IGNORE INTO contribution_entries (award_id, user_id, points) VALUES (?, ?, ?)');
$insert->execute([$awardId, $userId, CONTRIBUTION_DAILY_POINTS]);
return $insert->rowCount() > 0;
} catch (PDOException $e) {
return false;
}
}

View file

@ -29,6 +29,13 @@ if ($canViewShop && user_has_permission('shop.manage')) {
$shopPendingCount = 0;
}
}
// Taegliche Belohnung: beim ersten Seitenaufruf des Tages Lumipunkte (includes/contributions.php)
if ($shellUser && user_has_permission('dashboard.view')) {
require_once __DIR__ . '/contributions.php';
if (contribution_daily_reward((int) $shellUser['id'])) {
set_flash('success', '+' . CONTRIBUTION_DAILY_POINTS . ' Lumipunkte - deine tägliche Belohnung. Schön, dass du vorbeischaust!');
}
}
// Eigener Punktestand unten in der Seitenleiste.
$sidebarPoints = null;
if ($canViewContributions && $shellUser) {

View file

@ -11,7 +11,7 @@ declare(strict_types=1);
*/
// Hochzaehlen, sobald unten eine Aenderung dazukommt - dann pruefen alle Sitzungen neu.
const SCHEMA_VERSION = 27;
const SCHEMA_VERSION = 28;
/**
* Tabellen, die nachtraeglich dazugekommen sind: Tabelle => CREATE-Befehl (wie in sql/schema.sql).
@ -19,6 +19,20 @@ const SCHEMA_VERSION = 27;
function schema_table_upgrades(): array
{
return [
// Lumipunkte fuer "Ich bin da" beim Aktivitaetscheck (includes/activity_points.php)
'activity_settings' => <<<'SQL'
CREATE TABLE IF NOT EXISTS activity_settings (
-- ID des Aktivitaetschecks beim Bot
check_id INT UNSIGNED NOT NULL PRIMARY KEY,
-- Lumipunkte fuer "Ich bin da", vergeben nach dem Abschluss (includes/activity_points.php)
points_present INT UNSIGNED NOT NULL DEFAULT 0,
-- Ende der Frist: ab dann wird beim Bot nachgesehen, ob der Check abgeschlossen ist
deadline_at DATETIME NOT NULL,
processed_at DATETIME NULL,
result VARCHAR(255) NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
SQL,
// Bilder an Fehlermeldungen (includes/bugs.php)
'bug_report_images' => <<<'SQL'
CREATE TABLE IF NOT EXISTS bug_report_images (

View file

@ -136,7 +136,7 @@ include __DIR__ . '/includes/header.php';
<?php if (empty($myOrders)): ?>
<p class="text-muted">Du hast noch nichts beantragt.</p>
<?php else: ?>
<div class="shop-orders">
<div class="shop-orders shop-orders-tiles">
<?php foreach ($myOrders as $order): ?>
<?php include __DIR__ . '/includes/shop_order_row.php'; ?>
<?php endforeach; ?>

View file

@ -621,3 +621,16 @@ CREATE TABLE IF NOT EXISTS gear_set_slots (
FOREIGN KEY (set_id) REFERENCES gear_sets(id) ON DELETE CASCADE,
FOREIGN KEY (item_id) REFERENCES gear_items(id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Lumipunkte fuer "Ich bin da" beim Aktivitaetscheck (die Checks selbst liegen beim Bot)
CREATE TABLE IF NOT EXISTS activity_settings (
-- ID des Aktivitaetschecks beim Bot
check_id INT UNSIGNED NOT NULL PRIMARY KEY,
-- Lumipunkte fuer "Ich bin da", vergeben nach dem Abschluss (includes/activity_points.php)
points_present INT UNSIGNED NOT NULL DEFAULT 0,
-- Ende der Frist: ab dann wird beim Bot nachgesehen, ob der Check abgeschlossen ist
deadline_at DATETIME NOT NULL,
processed_at DATETIME NULL,
result VARCHAR(255) NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;