Skip to content

Integration#328

Merged
Big-Lolo merged 28 commits intomainfrom
integration
Oct 21, 2025
Merged

Integration#328
Big-Lolo merged 28 commits intomainfrom
integration

Conversation

@Big-Lolo
Copy link
Member

No description provided.

Big-Lolo and others added 27 commits February 21, 2025 12:40
Created two services to return a list of participants with a status.
Now we don't need to use 4 services to get accepted, rejected, pending and pendingGrouped. With this two services, the idea is to list ans clasyfy in frontend using status field.

function in service_utils is to clasify id fast.
Creada funció amb lambda per tal de retorna de forma directa la estructura a retorna juntament amb el status de cada hacker.

Implementat aixo en 1 servei, per a testejar. Si funciona correctament, s'implementarà en el servei restant
S'ha optimitzat el codi utilitzant una lambda function per tal definida al service_utils per tal de retornar la estructura de les dades sense repetirles continuament.

S'ha arreglat un error on en ves de crear la estructura a partir de hackers, es creaba a partir de la hacker id buscant atributs que no es podrien trobar.

Actualitzat el gitignore per a no incloure el pyproject.toml i el uv.lock
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nts-list-with-status

Creat 2 serveis per a obtindre llistat de participants clasificats per status
Co-authored-by: Big-Lolo <95545807+Big-Lolo@users.noreply.github.com>
Fix missing get_hacker_info import causing new routers to fail
@Big-Lolo Big-Lolo requested a review from Copilot October 21, 2025 17:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds functionality to retrieve participant lists for events with their status (pending, accepted, or rejected). The changes introduce utility functions to determine hacker status and extract hacker information, along with two new API endpoints for retrieving participant lists in both grouped and ungrouped formats.

Key Changes

  • Added utility functions get_hacker_status and get_hacker_info to determine and extract hacker information with status
  • Implemented two new service methods to retrieve participant lists in grouped and ungrouped formats
  • Added two new router endpoints to expose the participant list functionality

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/utils/service_utils.py Added utility functions for determining hacker status and extracting hacker information with a predefined attribute list
src/impl/Event/service.py Implemented two new service methods for retrieving participant lists and updated imports to include new utility functions
src/impl/Event/router_v1.py Added two new GET endpoints for accessing grouped and ungrouped participant lists

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

"shirt_size",
]

def get_hacker_info(hacker, pending_hackers_ids, accepted_hackers_ids, rejected_hackers_ids):
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function parameters lack type hints. Consider adding type hints for hacker (likely a Hacker model object) and the ID list parameters (List[int]) to improve code clarity and enable better IDE support.

Copilot uses AI. Check for mistakes.
Comment on lines +64 to +65
def get_hacker_status(hacker_id, pending_hackers_ids, accepted_hackers_ids,
rejected_hackers_ids):
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function parameters lack type hints. Consider adding type hints for all parameters to improve code clarity and enable better static type checking.

Copilot uses AI. Check for mistakes.
@BaseService.needs_service("HackerGroupService")
def get_hackers_participants_list(
self, event_id: int, data: BaseToken
): ##Servei per obtindre la llista de participants amb status acceptat, rechazat o pending.
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'rechazat' to 'rebutjat' (Catalan) or 'rechazado' (Spanish), and 'obtindre' to 'obtenir' (Catalan) or 'obtener' (Spanish).

Suggested change
): ##Servei per obtindre la llista de participants amb status acceptat, rechazat o pending.
): ##Servei per obtenir la llista de participants amb status acceptat, rebutjat o pending.

Copilot uses AI. Check for mistakes.
@BaseService.needs_service("HackerGroupService")
def get_hackers_participants_list(
self, event_id: int, data: BaseToken
): ##Servei per obtindre la llista de participants amb status acceptat, rechazat o pending.
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a proper docstring instead of an inline comment for function documentation. This comment should be formatted as a docstring below the function signature, similar to other methods in the file.

Suggested change
): ##Servei per obtindre la llista de participants amb status acceptat, rechazat o pending.
):
"""
Servei per obtindre la llista de participants amb status acceptat, rechazat o pending.
"""

Copilot uses AI. Check for mistakes.
Comment on lines +573 to +584
pending_hackers_ids = [
h.id
for h in subtract_lists(
subtract_lists(event.registered_hackers, event.accepted_hackers),
event.rejected_hackers,
)
]
registered_hackers = event.registered_hackers
# Accepted hackers
accepted_hackers_ids = [h.id for h in event.accepted_hackers]
# Rejected hackers
rejected_hackers_ids = [h.id for h in event.rejected_hackers]
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This nested subtract_lists operation is inefficient and duplicated across both new methods. The logic performs list membership checks (O(n)) for each element. Consider creating a helper function or using set operations for better performance: set(registered) - set(accepted) - set(rejected).

Suggested change
pending_hackers_ids = [
h.id
for h in subtract_lists(
subtract_lists(event.registered_hackers, event.accepted_hackers),
event.rejected_hackers,
)
]
registered_hackers = event.registered_hackers
# Accepted hackers
accepted_hackers_ids = [h.id for h in event.accepted_hackers]
# Rejected hackers
rejected_hackers_ids = [h.id for h in event.rejected_hackers]
registered_hackers = event.registered_hackers
accepted_hackers_ids = {h.id for h in event.accepted_hackers}
rejected_hackers_ids = {h.id for h in event.rejected_hackers}
registered_hackers_ids = {h.id for h in registered_hackers}
pending_hackers_ids = list(registered_hackers_ids - accepted_hackers_ids - rejected_hackers_ids)

Copilot uses AI. Check for mistakes.
Comment on lines +603 to +609
pending_hackers_ids = [
h.id
for h in subtract_lists(
subtract_lists(event.registered_hackers, event.accepted_hackers),
event.rejected_hackers,
)
]
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic for computing pending_hackers_ids is duplicated from the get_hackers_participants_list method (lines 573-579). Consider extracting this into a private helper method to avoid code duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
@Big-Lolo Big-Lolo merged commit ac97859 into main Oct 21, 2025
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants