mirror of
https://github.com/pupperpowell/bibdle.git
synced 2026-04-05 17:33:31 -04:00
27 lines
814 B
Bash
Executable File
27 lines
814 B
Bash
Executable File
#!/bin/zsh
|
||
|
||
# Seed the database with 10 fake completions with random anonymous_ids
|
||
# Useful for testing streak percentile and stats features
|
||
|
||
DB_PATH="dev.db"
|
||
TODAY=$(date +%Y-%m-%d)
|
||
NOW=$(date +%s)
|
||
|
||
echo "Seeding 10 fake completions for date: $TODAY"
|
||
|
||
for i in {1..50}; do
|
||
ID=$(uuidgen | tr '[:upper:]' '[:lower:]')
|
||
ANON_ID=$(uuidgen | tr '[:upper:]' '[:lower:]')
|
||
GUESS_COUNT=$(( (RANDOM % 6) + 1 )) # 1–6 guesses
|
||
|
||
sqlite3 "$DB_PATH" "
|
||
INSERT OR IGNORE INTO daily_completions (id, anonymous_id, date, guess_count, completed_at)
|
||
VALUES ('$ID', '$ANON_ID', '$TODAY', $GUESS_COUNT, $NOW);
|
||
"
|
||
|
||
echo " [$i] anon=$ANON_ID guesses=$GUESS_COUNT"
|
||
done
|
||
|
||
TOTAL=$(sqlite3 "$DB_PATH" "SELECT COUNT(*) FROM daily_completions WHERE date = '$TODAY';")
|
||
echo "✓ Done. Total completions for $TODAY: $TOTAL"
|