Class: Presenters::GroupLinePresenter

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

Overview

rubocop:todo Style/Documentation

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.


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

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


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

def group
  @group
end

#inboxObject (readonly)

Returns the value of attribute inbox


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

def inbox
  @inbox
end

#indexObject (readonly)

Returns the value of attribute index


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

def index
  @index
end

#pipelineObject (readonly)

Returns the value of attribute pipeline


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

def pipeline
  @pipeline
end

#requestObject (readonly)

Returns the value of attribute request


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

def request
  @request
end

Instance Method Details

#barcodeObject


148
149
150
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 148

def barcode
  parent.human_barcode
end

#each_fieldObject


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

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

#group_idObject


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

def group_id
  group.join(', ')
end

#groupless?Boolean

Gates

Returns:

  • (Boolean)

174
175
176
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 174

def groupless?
  yield if group.blank?
end

#internal_idObject


144
145
146
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 144

def internal_id
  parent.id
end

#parentObject


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

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

#parentless?Boolean

Returns:

  • (Boolean)

182
183
184
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 182

def parentless?
  yield if parent.nil?
end

#pick_toObject


156
157
158
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 156

def pick_to
  target_purpose_for(request)
end

#plate_purposeObject


152
153
154
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 152

def plate_purpose
  parent.purpose&.name
end

#request_group_idObject


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

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

#standard_fields?Boolean

Returns:

  • (Boolean)

178
179
180
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 178

def standard_fields?
  yield unless parent.nil?
end

#still_requiredObject


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

def still_required
  wells / parent.height
end

#stock_barcodeObject


164
165
166
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 164

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

#studyObject


160
161
162
# File 'app/models/presenters/grouped_pipeline_inbox_presenter.rb', line 160

def study
  submission.study_names if submission_id.present?
end

#submission_nameObject


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

def submission_name
  submission.name if submission_id.present?
end