Skip to content

Adiciona contador de dias úteis - #136

Open
silviasfon wants to merge 2 commits into
GabrielRF:masterfrom
silviasfon:workdays
Open

Adiciona contador de dias úteis#136
silviasfon wants to merge 2 commits into
GabrielRF:masterfrom
silviasfon:workdays

Conversation

@silviasfon

Copy link
Copy Markdown

Issue #19

Adiciona contador de dias úteis nas informações do pacote, baseado nos feriados do Brasil.

@rougeth rougeth left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Obrigado pelo PR @silviasfon. Faltou só adicionar o workadays como dependência do projeto. Deixei outro comentário, mas pode ficar para um próximo PR.

Comment thread apis/apicorreios.py
import json
import sys
from datetime import date
from workadays.workdays import networkdays

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Faltou atualizar o pyproject.toml com a nova dependência, né?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Faltou só adicionar o poetry.lock atualizado. Por isso falhou o teste.

Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them.

Comment thread apis/apicorreios.py Outdated
elif delta_utils > 1:
data = data + ' – ' + str(delta_utils) + ' dias úteis)'
else
data = data + ')'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Você acha que seria muito difícil extrair essa funcionalidade para uma função? Minha impressão é que essa parte do parse() poderia ficar muito mais simples se dividíssemos a lógica em funções menores. Facilitaria até para incluir testes.

- refatoração de código e correção de lógica
Comment thread apis/apicorreios.py
elif delta_dias > 0:
data = data + ')'

return data

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wow! Boa! Só fica melhor se puder adicionar alguns testes pra essa função! 😁

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

estou com um pouco de dificuldade de entender exatamente como fazer, mas vou dar uma olhada

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Esse teste talvez seja um bom exemplo, avisa aqui se não tiver dando certo.

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.

3 participants