From 377e483ff5e78653fc34c5d5bc0534bbea31900b Mon Sep 17 00:00:00 2001 From: jl Date: Sun, 12 Oct 2025 23:14:58 +0800 Subject: [PATCH 1/2] feat(evaluations): add new questions and fix endpoints to accept pycon specific questions --- backend/controller/evaluation_router.py | 13 +++--- backend/model/evaluations/evaluation.py | 10 +++-- .../evaluations/evaluations_constants.py | 42 +++++++++++++++++++ 3 files changed, 57 insertions(+), 8 deletions(-) diff --git a/backend/controller/evaluation_router.py b/backend/controller/evaluation_router.py index 534ecc77..f9c9e381 100644 --- a/backend/controller/evaluation_router.py +++ b/backend/controller/evaluation_router.py @@ -1,4 +1,4 @@ -from typing import List +from typing import List, Union from constants.common_constants import CommonConstants from fastapi import APIRouter, Path, Query @@ -9,7 +9,10 @@ EvaluationOut, EvaluationPatch, ) -from model.evaluations.evaluations_constants import EvaluationQuestionType +from model.evaluations.evaluations_constants import ( + EvaluationQuestionType, + PyconEvaluationQuestionType, +) from usecase.evaluation_usecase import EvaluationUsecase evaluation_router = APIRouter() @@ -69,7 +72,7 @@ def get_evaluations( ) def get_evaluations_by_question( event_id: str = Path(..., title='Event Id', alias=CommonConstants.EVENT_ID), - question: EvaluationQuestionType = Path(..., title='Question'), + question: Union[EvaluationQuestionType, PyconEvaluationQuestionType] = Path(..., title='Question'), ): """Get Evaluation Entries by Question @@ -106,7 +109,7 @@ def get_evaluations_by_question( def get_evaluation( event_id: str = Path(..., title='Event Id', alias=CommonConstants.EVENT_ID), registration_id: str = Path(..., title='Registration Id', alias=CommonConstants.REGISTRATION_ID), - question: EvaluationQuestionType = Query(..., title='Question'), + question: Union[EvaluationQuestionType, PyconEvaluationQuestionType] = Query(..., title='Question'), ): """Get Evaluation Entry @@ -180,7 +183,7 @@ def update_evaluation( evaluation: EvaluationPatch, event_id: str = Path(..., title='Event Id', alias=CommonConstants.EVENT_ID), registration_id: str = Query(..., title='Registration Id'), - question: EvaluationQuestionType = Query(..., title='Question'), + question: Union[EvaluationQuestionType, PyconEvaluationQuestionType] = Query(..., title='Question'), ): """Update Evaluation Entry diff --git a/backend/model/evaluations/evaluation.py b/backend/model/evaluations/evaluation.py index e5d1bd7c..7e762c85 100644 --- a/backend/model/evaluations/evaluation.py +++ b/backend/model/evaluations/evaluation.py @@ -1,8 +1,12 @@ import os from datetime import datetime -from typing import List +from typing import List, Union -from model.evaluations.evaluations_constants import EvaluationQuestionType, QuestionType +from model.evaluations.evaluations_constants import ( + EvaluationQuestionType, + PyconEvaluationQuestionType, + QuestionType, +) from model.registrations.registration import RegistrationPreviewOut from pydantic import BaseModel, Extra, Field from pynamodb.attributes import ( @@ -71,7 +75,7 @@ class EvaluationIn(EvaluationPatch): class Config: extra = Extra.forbid - question: EvaluationQuestionType = Field(None, title='Question') + question: Union[EvaluationQuestionType, PyconEvaluationQuestionType] = Field(None, title='Question') class EvaluationListIn(BaseModel): diff --git a/backend/model/evaluations/evaluations_constants.py b/backend/model/evaluations/evaluations_constants.py index 12d4a772..810b663a 100644 --- a/backend/model/evaluations/evaluations_constants.py +++ b/backend/model/evaluations/evaluations_constants.py @@ -14,6 +14,48 @@ class EvaluationQuestionType(str, Enum): NOTIFIED_OF_FUTURE_EVENTS = 'notified_of_future_events' +class PyconEvaluationQuestionType(str, Enum): + HOW_WOULD_YOU_RATE_PYCON_DAVAO_OVERALL = 'how_would_you_rate_pycon_davao_overall' # (1-5) + WhAT_WAS_THE_HIGHLIGHT_OF_THE_EVENT_FOR_YOU = 'what_was_the_highlight_of_the_event_for_you' # Text + IS_THERE_ANYTHING_SPECIFIC_YOU_WOULD_LIKE_TO_COMMEND_ABOUT_THE_EVENT = ( + 'is_there_anything_specific_you_would_like_to_commend_about_the_event' # Text + ) + HOW_SATISFIED_WERE_YOU_WITH_THE_CONTENT_AND_PRESENTATIONS = ( + 'how_satisfied_were_you_with_the_content_and_presentations' # (1-5) + ) + WHICH_SESSIONS_OR_TOPICS_DID_YOU_FIND_MOST_VALUABLE = 'which_sessions_or_topics_did_you_find_most_valuable' # Text + WERE_THERE_ANY_TOPICS_OR_SESSIONS_YOU_FELT_WERE_MISSING = ( + 'were_there_any_topics_or_sessions_you_felt_were_missing' # Text + ) + HAVE_YOU_ATTENDED_PYTHON_EVENTS_BEFORE = 'have_you_attended_python_events_before_if_so_what_kind_of_community_support_did_you_find_helpful_in_previous_events' # Text + HOW_LIKELY_ARE_YOU_TO_RECOMMEND_THIS_EVENT = 'how_likely_are_you_to_recommend_this_event_to_other_python_developers_or_enthusiasts_based_on_the_community_support_provided' # (1-5) + # Organization and Logistics + HOW_WOULD_YOU_RATE_EVENT_ORGANIZATION_AND_LOGISTICS = 'how_would_you_rate_event_organization_and_logistics' # (1-5) + WERE_THE_EVENT_SCHEDULE_AND_TIMING_CONVENIENT_FOR_YOU = ( + 'were_the_event_schedule_and_timing_convenient_for_you' # (1-5) + ) + WERE_THE_VENUE_FACILITIES_ADEQUATE = 'were_the_venue_facilities_adequate' # (1-5) + DID_YOU_ENCOUNTER_ANY_PROBLEMS_WITH_THE_ORGANIZATION_AND_LOGISTICS = ( + 'did_you_encounter_any_problems_with_the_organization_and_logistics' # Text + ) + # Networking and Interaction + DID_YOU_FIND_OPPORTUNITIES_FOR_NETWORKING_VALUABLE = 'did_you_find_opportunities_for_networking_valuable' # (1-5) + HOW_WOULD_YOU_RATE_THE_NETWORKING_OPPORTUNITIES_PROVIDED = ( + 'how_would_you_rate_the_networking_opportunities_provided' # (1-5) + ) + WHAT_COULD_HAVE_BEEN_IMPROVED_RELATED_TO_THE_NETWORKING = ( + 'what_could_have_been_improved_related_to_the_networking_and_interaction_aspects_of_the_event' # Text + ) + # Suggestions and Improvements + SUGGESTIONS_FOR_IMPROVING_FUTURE_PYCON_EVENTS = ( + 'what_suggestions_do_you_have_for_improving_future_pycon_events' # Text + ) + ADDITIONAL_COMMENTS = 'is_there_anything_else_you_would_like_to_share_about_your_experience_at_the_event' # Text + LIKELIHOOD_OF_ATTENDING_FUTURE_PYCON_DAVAO_EVENTS = ( + 'how_likely_are_you_to_attend_future_pycon_davao_events' # (1-5) + ) + + class QuestionType(str, Enum): MULTIPLE_CHOICE = 'multiple_choice' TEXT = 'text' From 0a34e792aa2e78c703eea0ac51f8dbe3a951b0ec Mon Sep 17 00:00:00 2001 From: jl Date: Mon, 13 Oct 2025 15:06:22 +0800 Subject: [PATCH 2/2] fix: remove comments and fix typo --- .../evaluations/evaluations_constants.py | 49 +++++++------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/backend/model/evaluations/evaluations_constants.py b/backend/model/evaluations/evaluations_constants.py index 810b663a..34aa1656 100644 --- a/backend/model/evaluations/evaluations_constants.py +++ b/backend/model/evaluations/evaluations_constants.py @@ -15,45 +15,34 @@ class EvaluationQuestionType(str, Enum): class PyconEvaluationQuestionType(str, Enum): - HOW_WOULD_YOU_RATE_PYCON_DAVAO_OVERALL = 'how_would_you_rate_pycon_davao_overall' # (1-5) - WhAT_WAS_THE_HIGHLIGHT_OF_THE_EVENT_FOR_YOU = 'what_was_the_highlight_of_the_event_for_you' # Text + HOW_WOULD_YOU_RATE_PYCON_DAVAO_OVERALL = 'how_would_you_rate_pycon_davao_overall' + WHAT_WAS_THE_HIGHLIGHT_OF_THE_EVENT_FOR_YOU = 'what_was_the_highlight_of_the_event_for_you' IS_THERE_ANYTHING_SPECIFIC_YOU_WOULD_LIKE_TO_COMMEND_ABOUT_THE_EVENT = ( - 'is_there_anything_specific_you_would_like_to_commend_about_the_event' # Text + 'is_there_anything_specific_you_would_like_to_commend_about_the_event' ) HOW_SATISFIED_WERE_YOU_WITH_THE_CONTENT_AND_PRESENTATIONS = ( - 'how_satisfied_were_you_with_the_content_and_presentations' # (1-5) - ) - WHICH_SESSIONS_OR_TOPICS_DID_YOU_FIND_MOST_VALUABLE = 'which_sessions_or_topics_did_you_find_most_valuable' # Text - WERE_THERE_ANY_TOPICS_OR_SESSIONS_YOU_FELT_WERE_MISSING = ( - 'were_there_any_topics_or_sessions_you_felt_were_missing' # Text - ) - HAVE_YOU_ATTENDED_PYTHON_EVENTS_BEFORE = 'have_you_attended_python_events_before_if_so_what_kind_of_community_support_did_you_find_helpful_in_previous_events' # Text - HOW_LIKELY_ARE_YOU_TO_RECOMMEND_THIS_EVENT = 'how_likely_are_you_to_recommend_this_event_to_other_python_developers_or_enthusiasts_based_on_the_community_support_provided' # (1-5) - # Organization and Logistics - HOW_WOULD_YOU_RATE_EVENT_ORGANIZATION_AND_LOGISTICS = 'how_would_you_rate_event_organization_and_logistics' # (1-5) - WERE_THE_EVENT_SCHEDULE_AND_TIMING_CONVENIENT_FOR_YOU = ( - 'were_the_event_schedule_and_timing_convenient_for_you' # (1-5) - ) - WERE_THE_VENUE_FACILITIES_ADEQUATE = 'were_the_venue_facilities_adequate' # (1-5) + 'how_satisfied_were_you_with_the_content_and_presentations' + ) + WHICH_SESSIONS_OR_TOPICS_DID_YOU_FIND_MOST_VALUABLE = 'which_sessions_or_topics_did_you_find_most_valuable' + WERE_THERE_ANY_TOPICS_OR_SESSIONS_YOU_FELT_WERE_MISSING = 'were_there_any_topics_or_sessions_you_felt_were_missing' + HAVE_YOU_ATTENDED_PYTHON_EVENTS_BEFORE = 'have_you_attended_python_events_before_if_so_what_kind_of_community_support_did_you_find_helpful_in_previous_events' + HOW_LIKELY_ARE_YOU_TO_RECOMMEND_THIS_EVENT = 'how_likely_are_you_to_recommend_this_event_to_other_python_developers_or_enthusiasts_based_on_the_community_support_provided' + HOW_WOULD_YOU_RATE_EVENT_ORGANIZATION_AND_LOGISTICS = 'how_would_you_rate_event_organization_and_logistics' + WERE_THE_EVENT_SCHEDULE_AND_TIMING_CONVENIENT_FOR_YOU = 'were_the_event_schedule_and_timing_convenient_for_you' + WERE_THE_VENUE_FACILITIES_ADEQUATE = 'were_the_venue_facilities_adequate' DID_YOU_ENCOUNTER_ANY_PROBLEMS_WITH_THE_ORGANIZATION_AND_LOGISTICS = ( - 'did_you_encounter_any_problems_with_the_organization_and_logistics' # Text + 'did_you_encounter_any_problems_with_the_organization_and_logistics' ) - # Networking and Interaction - DID_YOU_FIND_OPPORTUNITIES_FOR_NETWORKING_VALUABLE = 'did_you_find_opportunities_for_networking_valuable' # (1-5) + DID_YOU_FIND_OPPORTUNITIES_FOR_NETWORKING_VALUABLE = 'did_you_find_opportunities_for_networking_valuable' HOW_WOULD_YOU_RATE_THE_NETWORKING_OPPORTUNITIES_PROVIDED = ( - 'how_would_you_rate_the_networking_opportunities_provided' # (1-5) + 'how_would_you_rate_the_networking_opportunities_provided' ) WHAT_COULD_HAVE_BEEN_IMPROVED_RELATED_TO_THE_NETWORKING = ( - 'what_could_have_been_improved_related_to_the_networking_and_interaction_aspects_of_the_event' # Text - ) - # Suggestions and Improvements - SUGGESTIONS_FOR_IMPROVING_FUTURE_PYCON_EVENTS = ( - 'what_suggestions_do_you_have_for_improving_future_pycon_events' # Text - ) - ADDITIONAL_COMMENTS = 'is_there_anything_else_you_would_like_to_share_about_your_experience_at_the_event' # Text - LIKELIHOOD_OF_ATTENDING_FUTURE_PYCON_DAVAO_EVENTS = ( - 'how_likely_are_you_to_attend_future_pycon_davao_events' # (1-5) + 'what_could_have_been_improved_related_to_the_networking_and_interaction_aspects_of_the_event' ) + SUGGESTIONS_FOR_IMPROVING_FUTURE_PYCON_EVENTS = 'what_suggestions_do_you_have_for_improving_future_pycon_events' + ADDITIONAL_COMMENTS = 'is_there_anything_else_you_would_like_to_share_about_your_experience_at_the_event' + LIKELIHOOD_OF_ATTENDING_FUTURE_PYCON_DAVAO_EVENTS = 'how_likely_are_you_to_attend_future_pycon_davao_events' class QuestionType(str, Enum):