Skip to content

feat: add ANAF GDPR flag conversion and include in CSV export #541

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

Merged
merged 1 commit into from
May 26, 2025

Conversation

tudoramariei
Copy link
Member

No description provided.

@tudoramariei tudoramariei requested review from danniel and Copilot May 26, 2025 10:43
Copy link
Contributor

@Copilot 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 support for an ANAF GDPR consent flag by converting its boolean value to an integer and exposing it in both the CSV export and the accompanying template documentation.

  • Introduce anaf_gdpr_flag_to_int in clean.py
  • Update the HTML template to document the new CSV column
  • Wire the new flag into the CSV export logic and header

Reviewed Changes

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

File Description
backend/templates/v2/DESCRIERE.html Document the new “ANAF GDPR” column in the index.csv description
backend/redirectioneaza/common/clean.py Add anaf_gdpr_flag_to_int and annotate normalize_text_alnum
backend/donations/views/download_donations/main.py Import and apply the new flag conversion; include it in CSV output
Comments suppressed due to low confidence (2)

backend/donations/views/download_donations/main.py:205

  • [nitpick] Consistently capitalize the CSV header to match the template label (e.g., use _("ANAF GDPR")) so it aligns with the displayed column name.
                _("anaf gdpr"),

backend/redirectioneaza/common/clean.py:22

  • Consider adding unit tests for anaf_gdpr_flag_to_int to verify both True/False paths convert to 1/0 as expected.
def anaf_gdpr_flag_to_int(anaf_gdpr: bool) -> int:

@@ -92,7 +100,7 @@ def clean_text_custom(text: str) -> str:
return "".join([c for c in text if c in ANAF_CUSTOM_LIST])


def normalize_text_alnum(text):
def normalize_text_alnum(text) -> str:
Copy link
Preview

Copilot AI May 26, 2025

Choose a reason for hiding this comment

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

Add a type annotation for the text parameter (e.g., text: str) to keep consistency and clarity of function signatures.

Suggested change
def normalize_text_alnum(text) -> str:
def normalize_text_alnum(text: str) -> str:

Copilot uses AI. Check for mistakes.

Comment on lines +28 to 29
from redirectioneaza.common.clean import anaf_gdpr_flag_to_int, duration_flag_to_int, normalize_text_alnum
from redirectioneaza.common.messaging import extend_email_context, send_email
Copy link
Preview

Copilot AI May 26, 2025

Choose a reason for hiding this comment

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

[nitpick] Align this import with other imports by removing the extra leading space and grouping imports according to project style (e.g., one import per line or sorted alphabetically).

Suggested change
from redirectioneaza.common.clean import anaf_gdpr_flag_to_int, duration_flag_to_int, normalize_text_alnum
from redirectioneaza.common.messaging import extend_email_context, send_email
from redirectioneaza.common.clean import anaf_gdpr_flag_to_int
from redirectioneaza.common.clean import duration_flag_to_int
from redirectioneaza.common.clean import normalize_text_alnum
from redirectioneaza.common.messaging import extend_email_context
from redirectioneaza.common.messaging import send_email

Copilot uses AI. Check for mistakes.

@tudoramariei tudoramariei merged commit 8351bc6 into main May 26, 2025
7 checks passed
@tudoramariei tudoramariei deleted the export/fix-csv branch May 26, 2025 10:46
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.

2 participants