Add leaderboard stats, periodic updates via fastapi-utils (#724)

* add leaderboard stats, periodic update via fastapi-utils

* count label tasks for assistant and prompter replies

* Daily stats update every 15 mins, simplify leaderboard endpoint

* add indices for some created_date columns

* make user stats update intervals configurable

* make sure intervals are positive
This commit is contained in:
Andreas Köpf
2023-01-15 12:04:19 +01:00
committed by GitHub
parent e01f2eb4ab
commit b5bb5bb7c0
21 changed files with 555 additions and 61 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ from uuid import UUID, uuid4
import sqlalchemy as sa
import sqlalchemy.dialects.postgresql as pg
from oasst_shared.utils import utcnow
from sqlalchemy import false
from sqlmodel import Field, SQLModel
@@ -35,4 +36,4 @@ class Task(SQLModel, table=True):
@property
def expired(self) -> bool:
return self.expiry_date is not None and datetime.utcnow() > self.expiry_date
return self.expiry_date is not None and utcnow() > self.expiry_date