Class: Presenters::GroupLinePresenter

Inherits:
Object
  • Object
show all
Includes:
PipelinesHelper
Defined in:
app/models/presenters/grouped_pipeline_inbox_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PipelinesHelper

#fluidigm_target?, #target_purpose_for

Constructor Details

#initialize(group, request, index, pipeline, inbox) ⇒ GroupLinePresenter

Returns a new instance of GroupLinePresenter.



114
115
116
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 114

def initialize(group, request, index, pipeline, inbox)
  @group, @request, @index, @pipeline, @inbox = group, request, index, pipeline, inbox
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



110
111
112
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 110

def group
  @group
end

#inboxObject (readonly)

Returns the value of attribute inbox.



110
111
112
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 110

def inbox
  @inbox
end

#indexObject (readonly)

Returns the value of attribute index.



110
111
112
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 110

def index
  @index
end

#pipelineObject (readonly)

Returns the value of attribute pipeline.



110
111
112
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 110

def pipeline
  @pipeline
end

#requestObject (readonly)

Returns the value of attribute request.



110
111
112
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 110

def request
  @request
end

Instance Method Details

#barcodeObject



142
143
144
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 142

def barcode
  parent.human_barcode
end

#each_fieldObject



134
135
136
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 134

def each_field
  inbox.each_method { |method| yield send(method) }
end

#group_idObject



118
119
120
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 118

def group_id
  group.join(', ')
end

#groupless?Boolean

Gates

Returns:

  • (Boolean)


168
169
170
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 168

def groupless?
  yield if group.blank?
end

#internal_idObject



138
139
140
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 138

def internal_id
  parent.id
end

#parentObject



126
127
128
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 126

def parent
  @parent ||= request.asset.labware || Labware.find(group.first)
end

#parentless?Boolean

Returns:

  • (Boolean)


176
177
178
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 176

def parentless?
  yield if parent.nil?
end

#pick_toObject



150
151
152
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 150

def pick_to
  target_purpose_for(request)
end

#plate_purposeObject



146
147
148
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 146

def plate_purpose
  parent.purpose&.name
end

#request_group_idObject



122
123
124
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 122

def request_group_id
  "request_group_#{group_id.gsub(/[^a-z0-9]+/, '_')}"
end

#standard_fields?Boolean

Returns:

  • (Boolean)


172
173
174
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 172

def standard_fields?
  yield unless parent.nil?
end

#still_requiredObject



162
163
164
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 162

def still_required
  wells / parent.height
end

#stock_barcodeObject



158
159
160
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 158

def stock_barcode
  parent.source_plate.try(:human_barcode) || 'Unknown'
end

#studyObject



154
155
156
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 154

def study
  submission.study_names if submission_id.present?
end

#submission_nameObject



130
131
132
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 130

def submission_name
  submission.name if submission_id.present?
end