seek4science / seek

For finding, sharing and exchanging Data, Models, Simulations and Processes in Science.
http://www.seek4science.org
BSD 3-Clause "New" or "Revised" License
76 stars 52 forks source link

Error with LinkingSamplesUpdateJob #1889

Open stuzart opened 3 months ago

stuzart commented 3 months ago

error occuring:

A TypeError occurred in background at 2024-05-22 00:12:14 UTC :

  no implicit conversion of String into Integer
  /srv/rails/fairdomhub/app/models/sample.rb:145:in `[]'

-------------------------------
Backtrace:
-------------------------------

  /srv/rails/fairdomhub/app/models/sample.rb:145:in `[]'
  /srv/rails/fairdomhub/app/models/sample.rb:145:in `block (3 levels) in refresh_linking_samples'
  /srv/rails/fairdomhub/app/models/sample.rb:144:in `each'
  /srv/rails/fairdomhub/app/models/sample.rb:144:in `block (2 levels) in refresh_linking_samples'
  /srv/rails/fairdomhub/app/models/sample.rb:142:in `each'
  /srv/rails/fairdomhub/app/models/sample.rb:142:in `block in refresh_linking_samples'
  /srv/rails/fairdomhub/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.7/lib/active_record/relation/delegation.rb:88:in `each'
  /srv/rails/fairdomhub/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.7/lib/active_record/relation/delegation.rb:88:in `each'
  /srv/rails/fairdomhub/app/models/sample.rb:138:in `refresh_linking_samples'

offending line https://github.com/seek4science/seek/blob/main/app/models/sample.rb#L145

I think with if sample['id'] == id , one is a String and the other and Integer, so needs converting

stuzart commented 3 months ago

seems to be encountering an array instead of hash, and maybe related to multiple linked samples - but I've not yet been able to reproduce. Might be caused by being registered through the API