Commit 29c83a39 authored by chia-lin.lin's avatar chia-lin.lin 💬
Browse files

add operator_link_id

parent 1d3e7593
......@@ -16,7 +16,7 @@ class SamplePdf < Prawn::Document
text "submitted at: \ #{@sample.submitted_at}", size: 15, style: :bold
elsif @sample.status=="measured"
text "measured at: \ #{@sample.measured_at}",size: 15, style: :bold
text "measured by: \ #{@sample.operator_name}",size: 15, style: :bold
text "measured by: \ #{@sample.operator_link_id}",size: 15, style: :bold
else
text "created at: \ #{@sample.created_at}",size: 15, style: :bold
end
......
......@@ -16,7 +16,7 @@ class SamplePdf < Prawn::Document
text "submitted at: \ #{@sample.submitted_at}", size: 15, style: :bold
elsif @sample.status=="measured"
text "measured at: \ #{@sample.measured_at}",size: 15, style: :bold
text "measured by: \ #{@sample.operator_name}",size: 15, style: :bold
text "measured by: \ #{@sample.operator_link_id}",size: 15, style: :bold
else
text "created at: \ #{@sample.created_at}",size: 15, style: :bold
end
......
......@@ -20,6 +20,10 @@ class Sample < ApplicationRecord
REG = /(#{ELEMENTS.keys.map(&:to_s).sort.reverse.join("|")})(\d*)/
def operator_link_id
User.find_by(name: operator_name)&.id
end
def formatted_calculation
self.calculation
keys = ( PREDEF_ELEMENTS+(self.calculation.keys - PREDEF_ELEMENTS) ).uniq
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment