-
-
Save pauloat/188ae091a6138c8b4284 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#test3 | |
require 'chronic' | |
AM4 = Chronic.parse('4 am') | |
#PM9 = Chronic.parse('9 pm') | |
entrada1 = Chronic.parse('2 am') | |
salida1 = Chronic.parse('4 am') | |
def entrada_amanecer(entrada) | |
tiempo = (AM4 - entrada) | |
return hora_nocturna(tiempo) | |
end | |
#def salida_anochecer(salida) | |
# tiempo = (salida - PM9) | |
# return salida = hora_nocturna(tiempo) | |
#end | |
def hora_nocturna(tiempo) #tiempo es cantidad de segundos a convertir | |
return (tiempo / 50) * 60 | |
end | |
if entrada1 < AM4 | |
tiempo_amanecer = (entrada1 - AM4) | |
tiempo_extra_entrada = entrada_amanecer(tiempo_amanecer) - tiempo_amanecer | |
else | |
tiempo_extra_entrada = 0 | |
end | |
#if salida1 > PM9 | |
# (PM9 - salida1) + salida_anochecer(salida1) | |
# salida1 | |
#end | |
tiempo_trabajado1 = ((salida1 - (entrada1 + tiempo_extra_entrada) / 60 ) / 60) | |
puts tiempo_trabajado1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment