mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-17 11:23:49 +08:00
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from uuid import UUID
|
|
|
|
import sqlalchemy as sa
|
|
import sqlalchemy.dialects.postgresql as pg
|
|
from sqlmodel import Field, SQLModel
|
|
|
|
|
|
class PersonStats(SQLModel, table=True):
|
|
__tablename__ = "person_stats"
|
|
|
|
person_id: Optional[UUID] = Field(
|
|
sa_column=sa.Column(pg.UUID(as_uuid=True), sa.ForeignKey("person.id"), primary_key=True)
|
|
)
|
|
leader_score: int = 0
|
|
modified_date: Optional[datetime] = Field(
|
|
sa_column=sa.Column(sa.DateTime(), nullable=False, server_default=sa.func.current_timestamp())
|
|
)
|
|
|
|
reactions: int = 0 # reactions sent by user
|
|
posts: int = 0 # posts sent by user
|
|
upvotes: int = 0 # received upvotes (form other users)
|
|
downvotes: int = 0 # received downvotes (from other users)
|
|
work_reward: int = 0 # reward for workpackage completions
|
|
compare_wins: int = 0 # num times user's post won compare tasks
|
|
compare_losses: int = 0 # num times users's post lost compare tasks
|