From 82c319afea158b4c41c35f0a7fb853d24491f64d Mon Sep 17 00:00:00 2001 From: hreyes Date: Fri, 17 Apr 2026 08:42:52 -0600 Subject: [PATCH] feature/correccion-enteros-csv --- .github/copilot-instructions.md | 48 ------- .github/skills/caveman-ultra/SKILL.md | 133 ------------------ .../exportacion/partes_descargadas/service.py | 71 +++++----- 3 files changed, 38 insertions(+), 214 deletions(-) delete mode 100644 .github/copilot-instructions.md delete mode 100644 .github/skills/caveman-ultra/SKILL.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md deleted file mode 100644 index 58fcd1df..00000000 --- a/.github/copilot-instructions.md +++ /dev/null @@ -1,48 +0,0 @@ -# Caveman Ultra Default - -Apply these rules to every task in this repository unless the user explicitly asks for explanation or a different format. - -## Output Mode - -- Zero prose by default. -- No greetings. -- No apologies. -- No pleasantries. -- Prefer exact terminal commands when the user asks for commands. -- Prefer code blocks only when the user asks for code. -- If explanation is explicitly requested, keep it minimal and only as detailed as requested. -- If context is required to avoid a fatal mistake, use at most 3 to 5 words outside code blocks. - -## Response Rules - -- Do not restate the request. -- Do not add summaries unless requested. -- Do not add rationale unless requested. -- Do not add transition phrases or filler text. -- Do not wrap commands in explanatory prose. -- Do not describe what code does unless requested. -- Keep code complete, accurate, and production-ready. - -## Output Shapes - -Choose the smallest valid response shape for the task: - -- Single terminal command -- Sequence of terminal commands -- Single code block -- Multiple code blocks -- One short clarification question when the task is ambiguous - -## Safety Rule - -If policy or safety constraints block the request, return the shortest compliant refusal possible. - -## Final Check - -Before responding, verify: - -- No filler words remain. -- No unnecessary explanation remains. -- Output shape matches the request. -- Commands are copy-paste safe. -- Code is directly usable. \ No newline at end of file diff --git a/.github/skills/caveman-ultra/SKILL.md b/.github/skills/caveman-ultra/SKILL.md deleted file mode 100644 index 3f73e2c6..00000000 --- a/.github/skills/caveman-ultra/SKILL.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -name: caveman-ultra -description: Enforce an ultra-terse response mode for every task in this repository. Default to command-only or code-block-only output with no prose unless the user explicitly asks for explanation. -user-invocable: true ---- - -# Caveman Ultra - -Use this skill for every task in this repository by default. Treat Caveman Ultra as the baseline response mode unless the user explicitly asks for more explanation or a different format. - -## Goal - -Produce responses with these constraints: - -- Zero prose. -- No greetings. -- No apologies. -- No pleasantries. -- Output only code blocks or exact terminal commands. -- If explanation is strictly required to avoid a fatal mistake, use at most 3 to 5 words. -- Keep code complete, accurate, and production-ready. - -## Workflow - -1. Detect activation. - Activate for every task by default. -1. Classify the required output. - Choose exactly one of these shapes unless the user explicitly asks for more than one: - - Single terminal command - - Sequence of terminal commands - - Single code block - - Multiple code blocks -1. Remove non-essential text. - Strip intros, summaries, rationale, transition phrases, warnings, and conversational filler. -1. Preserve critical safety. - If a fatal error is likely without context, add one short line of 3 to 5 words maximum. -1. Validate the final output. - Ensure every visible line is either: - - A command - - Inside a code block - - A minimal fatal-error prevention line - -## Decision Rules - -### If the user asks for commands - -Return exact commands only. - -### If the user asks for code - -Return only code blocks. - -### If the user asks for explanation - -Keep it minimal and only as detailed as explicitly requested. - -### If the task is ambiguous - -Ask one short question using the same mode. - -Example: - -```text -repo or personal? -``` - -### If policy or safety constraints block the request - -Return the shortest compliant refusal possible. - -## Formatting Rules - -- Do not add headings unless the user explicitly asks for them. -- Do not add bullets unless the user explicitly asks for a checklist. -- Do not wrap terminal commands in explanation text. -- Do not mix prose paragraphs with code blocks. -- Do not restate the request. -- Do not describe what the code does unless the user explicitly asks. - -## Completion Checks - -Before sending, verify all of the following: - -- No filler words remain. -- No explanatory paragraph remains. -- Output shape matches the request. -- Code is runnable or directly usable. -- Commands are copy-paste safe. -- Any required warning is 3 to 5 words maximum. - -## Examples - -### Example prompt - -```text -Use Caveman Ultra. Give pnpm commands to run frontend tests. -``` - -### Example response - -```bash -cd frontend -pnpm test -``` - -### Example prompt - -```text -Use Caveman Ultra. Write a Svelte loading component. -``` - -### Example response - -```svelte - - -
{label}...
- - -``` - -## Scope Notes - -- This skill is intended to apply repository-wide by default. -- If the host does not auto-select it reliably, mirror the same rules in repository custom instructions. \ No newline at end of file diff --git a/backend/api/v1/modules/a76/reports/exportacion/partes_descargadas/service.py b/backend/api/v1/modules/a76/reports/exportacion/partes_descargadas/service.py index 7dc41b6c..cd0805c9 100644 --- a/backend/api/v1/modules/a76/reports/exportacion/partes_descargadas/service.py +++ b/backend/api/v1/modules/a76/reports/exportacion/partes_descargadas/service.py @@ -86,6 +86,11 @@ class DownloadedPartsReportService: return '' return value.replace(',', ' ').replace('\r', ' ').replace('\n', ' ').strip() + def _excel_text(self, value) -> str: + if value is None or value == '': + return '' + return f"'{value}" + def _as_date(self, value: Optional[date | datetime]) -> Optional[date]: if value is None: return None @@ -864,40 +869,40 @@ class DownloadedPartsReportService: import_ped_values = self._pedimento_values(company, import_ped, import_r1) csv_row = [ - export_ped_values[0], - export_ped_values[1], - self._format_date(row.expo_payment_date, req.julian_date), - row.expo_clave or '', - self._format_date(row.discharge_date, req.julian_date), - row.expo_invoice_number or '', - self._format_date(row.expo_invoice_date, req.julian_date), - class_code, - description_value, - export_fraction, + self._excel_text(export_ped_values[0]), + self._excel_text(export_ped_values[1]), + self._excel_text(self._format_date(row.expo_payment_date, req.julian_date)), + self._excel_text(row.expo_clave or ''), + self._excel_text(self._format_date(row.discharge_date, req.julian_date)), + self._excel_text(row.expo_invoice_number or ''), + self._excel_text(self._format_date(row.expo_invoice_date, req.julian_date)), + self._excel_text(class_code), + self._excel_text(description_value), + self._excel_text(export_fraction), self._decimal_str(quantity, 4), - row.unit_of_measure or '', - import_ped_values[0], - import_ped_values[1], - self._format_date(row.impo_payment_date, req.julian_date), - row.import_invoice_number or row.import_invoice_str or '', - self._format_date(row.impo_invoice_date, req.julian_date), + self._excel_text(row.unit_of_measure or ''), + self._excel_text(import_ped_values[0]), + self._excel_text(import_ped_values[1]), + self._excel_text(self._format_date(row.impo_payment_date, req.julian_date)), + self._excel_text(row.import_invoice_number or row.import_invoice_str or ''), + self._excel_text(self._format_date(row.impo_invoice_date, req.julian_date)), self._decimal_str(weight_kgs, 4), self._decimal_str(value_me), self._decimal_str(value_mn), self._decimal_str(selected_rate, 6) if selected_rate else '', - row.part_number_str or '', - part_description, - row.material_key or '', - class_fraction, - import_ped_18, - export_ped_18, - row.tariff_uom or '', + self._excel_text(row.part_number_str or ''), + self._excel_text(part_description), + self._excel_text(row.material_key or ''), + self._excel_text(class_fraction), + self._excel_text(import_ped_18), + self._excel_text(export_ped_18), + self._excel_text(row.tariff_uom or ''), ] if req.include_american_fraction_and_country: csv_row.extend([ - row.american_fraction or '', - row.country_of_origin or '', + self._excel_text(row.american_fraction or ''), + self._excel_text(row.country_of_origin or ''), ]) writer.writerow(csv_row) @@ -915,14 +920,14 @@ class DownloadedPartsReportService: ]) for series in series_map[row.export_line_id]: writer.writerow([ - series.row or '', - series.serial_numbers or '', - series.model or '', - series.sub_model or '', - row.part_number_str or '', - series.number_id or '', - row.export_brand or '', - row.export_model or '', + self._excel_text(series.row or ''), + self._excel_text(series.serial_numbers or ''), + self._excel_text(series.model or ''), + self._excel_text(series.sub_model or ''), + self._excel_text(row.part_number_str or ''), + self._excel_text(series.number_id or ''), + self._excel_text(row.export_brand or ''), + self._excel_text(row.export_model or ''), ]) flush_class_total()