Skip to content

Instantly share code, notes, and snippets.

@phsacramento
Last active May 28, 2020 20:00
Show Gist options
  • Save phsacramento/b161c6126e8935eb2b8b225bbdc9b2ea to your computer and use it in GitHub Desktop.
Save phsacramento/b161c6126e8935eb2b8b225bbdc9b2ea to your computer and use it in GitHub Desktop.
def handle_invalid_entries(reasons, uid, pid)
if reasons.include?(:person_not_registered)
@logger.info("[Toggl::TimeEntryImporter] Person not registered: #{uid}")
end
if reasons.include?(:without_description)
@logger.info("[Toggl::TimeEntryImporter] Time entry without description from user #{uid}")
end
if reasons.include?(:without_project)
@logger.info("[Toggl::TimeEntryImporter] Time entry without project from user #{uid}")
end
return unless reasons.include?(:project_not_registered)
@logger.info("[Toggl::TimeEntryImporter] Project not registered: #{pid}")
end
case reasons
in %I[without_description without_project]
# do something
in %I[person_not_registered project_not_registered]
# do something
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment