Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tocfl quiz #105

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions commands/tocfl/quiz.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ async def tocfl_quiz_pronunciation(
num_rows: Choice[int] = 4,
is_private: bool = False,
):
num_rows = num_rows.value if isinstance(num_rows, Choice) else num_rows
# get random choices from the database
choices = get_random_tocfl_choices_from_db(num_choices=num_rows)
# convert to DataFrame
Expand All @@ -90,6 +91,7 @@ async def tocfl_quiz_vocab(
num_rows: Choice[int] = 4,
is_private: bool = False,
):
num_rows = num_rows.value if isinstance(num_rows, Choice) else num_rows
# get random choices from the database
choices = get_random_tocfl_choices_from_db(num_choices=num_rows)
# convert to DataFrame
Expand Down
4 changes: 2 additions & 2 deletions modules/quiz/multiple_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, label: str, is_correct: bool):


class MultipleChoiceView(discord.ui.View):
def __init__(self, choices: list[QuizChoice]):
super().__init__()
def __init__(self, choices: list[QuizChoice], timeout: int = 300):
super().__init__(timeout=timeout)
for i, choice in enumerate(choices):
self.add_item(QuizMultipleChoiceButton(i, 0, choice.label, choice.is_correct))
Loading