From b01139c90c0362958ddf8d59fbc2e240ad658fc9 Mon Sep 17 00:00:00 2001 From: Rossi-Luciano Date: Tue, 2 Jun 2026 12:38:00 -0300 Subject: [PATCH 1/4] Adiciona migration de merge para resolver conflito entre branches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As migrations 0003_remove_articledocxmarkup_dateiso_and_more (main) e 0004_articledocxmarkup_xref_status (add-xref-linking) foram criadas a partir do mesmo ancestral 0002, gerando dois nós folha conflitantes no grafo de migrations. A migration de merge resolve o conflito sem alterar o banco de dados. Co-Authored-By: Claude Sonnet 4.6 --- markup_doc/migrations/0005_merge_20260602_1323.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 markup_doc/migrations/0005_merge_20260602_1323.py diff --git a/markup_doc/migrations/0005_merge_20260602_1323.py b/markup_doc/migrations/0005_merge_20260602_1323.py new file mode 100644 index 0000000..c96b14f --- /dev/null +++ b/markup_doc/migrations/0005_merge_20260602_1323.py @@ -0,0 +1,14 @@ +# Generated by Django 6.0.5 on 2026-06-02 13:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('markup_doc', '0003_remove_articledocxmarkup_dateiso_and_more'), + ('markup_doc', '0004_articledocxmarkup_xref_status'), + ] + + operations = [ + ] From adedb401c50c922a520eda96adeb3f8d98e6d5d0 Mon Sep 17 00:00:00 2001 From: Rossi-Luciano Date: Tue, 2 Jun 2026 12:38:28 -0300 Subject: [PATCH 2/4] =?UTF-8?q?Remove=20refer=C3=AAncia=20a=20campo=20date?= =?UTF-8?q?iso=20removido=20pelo=20modelo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit O campo dateiso foi excluído de ArticleDocxMarkup pela migration 0003_remove_articledocxmarkup_dateiso_and_more, mas get_xml() ainda o referenciava para gerar pub-date, causando AttributeError em toda task de geração de XML. A data de publicação da issue agora vem de issue.year e issue.month, já tratados no bloco anterior. Co-Authored-By: Claude Sonnet 4.6 --- markup_doc/xml.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/markup_doc/xml.py b/markup_doc/xml.py index 64c05ab..409f1cd 100644 --- a/markup_doc/xml.py +++ b/markup_doc/xml.py @@ -384,28 +384,6 @@ def get_xml(article_docx, data_front, data, data_back, xref_map=None): node_tmp = etree.SubElement(node, 'issue') node_tmp.text = str(issue.number) - if article_docx.dateiso: - node_tmp = etree.SubElement(node, "pub-date") - node_tmp.set("date-type", "collection") - node_tmp.set("publication-format", "electronic") - - if ( - article_docx.dateiso.split("-")[2] - and article_docx.dateiso.split("-")[2] != "00" - ): - node_tmp2 = etree.SubElement(node_tmp, "day") - node_tmp2.text = article_docx.dateiso.split("-")[2] - - if ( - article_docx.dateiso.split("-")[1] - and article_docx.dateiso.split("-")[1] != "00" - ): - node_tmp2 = etree.SubElement(node_tmp, "month") - node_tmp2.text = article_docx.dateiso.split("-")[1] - - node_tmp2 = etree.SubElement(node_tmp, "year") - node_tmp2.text = article_docx.dateiso.split("-")[0] - if article_docx.elocatid: node_tmp = etree.SubElement(node, "elocation-id") node_tmp.text = article_docx.elocatid From 8f6ebd2bf1f4e730c855e14e8df4dd8f19357416 Mon Sep 17 00:00:00 2001 From: Rossi-Luciano Date: Tue, 2 Jun 2026 12:38:49 -0300 Subject: [PATCH 3/4] Corrige IndexError ao acessar sections[-1] em lista vazia MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quando o parágrafo de introdução era o primeiro elemento a registrar uma seção no documento, a lista sections ainda estava vazia no momento em que extractContent tentava acessar sections[-1] para criar o first_block. Adicionado guard para retornar lista vazia quando sections não tem elementos. Co-Authored-By: Claude Sonnet 4.6 --- markuplib/function_docx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markuplib/function_docx.py b/markuplib/function_docx.py index c9646cd..924bde6 100644 --- a/markuplib/function_docx.py +++ b/markuplib/function_docx.py @@ -603,7 +603,7 @@ def extrae_Tabla(element, rels_map, namespaces): found_fb = False review_fb = False found_hiperlinks = False - sections = [sections[-1]] + sections = [sections[-1]] if sections else [] first_block = "" tmp_content = [] abstract_mode = False From b0a09f77533849649ccc8bf1d3d811c9cff501ac Mon Sep 17 00:00:00 2001 From: Rossi-Luciano Date: Tue, 2 Jun 2026 12:39:08 -0300 Subject: [PATCH 4/4] =?UTF-8?q?Ajusta=20configura=C3=A7=C3=B5es=20de=20con?= =?UTF-8?q?ex=C3=A3o=20PostgreSQL=20para=20ambiente=20local?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CONN_MAX_AGE = 0 força o Django a fechar conexões após cada request, evitando acúmulo que esgotava o limite do banco. max_connections=200 no serviço postgres do docker-compose local acomoda os 16 workers prefork do Celery mais as conexões do Django sem atingir o limite padrão de 100. Co-Authored-By: Claude Sonnet 4.6 --- config/settings/base.py | 1 + local.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/config/settings/base.py b/config/settings/base.py index a2ebbb9..fd2e62c 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -127,6 +127,7 @@ # https://docs.djangoproject.com/en/5.1/ref/settings/#databases DATABASES = {"default": env.db("DATABASE_URL")} DATABASES["default"]["ATOMIC_REQUESTS"] = True +DATABASES["default"]["CONN_MAX_AGE"] = 0 # Password validation diff --git a/local.yml b/local.yml index b01cb87..460d5ec 100644 --- a/local.yml +++ b/local.yml @@ -39,6 +39,7 @@ services: - "5439:5432" env_file: - ./.envs/.local/.postgres + command: postgres -c max_connections=200 redis: image: redis:6