Skip to content
This repository has been archived by the owner on Jan 2, 2020. It is now read-only.

Correct TNT website parsing #59

Merged
merged 3 commits into from
Aug 1, 2019
Merged

Correct TNT website parsing #59

merged 3 commits into from
Aug 1, 2019

Conversation

bobmaerten
Copy link
Collaborator

@bobmaerten bobmaerten commented Aug 1, 2019

Closes #58

@bobmaerten bobmaerten marked this pull request as ready for review August 1, 2019 08:16
@czj czj changed the title Correct tnt parsing Correct TNT website parsing Aug 1, 2019
@czj
Copy link
Contributor

czj commented Aug 1, 2019

This gem is turning into a monster "just" to get a float from TNT each month :(

@czj czj merged commit 3eb949e into master Aug 1, 2019
@czj czj deleted the correct_tnt_parsing branch August 1, 2019 08:20
@czj czj restored the correct_tnt_parsing branch August 1, 2019 08:20
@czj czj deleted the correct_tnt_parsing branch August 1, 2019 08:20
<p><b>Voici le barème applicable avec l'historique des dernières semaines :<br />
</b><br />
<div class="cms-c-text text one_column componentbottommargin cms-u-padding__top- cms-u-padding__bottom-">
<p>Veuillez noter qu'il y aura un <b>décalage de deux semaines dans l'application des indices.</b> Par exemple, au 7 janvier 2019, la surcharge sera calculée en fonction du prix comptant moyen relevé le 28 décembre. Les modifications apportées à la surcharge carburant seront effectives chaque lundi. Les informations relatives à la surcharge seront disponibles chaque semaine approximativement le vendredi précédent l'application de la surcharge.<br />
Copy link

Choose a reason for hiding this comment

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

[Misspell] "exemple" is a misspelling of "example" (link)

posted by Sider

<div class="cms-c-text text one_column componentbottommargin cms-u-padding__top- cms-u-padding__bottom-">
<h2>Surcharge carburant pour vos envois en France</h2>

<p>Cette surcharge s'applique à l'ensemble de vos expéditions nationales. Elle est indexée sur la moyenne mensuelle du prix à la pompe du gazole (hors TVA), en euros par litre tel que publié mensuellement par le Comité National Routier (CNR).<br />
Copy link

Choose a reason for hiding this comment

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

[Misspell] "nationales" is a misspelling of "nationals" (link)

posted by Sider


assert_kind_of String, time_period
assert time_period.downcase.start_with?(current_month)
assert (time_period.downcase.start_with?(current_month) || time_period.downcase.start_with?(previous_month))
Copy link

Choose a reason for hiding this comment

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

[RuboCop] Lint/ParenthesesAsGroupedExpression: (...) interpreted as grouped expression. (link)

posted by Sider


assert_kind_of String, time_period
assert time_period.downcase.start_with?(current_month)
assert (time_period.downcase.start_with?(current_month) || time_period.downcase.start_with?(previous_month))
Copy link

Choose a reason for hiding this comment

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

[RuboCop] Performance/DoubleStartEndWith: Use time_period.downcase.start_with?(current_month, previous_month) instead of time_period.downcase.start_with?(current_month) || time_period.downcase.start_with?(previous_month). (link)

posted by Sider


assert_kind_of String, time_period
assert time_period.downcase.start_with?(current_month)
assert (time_period.downcase.start_with?(current_month) || time_period.downcase.start_with?(previous_month))
Copy link

Choose a reason for hiding this comment

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

[RuboCop] Lint/ParenthesesAsGroupedExpression: (...) interpreted as grouped expression. (link)

posted by Sider

@@ -16,7 +16,9 @@ def road_percentage
end

def air_percentage
air_value&.last&.to_s
if value = air_value&.dig("list", 0, "surcharge")
Copy link

Choose a reason for hiding this comment

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

[RuboCop] Lint/AssignmentInCondition: Use == if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition. (link)

posted by Sider


assert_kind_of String, time_period
assert time_period.downcase.start_with?(current_month)
assert (time_period.downcase.start_with?(current_month) || time_period.downcase.start_with?(previous_month))
Copy link

Choose a reason for hiding this comment

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

[RuboCop] Performance/DoubleStartEndWith: Use time_period.downcase.start_with?(current_month, previous_month) instead of time_period.downcase.start_with?(current_month) || time_period.downcase.start_with?(previous_month). (link)

posted by Sider

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TNT website change, again…
2 participants