Skip to content

Instantly share code, notes, and snippets.

@coralieco
Created March 20, 2021 10:54
Show Gist options
  • Save coralieco/af3a71634c037fe91e53b0e016ea5e17 to your computer and use it in GitHub Desktop.
Save coralieco/af3a71634c037fe91e53b0e016ea5e17 to your computer and use it in GitHub Desktop.
French Attestation Rules
HOT_DEPARTMENTS = ["Aisne", "Alpes-Maritimes", "Essonne", "Eure", "Hauts-de-Seine", "Nord", "Oise",
"Paris", "Pas-de-Calais", "Seine-et-Marne", "Seine-Saint-Denis", "Seine-Maritime", "Somme",
"Val-de-Marne", "Val-d’Oise", "Yvelines"]
def please_explain(living_department:, reason_to_get_out:)
if HOT_DEPARTMENTS.include?(living_department)
distance_rule = reason_to_get_out.include?("*") ? "not " : ""
return "You need an attestation & you're #{distance_rule}limited by the 30km rule"
else
if Time.now.hour.between?(9, 19)
"Seems like you don't need an attestation except if you're going in a HOT_DEPARTMENT"
# if so, the distance_rule applies
else
"Curfew! You need an attestation"
end
end
end
p please_explain(living_department: "Hauts-de-Seine", reason_to_get_out: "Consultations et soins *")
p please_explain(living_department: "Var", reason_to_get_out: "Achats")
p please_explain(living_department: "Paris", reason_to_get_out: "Culte")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment