-
-
Notifications
You must be signed in to change notification settings - Fork 572
Closed
Labels
CRITICALThis issue rolled a natural 20 and needs to be addressed with high priorityThis issue rolled a natural 20 and needs to be addressed with high priorityIn Progressrefactor
Milestone
Description
After discussing this extensively at the conference, here's the current Barcoding paradigm that I think we're going to use going forward:
Global Barcode Items
- They are instances of
BarcodeItemfor whichbarcode_item.global? == true - These can only be created by SuperAdmins, but they are visible to all
- They only ever point to
CanonicalItemrecords (via the:barcodeablepolymorphic association) - A single
CanonicalItemmay have multiple globalBarcodeItems pointing to it ("Huggies 4T, 30ct", "Pampers 4T 30ct" and "Luvs 4T 30ct" would all point to the "4T" `) - These represent the "fall-through" barcode item values
"Local" Barcode items
- They are instances of
BarcodeItemfor whichbarcode_item.global? == false - These can be created by anyone, but are scoped to the organization
- They only ever point to
Itemrecords (via the:barcodeablepolymorphic association) - A single
Itemcan also have multipleBarcodeItems pointing to it, but the composite of:barcode_value+:organization_idmust be unique (ie. a single organization cannot use the same barcode to point to multiple types) - These barcode values take precedence over globals because the user created them
Querying Barcodes
- When an organization does a barcode lookup, it should return a single record, the first result of a set that is ranked by Local first, then Global
- When there is only Global result (which map to a
CanonicalItem), it will need to do a followup query to locate the oldestItemthat the organization has that matches thatCanonicalItemtype (older results are more likely to be generic). - If nothing matches that, then there is no BarcodeItem defined for that item and it should raise a
RecordNotFoundand the controller should return a:404status.
User Interface for Organizations (opining a bit here)
- Remove the "Include barcodes that are globally available" filter
- Only display Local barcodes in the organization namespace
- Add the ability to filter by Base Item type (finish Tweak the
Item/CanonicalItemassociation to use thepartner_keytrait instead of the integer key #588 first) - Remove the "Global" column from the organization namespace
-
Have "Add Another Barcode" display the barcode modal, if possible, and then refresh the table - Have a field to allow users to do barcode lookups from the
BarcodeItems#indexview -- boop a barcode and it filters to only show that result (Create a:by_valuescope and then add it to the filters section)
User Interface for Admins
these are being moved over to #326 since they don't yet exist
- Default view for
Admin::BarcodeItems#indexis global only (we will likely need to addwill_paginate) - Filter on canonical item
- Filter on "global?"
- Filter on barcode value
- Filter on organization
- Add New Barcode for adding new Global barcodes (mapping to canonical items only)
- Create a new action / view that creates a report of commonly used barcode values across multiple organizations
For "Clean up" we just need to audit these files to ensure they are in-line with the above behaviors:
/app/models/barcode_item.rb
/app/controllers/admin/barcode_items_controller.rb
/app/controllers/barcode_items_controller.rb
/app/views/admin/barcode_items/*
/app/views/barcode_items/*
/spec/controllers/admin/barcode_items_controller.rb
/spec/controllers/barcode_items_controller.rb
/spec/factories/barcode_items.rb
/spec/features/admin/barcode_items_spec.rb
/spec/features/barcode_items_spec.rb
/spec/models/barcode_item_spec.rb
/spec/support/barcode_helper.rbSome of them may already be OK but we'll need to assess all of them to be sure.
Metadata
Metadata
Assignees
Labels
CRITICALThis issue rolled a natural 20 and needs to be addressed with high priorityThis issue rolled a natural 20 and needs to be addressed with high priorityIn Progressrefactor