Skip to content

Commit

Permalink
Merge pull request #41 from milselarch/feat/add_callback_contexts
Browse files Browse the repository at this point in the history
fix: reinstate PollInfo as a dataclass
  • Loading branch information
milselarch authored Nov 17, 2024
2 parents 68a6c5d + 066fd33 commit a5f6cca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions base_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,20 @@ class UserRegistrationStatus(StrEnum):
FAILED = 'FAILED'


@dataclasses.dataclass
class PollInfo(object):
metadata: PollMetadata
# description of each option within the poll
poll_options: List[str]
# numerical ranking of each option within the poll
option_numbers: List[int]

def __init__(
self, metadata: PollMetadata,
poll_options: List[str], option_numbers: List[int]
):
assert len(poll_options) == len(option_numbers)
# description of each option within the poll
self.poll_options: List[str] = poll_options
# numerical ranking of each option within the poll
self.option_numbers: List[int] = option_numbers
self.metadata: PollMetadata = metadata

Expand Down
2 changes: 1 addition & 1 deletion helpers/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from helpers.commands import Command

__VERSION__ = '1.2.0'
__VERSION__ = '1.2.1'

POLL_ID_GET_PARAM = 'poll_id'
WHITELIST_POLL_ID_GET_PARAM = 'whitelist_poll'
Expand Down
2 changes: 1 addition & 1 deletion webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import dataclasses

from load_config import *
from base_api import BaseAPI
from base_api import BaseAPI, PollInfo
from database.database import Users

from fastapi import FastAPI, APIRouter
Expand Down

0 comments on commit a5f6cca

Please sign in to comment.