iteration 1: report with game table, /getgamers state screen, silent-30-days prompt, /today as one message, stats port bound to localhost
- periodic report rebuilt in HTML: title with games count, mode lines, one <pre> table (± · colour · accuracy · opponent rating · opponent accuracy), 10-row cap, span note after catch-up; stats service returns tracked_rating_diff per game - /getgamers shows player state from the DB (played today / N days quiet / closed / not found, report period) without Lichess calls; ratings on a button - "player silent 30 days — keep?" prompt with keep/delete buttons, repeat 90 days - /today, /yesterday, /week: one message edited into the result, nav buttons - /year localised; active-gamer leftovers and N/A removed; one period wording - docker-compose.prod.yml: stats port 8002 bound to 127.0.0.1 - product review docs: user journeys, concepts, Mini App feasibility, proposal Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
1bb779d71d
commit
df6b582376
23 changed files with 3412 additions and 897 deletions
|
|
@ -183,11 +183,33 @@ class DatabaseTests(unittest.TestCase):
|
|||
|
||||
def test_pair_check_state(self):
|
||||
a = self.ids()['Alpha']
|
||||
self.assertEqual({'last_games_total': None, 'closed_notice_sent': False}, self.db.get_pair_check_state(1, a))
|
||||
empty = {'last_games_total': None, 'closed_notice_sent': False, 'silent_prompt_at': None}
|
||||
self.assertEqual(empty, self.db.get_pair_check_state(1, a))
|
||||
self.db.set_pair_last_games_total(1, a, 42)
|
||||
self.db.set_pair_closed_notice_sent(1, a, True)
|
||||
self.assertEqual({'last_games_total': 42, 'closed_notice_sent': True}, self.db.get_pair_check_state(1, a))
|
||||
self.assertEqual({'last_games_total': None, 'closed_notice_sent': False}, self.db.get_pair_check_state(9, a))
|
||||
self.db.set_pair_silent_prompt_at(1, a, 1_800_000_000)
|
||||
self.assertEqual({'last_games_total': 42, 'closed_notice_sent': True, 'silent_prompt_at': 1_800_000_000},
|
||||
self.db.get_pair_check_state(1, a))
|
||||
self.db.set_pair_silent_prompt_at(1, a, None)
|
||||
self.assertIsNone(self.db.get_pair_check_state(1, a)['silent_prompt_at'])
|
||||
self.assertEqual(empty, self.db.get_pair_check_state(9, a))
|
||||
with sqlite3.connect(self.path) as conn:
|
||||
cols = {row[1] for row in conn.execute("PRAGMA table_info(user_gamers)")}
|
||||
self.assertIn('silent_prompt_at', cols)
|
||||
|
||||
def test_gamer_statuses_bulk_and_username(self):
|
||||
ids = self.ids()
|
||||
a, b, c = ids['Alpha'], ids['Bravo'], ids['Charlie']
|
||||
self.assertEqual({}, self.db.get_gamer_statuses([]))
|
||||
self.assertEqual({}, self.db.get_gamer_statuses([a, b]))
|
||||
self.db.upsert_gamer_statuses([{'gamer_id': a, 'disabled': False, 'seen_at': 5, 'games_total': 10, 'checked_at': 100},
|
||||
{'gamer_id': c, 'disabled': True, 'seen_at': None, 'games_total': 1, 'checked_at': 100}])
|
||||
statuses = self.db.get_gamer_statuses([a, b, c])
|
||||
self.assertEqual({a, c}, set(statuses)) # Bravo has no row
|
||||
self.assertEqual(self.db.get_gamer_status(a), statuses[a])
|
||||
self.assertEqual(self.db.get_gamer_status(c), statuses[c])
|
||||
self.assertEqual('Alpha', self.db.get_gamer_username(a))
|
||||
self.assertIsNone(self.db.get_gamer_username(10 ** 6))
|
||||
|
||||
def test_remove_user_gamer_cascade(self):
|
||||
ids = self.ids()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue