File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -289,6 +289,8 @@ def cleanup_array_fields
289289 end
290290
291291 def auto_set_short_label
292+ return if short_label . present?
293+
292294 prefix = creator . reaction_name_prefix
293295 counter = creator . counters [ 'reactions' ] . succ
294296 self . short_label = "#{ creator . initials } -#{ prefix } #{ counter } "
@@ -299,9 +301,10 @@ def update_counter
299301 end
300302
301303 def scrub
302- if temperature &.fetch ( 'userText' , nil ) . present?
303- self . temperature = temperature . merge ( 'userText' => scrubber ( temperature [ 'userText' ] ) )
304- end
304+ return if temperature &.fetch ( 'userText' , nil ) . blank?
305+
306+ self . temperature = temperature . merge ( 'userText' => scrubber ( temperature [ 'userText' ] ) )
307+
305308 # Conditions are not scrubbed: plain text may contain "<" or ">" (e.g. "pH < 7");
306309 # scrub_xml would strip them. Conditions are escaped at display time.
307310 end
Original file line number Diff line number Diff line change 8787 expect ( reaction . temperature . to_s ) . to eq ( '{"data"=>[], "userText"=>"30", "valueUnit"=>"°C"}' )
8888 expect ( reaction . status ) . to eq ( 'Done' )
8989 expect ( reaction . solvent ) . to eq ( '' )
90- expect ( reaction . short_label ) . to eq ( 'UU-R1 ' )
90+ expect ( reaction . short_label ) . to eq ( 'FM-R2 ' )
9191 expect ( reaction . role ) . to eq ( 'gp' )
9292 expect ( reaction . duration ) . to eq ( '1 Day(s)' )
9393 expect ( reaction . conditions ) . to eq ( '' )
You can’t perform that action at this time.
0 commit comments