Skip to content

Conversation

@Big-Lolo
Copy link
Member

Els hackers obtinguts, es podran obtindre de forma indivitual amb status( pending, accepted or rejected).
També es podran obtindre amb la forma "grouped" i "nogroup" amb un status per a cada hacker (accepted, rejected, pending)

La idea es que el frontend utilitzi el filte que se li proporciona al lleidahacker per a que filtri resultats. Al mateix temps, l'usuari pot veure el numero de resultats obtinguts (Al admin dashboard)

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.
@Big-Lolo Big-Lolo requested a review from elver5041 February 21, 2025 11:48
@Big-Lolo
Copy link
Member Author

@elver5041 El sistema encara no l'he testejat ja que vaig reinstalar WSL i vaig perdre instalacions de llibreries i tal.
Deixa oberta la pull request fins que trobi com testejar-ho.
Si vols testejar-ho directament a integration, no hi ha cap problema, nomès s'han creat 3 noves funcions sense modificar altres.

Big-Lolo and others added 6 commits February 23, 2025 13:56
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
@Big-Lolo Big-Lolo requested a review from tonlls February 23, 2025 23:01
@Big-Lolo
Copy link
Member Author

En principi funciona perfectament.
Ho he testejat al meu local i retorna correctament les dades llistades i els grups.
S'ha realitzat la peticio del tonlls per a optimitzar el codi.

@Big-Lolo
Copy link
Member Author

IMPORTANT:
Abans de merge, elliminar de la pull request el "pyproject.toml" i el "uv.lock"

@Big-Lolo Big-Lolo requested a review from Copilot June 19, 2025 16:44
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

Adds two new endpoints and utility functions to fetch participants with status and grouping for a HackEPS event, replacing Poetry config with PDM.

  • Introduce get_hacker_status and get_hacker_info helpers in service_utils.py
  • Add get_hackers_participants_list and get_hackers_participants_gruped_list methods in Event/service.py and register routes in router_v1.py
  • Migrate project config from Poetry to PDM in pyproject.toml

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

File Description
src/utils/service_utils.py Added status and info mapping helpers for hackers
src/impl/Event/service.py New service methods to return participants lists
src/impl/Event/router_v1.py New API routes for participants list and grouped list
pyproject.toml Switched build config from Poetry to PDM
Comments suppressed due to low confidence (4)

src/utils/service_utils.py:77

  • [nitpick] Consider renaming attribute_hacker_list to HACKER_ATTRIBUTES (uppercase constant) to follow constant naming conventions.
attribute_hacker_list = [

src/impl/Event/service.py:535

  • The word 'gruped' is misspelled; rename this function (and its route) to get_hackers_participants_grouped_list for consistency.
    def get_hackers_participants_gruped_list(self, event_id: int,

src/impl/Event/service.py:57

  • The comparison operator is split from its operand, causing a syntax error; move >= datetime(year, 1, 1) onto the same line as Event.start_date within the filter call.
            >= datetime(year, 1, 1), Event.end_date

pyproject.toml:1

  • [nitpick] The authors field appears both in tool.pdm.build and under [project]; remove any unused or duplicated configuration sections.
[tool.pdm.build]

Comment on lines 521 to 531
output_data = []

participants_list = [
get_hacker_info(hacker, pending_hackers_ids, accepted_hackers_ids,
rejected_hackers_ids)
for hacker in registered_hackers
]

output_data.append(participants_list)
# Combine group and nogroup data into a dictionary
return {"participants": output_data}
Copy link

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

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

Wrapping participants_list in another list results in a nested array in the response; return participants_list directly instead of appending it to output_data.

Suggested change
output_data = []
participants_list = [
get_hacker_info(hacker, pending_hackers_ids, accepted_hackers_ids,
rejected_hackers_ids)
for hacker in registered_hackers
]
output_data.append(participants_list)
# Combine group and nogroup data into a dictionary
return {"participants": output_data}
participants_list = [
get_hacker_info(hacker, pending_hackers_ids, accepted_hackers_ids,
rejected_hackers_ids)
for hacker in registered_hackers
]
# Combine group and nogroup data into a dictionary
return {"participants": participants_list}

Copilot uses AI. Check for mistakes.
Comment on lines 561 to 563
subtract_lists(
pending_hackers_ids + accepted_hackers_ids +
rejected_hackers_ids, group_users), [])
Copy link

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

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

The second subtract_lists call against an empty list has no effect; you can remove that extra call to simplify the expression.

Suggested change
subtract_lists(
pending_hackers_ids + accepted_hackers_ids +
rejected_hackers_ids, group_users), [])
pending_hackers_ids + accepted_hackers_ids +
rejected_hackers_ids, group_users)

Copilot uses AI. Check for mistakes.
Comment on lines 560 to 563
non_group_hackers_ids = subtract_lists(
subtract_lists(
pending_hackers_ids + accepted_hackers_ids +
rejected_hackers_ids, group_users), [])
Copy link

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

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

Using subtract_lists (which does a list in check) on large lists can be slow; consider using set operations for difference to improve performance.

Suggested change
non_group_hackers_ids = subtract_lists(
subtract_lists(
pending_hackers_ids + accepted_hackers_ids +
rejected_hackers_ids, group_users), [])
non_group_hackers_ids = list(
set(pending_hackers_ids + accepted_hackers_ids + rejected_hackers_ids) - set(group_users)
)

Copilot uses AI. Check for mistakes.
Big-Lolo and others added 3 commits October 21, 2025 12:41
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Big-Lolo Big-Lolo requested a review from Copilot October 21, 2025 10:46
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

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


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

Big-Lolo and others added 5 commits October 21, 2025 12:48
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>
Copy link
Member Author

@Big-Lolo Big-Lolo left a comment

Choose a reason for hiding this comment

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

All correct

@Big-Lolo Big-Lolo merged commit 0724819 into integration Oct 21, 2025
3 of 4 checks passed
@Big-Lolo Big-Lolo deleted the BACK-95-get-hackers-participants-list-with-status branch October 21, 2025 10:58
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