[GENERAL] Selecting a daily puzzle record - which type of column to add?

Поиск
Список
Период
Сортировка
От Alexander Farber
Тема [GENERAL] Selecting a daily puzzle record - which type of column to add?
Дата
Msg-id CAADeyWhxdCO4GKHnmS9FXFCO745eQ+6_nDj2jQVF0xWLJZjrTA@mail.gmail.com
обсуждение исходный текст
Ответы Re: [GENERAL] Selecting a daily puzzle record - which type of columnto add?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: [GENERAL] Selecting a daily puzzle record - which type of columnto add?  (Berend Tober <btober@computer.org>)
Список pgsql-general
Good evening,

In a word game I store all player moves in the table:

CREATE TYPE words_action AS ENUM (
        'play',
        'skip',
        'swap',
        'resign',
        'ban',
        'expire'
);

CREATE TABLE words_moves (
        mid     BIGSERIAL PRIMARY KEY,
        action  words_action NOT NULL,
        gid     integer NOT NULL REFERENCES words_games ON DELETE CASCADE,
        uid     integer NOT NULL REFERENCES words_users ON DELETE CASCADE,
        played  timestamptz NOT NULL,
        tiles   jsonb,
        score   integer CHECK(score >= 0)
);

I could run a cron job on all moves played each day and select the "spectacular" ones by it, i.e. when a very big score has been achieved in the move or all 7 tiles have been played...

Then I (as admin of the game) would manually review the daily mails sent by that cronjob and select the few I have found interesting - for later publishing them as "daily puzzle" in my day.

However I don't want to do the reviewing every day as that would be tedious, but more like once per week and then select several such moves at once (for the future dates).

My question (and thanks for reading my mail sofar) is: which column would you add to the words_moves table for such a purpose?

If I add a boolean (is a daily puzzle move: true or false) - then it is difficult to keep the order of the daily puzzles, I think.

If I add a timestamptz, then to which date to set it, when I do my manual review once a week?

I need to add a useful column, so that it would be easy to me to create a web script which would display today's and all past "daily puzzle" records - and wouldn't change the already published puzzles...

If you have a good idea here, please share with me. If not, sorry for the maybe offtopic question.

Thanks
Alex

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Remove useless joins (VARCHAR vs TEXT)
Следующее
От: Rob Nikander
Дата:
Сообщение: [GENERAL] advisory locks namespace?