Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sry validation participant tracker tab #40

Merged
merged 3 commits into from Jul 26, 2017

Conversation

royyesud
Copy link
Collaborator

@@ -141,6 +141,10 @@ def first_middle
[first_name, middle_initial].join(' ')
end

def can_be_destroyed?
appointments.map{|appointment| appointment.procedures}.flatten.detect{|procedure| !procedure.unstarted?}.nil?
Copy link
Collaborator

Choose a reason for hiding this comment

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

another way to do this would be appointments.all?{|a| a.procedures.all?(&:unstarted?)}

Copy link
Collaborator

Choose a reason for hiding this comment

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

basically, if all procedures for all appointments are not started we can delete

Copy link
Collaborator

Choose a reason for hiding this comment

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

procedures.where.not(status: 'unstarted').any?

This does a single count query

@Stuart-Johnson Stuart-Johnson merged commit 367007f into master Jul 26, 2017
@Stuart-Johnson Stuart-Johnson deleted the sry-validation-pariticipant-tracker-tab branch July 26, 2017 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants