Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release] Merge Develop into Master for 14.52.0 #4564

Draft
wants to merge 58 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
3184c31
fix: generate plate volumes
StephenHulme Nov 28, 2024
12deaa2
style: lindt
StephenHulme Nov 28, 2024
df603b4
tests: split out individual expectations
StephenHulme Nov 28, 2024
b3084f7
tests: refactor and fix expectations
StephenHulme Nov 28, 2024
ca14fa1
tests: add additional tests for validation
StephenHulme Dec 2, 2024
48a0ba1
style: lint
StephenHulme Dec 3, 2024
5d6cc14
Merge branch 'develop' into y24-382-generate-plate-volumes
StephenHulme Dec 3, 2024
9c82b86
fix: allow maximum to equal minimum
StephenHulme Dec 3, 2024
91b78f3
fix: allow maximum to equal minimum (concentrations)
StephenHulme Dec 3, 2024
a2acfb9
style: lint
StephenHulme Dec 3, 2024
5b0a3ed
tests: add more
StephenHulme Dec 4, 2024
d45119c
tests: repair broken tests
StephenHulme Dec 4, 2024
d2a1e63
Add TODO for removal of order_template.rb
sdjmchattie Dec 4, 2024
2e73bc6
fix: specify what b and v stand for
StephenHulme Dec 5, 2024
b99815b
Move the overridden method to the top of TagLayoutProcessor
sdjmchattie Dec 5, 2024
6abc012
Make OrderResource work
sdjmchattie Dec 5, 2024
dc4d9e2
Clean up code for creating the template attributes
sdjmchattie Dec 5, 2024
0e5e9c4
Add tests for orders
sdjmchattie Dec 9, 2024
a8b9d8b
Complete tests for OrderResource requests
sdjmchattie Dec 9, 2024
44fb065
Fix Rubocop issues
sdjmchattie Dec 9, 2024
bd34e04
Merge branch 'develop' into develop-Y24-190
sdjmchattie Dec 10, 2024
732b395
Merge branch 'develop-Y24-190' into Y24-190-support-limber-with-order…
sdjmchattie Dec 10, 2024
d26dfce
Fix rubocop complaint
sdjmchattie Dec 10, 2024
1e4dd24
add huMFre code field to the samples
sabrine33 Dec 12, 2024
4874191
run prettier
sabrine33 Dec 12, 2024
569962a
fix cucumber test
sabrine33 Dec 12, 2024
5a080e0
fix: show units
StephenHulme Dec 12, 2024
6f66d94
fix: reword receptacle volume -> picking volume
StephenHulme Dec 12, 2024
9da0e25
fix: replace assay_version Binning with more suitable UAT_version
StephenHulme Dec 13, 2024
2a42c35
Merge pull request #4547 from sanger/y24-382-annotate-worksheets
StephenHulme Dec 16, 2024
95a65bb
Clean up the OrdersProcessor and OrderResource
sdjmchattie Dec 16, 2024
70c8ee3
Fix Rubocop issues
sdjmchattie Dec 16, 2024
3d45f75
Merge branch 'develop' into develop-Y24-190
sdjmchattie Dec 16, 2024
b37bb16
Merge branch 'develop-Y24-190' into Y24-190-support-limber-with-order…
sdjmchattie Dec 16, 2024
90b2405
Merge pull request #4529 from sanger/y24-382-generate-plate-volumes
StephenHulme Dec 17, 2024
44df650
add huMFre code field to the samples
sabrine33 Dec 12, 2024
debfce3
run prettier
sabrine33 Dec 12, 2024
7ef8fb8
fix cucumber test
sabrine33 Dec 12, 2024
168c92e
add length constrain to the huMFre code
sabrine33 Dec 18, 2024
1ec551c
Merge remote-tracking branch 'origin/Y24-480-store-huMFre-code' into …
sabrine33 Dec 18, 2024
1e3a310
Merge pull request #4573 from sanger/Y24-480-store-huMFre-code
sabrine33 Dec 20, 2024
1ee65bb
Update rails to version 7.0.8.7
depfu[bot] Jan 8, 2025
e2a9a3c
Merge pull request #4551 from sanger/depfu/update/group/rails-7.0.8.7
yoldas Jan 8, 2025
7899d2f
Merge pull request #4543 from sanger/Y24-190-support-limber-with-orde…
sdjmchattie Jan 8, 2025
1e86205
Update factory_bot_rails to version 6.4.4
depfu[bot] Jan 8, 2025
7238682
Update Node.js to version 22.13.0
depfu[bot] Jan 9, 2025
350bf8d
Update postcss to version 8.4.49
depfu[bot] Jan 9, 2025
2875b4b
Update @rails/ujs to version 7.1.501
depfu[bot] Jan 9, 2025
eae764b
Merge pull request #4557 from sanger/depfu/update/yarn/@rails/ujs-7.1…
yoldas Jan 9, 2025
ad678b0
Merge pull request #4502 from sanger/depfu/update/yarn/postcss-8.4.49
yoldas Jan 9, 2025
8db61fe
Merge pull request #4588 from sanger/depfu/engine/yarn/nodejs-22.13.0
yoldas Jan 9, 2025
bcf93b1
Update Ruby to version 3.2.6
depfu[bot] Jan 9, 2025
5855031
Merge pull request #4479 from sanger/depfu/engine/ruby-3.2.6
yoldas Jan 9, 2025
edecf37
Update Ruby to version 3.3.6
depfu[bot] Jan 9, 2025
ee72d10
Merge pull request #4487 from sanger/depfu/engine/ruby-3.3.6
yoldas Jan 9, 2025
721fb23
Merge pull request #4525 from sanger/depfu/update/factory_bot_rails-6…
yoldas Jan 9, 2025
4262bc5
Update ruby-prof to version 1.7.1
depfu[bot] Jan 9, 2025
83a70ae
Merge pull request #4500 from sanger/depfu/update/ruby-prof-1.7.1
yoldas Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.11.0
22.13.0
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.5
3.3.6
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG CHIPSET=default

# Use the correct base image depending on the architecture
# For Apple M1 Chip, run: docker build --build-arg CHIPSET=m1 .
FROM ruby:3.2.5-slim AS base_default
FROM ruby:3.3.6-slim AS base_default
FROM --platform=linux/amd64 ruby:3.2.5-slim AS base_m1
FROM base_${CHIPSET} AS base

Expand Down
141 changes: 71 additions & 70 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,72 +34,72 @@ GEM
specs:
aasm (5.5.0)
concurrent-ruby (~> 1.0)
actioncable (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
actioncable (7.0.8.7)
actionpack (= 7.0.8.7)
activesupport (= 7.0.8.7)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
actionmailbox (7.0.8.7)
actionpack (= 7.0.8.7)
activejob (= 7.0.8.7)
activerecord (= 7.0.8.7)
activestorage (= 7.0.8.7)
activesupport (= 7.0.8.7)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.8.1)
actionpack (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activesupport (= 7.0.8.1)
actionmailer (7.0.8.7)
actionpack (= 7.0.8.7)
actionview (= 7.0.8.7)
activejob (= 7.0.8.7)
activesupport (= 7.0.8.7)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.8.1)
actionview (= 7.0.8.1)
activesupport (= 7.0.8.1)
actionpack (7.0.8.7)
actionview (= 7.0.8.7)
activesupport (= 7.0.8.7)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionpack-xml_parser (2.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
actiontext (7.0.8.1)
actionpack (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
actiontext (7.0.8.7)
actionpack (= 7.0.8.7)
activerecord (= 7.0.8.7)
activestorage (= 7.0.8.7)
activesupport (= 7.0.8.7)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.8.1)
activesupport (= 7.0.8.1)
actionview (7.0.8.7)
activesupport (= 7.0.8.7)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.8.1)
activesupport (= 7.0.8.1)
activejob (7.0.8.7)
activesupport (= 7.0.8.7)
globalid (>= 0.3.6)
activemodel (7.0.8.1)
activesupport (= 7.0.8.1)
activerecord (7.0.8.1)
activemodel (= 7.0.8.1)
activesupport (= 7.0.8.1)
activemodel (7.0.8.7)
activesupport (= 7.0.8.7)
activerecord (7.0.8.7)
activemodel (= 7.0.8.7)
activesupport (= 7.0.8.7)
activerecord-import (1.7.0)
activerecord (>= 4.2)
activestorage (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activesupport (= 7.0.8.1)
activestorage (7.0.8.7)
actionpack (= 7.0.8.7)
activejob (= 7.0.8.7)
activerecord (= 7.0.8.7)
activesupport (= 7.0.8.7)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.8.1)
activesupport (7.0.8.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -196,7 +196,7 @@ GEM
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.4.0)
date (3.4.1)
delayed_job (4.1.11)
activesupport (>= 3.0, < 8.0)
delayed_job_active_record (4.1.8)
Expand All @@ -206,14 +206,14 @@ GEM
docile (1.4.0)
domain_name (0.6.20240107)
dry-cli (1.0.0)
erubi (1.13.0)
erubi (1.13.1)
exception_notification (4.5.0)
actionmailer (>= 5.2, < 8)
activesupport (>= 5.2, < 8)
factory_bot (6.4.6)
factory_bot (6.5.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.4.3)
factory_bot (~> 6.4)
factory_bot_rails (6.4.4)
factory_bot (~> 6.5)
railties (>= 5.0.0)
ffi (1.16.3)
flipper (0.25.4)
Expand Down Expand Up @@ -257,7 +257,7 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.1)
loofah (2.23.1)
loofah (2.24.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
Expand All @@ -273,7 +273,7 @@ GEM
mime-types-data (3.2024.0305)
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.25.1)
minitest (5.25.4)
minitest-profiler (0.0.2)
activesupport (>= 4.1.0)
minitest (>= 5.3.3)
Expand All @@ -285,7 +285,7 @@ GEM
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
mysql2 (0.5.6)
net-imap (0.5.1)
net-imap (0.5.5)
date
net-protocol
net-ldap (0.19.0)
Expand All @@ -297,11 +297,11 @@ GEM
net-protocol
netrc (0.11.0)
nio4r (2.7.4)
nokogiri (1.16.7-arm64-darwin)
nokogiri (1.18.1-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-darwin)
nokogiri (1.18.1-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
nokogiri (1.18.1-x86_64-linux-gnu)
racc (~> 1.4)
ostruct (0.6.0)
parallel (1.26.3)
Expand Down Expand Up @@ -334,22 +334,22 @@ GEM
rack (~> 2.2, >= 2.2.4)
rack-proxy (0.7.7)
rack
rack-test (2.1.0)
rack-test (2.2.0)
rack (>= 1.3)
rails (7.0.8.1)
actioncable (= 7.0.8.1)
actionmailbox (= 7.0.8.1)
actionmailer (= 7.0.8.1)
actionpack (= 7.0.8.1)
actiontext (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activemodel (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
rails (7.0.8.7)
actioncable (= 7.0.8.7)
actionmailbox (= 7.0.8.7)
actionmailer (= 7.0.8.7)
actionpack (= 7.0.8.7)
actiontext (= 7.0.8.7)
actionview (= 7.0.8.7)
activejob (= 7.0.8.7)
activemodel (= 7.0.8.7)
activerecord (= 7.0.8.7)
activestorage (= 7.0.8.7)
activesupport (= 7.0.8.7)
bundler (>= 1.15.0)
railties (= 7.0.8.1)
railties (= 7.0.8.7)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -363,13 +363,13 @@ GEM
activesupport (>= 4.2)
choice (~> 0.2.0)
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.6.0)
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
nokogiri (~> 1.14)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
rails-perftest (0.0.7)
railties (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
railties (7.0.8.7)
actionpack (= 7.0.8.7)
activesupport (= 7.0.8.7)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand Down Expand Up @@ -454,7 +454,7 @@ GEM
rubocop-rspec (~> 3, >= 3.0.1)
ruby-graphviz (1.2.5)
rexml
ruby-prof (1.7.0)
ruby-prof (1.7.1)
ruby-progressbar (1.13.0)
ruby-units (4.0.3)
ruby-vips (2.2.1)
Expand Down Expand Up @@ -515,7 +515,7 @@ GEM
thor (1.3.2)
tilt (2.4.0)
timecop (0.9.10)
timeout (0.4.2)
timeout (0.4.3)
traceroute (0.8.1)
rails (>= 3.0.0)
tzinfo (2.0.6)
Expand All @@ -535,7 +535,8 @@ GEM
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket (1.2.11)
websocket-driver (0.7.6)
websocket-driver (0.7.7)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
whenever (1.0.0)
Expand Down
77 changes: 77 additions & 0 deletions app/controllers/api/v2/orders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,82 @@ class OrdersController < JSONAPI::ResourceController
# By default JSONAPI::ResourceController provides most the standard
# behaviour, and in many cases this file may be left empty.
end

class OrderProcessor < JSONAPI::Processor
before_create_resource :prepare_context

private

def prepare_context
context[:template] = find_template
context[:template_attributes] = template_attributes unless context[:template].nil?
end

def find_template
template_uuid = params[:data][:attributes][:submission_template_uuid]
return nil if template_uuid.nil? # No errors -- we just don't have a template.

template = SubmissionTemplate.with_uuid(template_uuid).first
raise JSONAPI::Exceptions::InvalidFieldValue.new(:submission_template_uuid, template_uuid) if template.nil?

template
end

def template_attributes
parameters = params[:data][:attributes][:submission_template_attributes]

raise JSONAPI::Exceptions::ParameterMissing, :submission_template_attributes if parameters.nil?

make_template_attributes(permitted_attributes(parameters))
end

def permitted_attributes(attributes)
attributes.permit(
{ asset_uuids: [], request_options: {} },
:autodetect_projects,
:autodetect_studies,
:user_uuid
)
end

def make_template_attributes(attributes)
{
assets: extract_assets(attributes),
autodetect_projects: attributes[:autodetect_projects],
autodetect_studies: attributes[:autodetect_studies],
request_options: require_attribute(attributes, :request_options),
user: extract_user(attributes)
}.compact
end

def extract_assets(attributes)
asset_uuids = require_attribute(attributes, :asset_uuids)
return nil if asset_uuids.nil?

asset_uuids.map do |uuid|
uuid_obj = Uuid.find_by(external_id: uuid)
raise JSONAPI::Exceptions::InvalidFieldValue.new(:asset_uuids, uuid) if uuid_obj.nil?
uuid_obj&.resource
end
end

def extract_user(attributes)
user_uuid = require_attribute(attributes, :user_uuid)
return nil if user_uuid.nil?

user = User.with_uuid(user_uuid).first
raise JSONAPI::Exceptions::InvalidFieldValue.new(:user_uuid, user_uuid) if user.nil?

user
end

def require_attribute(attributes, key)
value = attributes.require(key)
value = value.to_h if value.instance_of?(ActionController::Parameters) && value.permitted?
value
rescue ActionController::ParameterMissing
raise JSONAPI::Exceptions::ParameterMissing, "submission_template_attributes.#{key}"
end
end
end
end
Loading
Loading