mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #12994 from mkllnk/dfc-update-voc
Add new DFC vocabulary for order states
This commit is contained in:
@@ -36,7 +36,7 @@ class FdcBackorderer
|
||||
.map { |id| find_order(id) }
|
||||
.compact
|
||||
# Just in case someone completed the order without updating our database:
|
||||
.select { |o| o.orderStatus[:path] == "Held" }
|
||||
.select { |o| o.orderStatus == order_status.HELD }
|
||||
.first
|
||||
# The DFC Connector doesn't recognise status values properly yet.
|
||||
# So we are overriding the value with something that can be exported.
|
||||
@@ -52,7 +52,7 @@ class FdcBackorderer
|
||||
def find_last_open_order
|
||||
graph = import(urls.orders_url)
|
||||
open_orders = graph&.select do |o|
|
||||
o.semanticType == "dfc-b:Order" && o.orderStatus[:path] == "Held"
|
||||
o.semanticType == "dfc-b:Order" && o.orderStatus == order_status.HELD
|
||||
end
|
||||
|
||||
return if open_orders.blank?
|
||||
@@ -160,4 +160,10 @@ class FdcBackorderer
|
||||
session.semanticId = urls.sale_session_url
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def order_status
|
||||
DfcLoader.vocabulary("vocabulary").STATES.ORDERSTATE
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,8 +33,7 @@ class FdcOfferBroker
|
||||
production_flow = catalog_item("#{product_id}/AsPlannedProductionFlow")
|
||||
|
||||
if production_flow
|
||||
wholesale_product_id = production_flow.product
|
||||
catalog_item(wholesale_product_id)
|
||||
production_flow.product
|
||||
else
|
||||
# We didn't find a wholesale variant, falling back to the given product.
|
||||
catalog_item(product_id)
|
||||
@@ -57,7 +56,7 @@ class FdcOfferBroker
|
||||
consumption_flow = catalog_item(
|
||||
production_flow.semanticId.sub("AsPlannedProductionFlow", "AsPlannedConsumptionFlow")
|
||||
)
|
||||
retail_product_id = consumption_flow.product
|
||||
retail_product_id = consumption_flow.product.semanticId
|
||||
|
||||
contained_quantity = consumption_flow.quantity.value.to_i
|
||||
|
||||
@@ -77,7 +76,7 @@ class FdcOfferBroker
|
||||
end
|
||||
|
||||
def flow_producing(wholesale_product_id)
|
||||
@production_flows_by_product_id ||= production_flows.index_by(&:product)
|
||||
@production_flows_by_product_id ||= production_flows.index_by { |flow| flow.product.semanticId }
|
||||
@production_flows_by_product_id[wholesale_product_id]
|
||||
end
|
||||
|
||||
|
||||
@@ -2,15 +2,31 @@
|
||||
|
||||
class DfcLoader
|
||||
def self.connector
|
||||
@connector ||= load_vocabularies
|
||||
unless @connector
|
||||
@connector = DataFoodConsortium::Connector::Connector.instance
|
||||
load_context
|
||||
load_vocabularies
|
||||
end
|
||||
|
||||
@connector
|
||||
end
|
||||
|
||||
def self.load_context
|
||||
JSON::LD::Context.add_preloaded("http://www.datafoodconsortium.org/") {
|
||||
JSON::LD::Context.parse(read_file("context_1.8.2")["@context"])
|
||||
}
|
||||
end
|
||||
|
||||
def self.vocabulary(name)
|
||||
@vocabs ||= {}
|
||||
@vocabs[name] ||= connector.__send__(:loadThesaurus, read_file(name))
|
||||
end
|
||||
|
||||
def self.load_vocabularies
|
||||
connector = DataFoodConsortium::Connector::Connector.instance
|
||||
connector.loadMeasures(read_file("measures"))
|
||||
connector.loadFacets(read_file("facets"))
|
||||
connector.loadProductTypes(read_file("productTypes"))
|
||||
connector
|
||||
vocabulary("vocabulary") # order states etc
|
||||
end
|
||||
|
||||
def self.read_file(name)
|
||||
|
||||
@@ -9,3 +9,4 @@ mkdir -p "$dst"
|
||||
curl --location "$src/facets.json" > "$dst/facets.json"
|
||||
curl --location "$src/measures.json" > "$dst/measures.json"
|
||||
curl --location "$src/productTypes.json" > "$dst/productTypes.json"
|
||||
curl --location "$src/vocabulary.json" > "$dst/vocabulary.json"
|
||||
|
||||
@@ -9,6 +9,12 @@ RSpec.describe DfcIo do
|
||||
let(:enterprise) do
|
||||
DataFoodConsortium::Connector::Enterprise.new("Pete's Pumpkins")
|
||||
end
|
||||
let(:order) do
|
||||
DataFoodConsortium::Connector::Order.new("https://example.net", orderStatus: orderstate.HELD)
|
||||
end
|
||||
let(:orderstate) do
|
||||
DfcLoader.vocabulary("vocabulary").STATES.ORDERSTATE
|
||||
end
|
||||
|
||||
describe ".export" do
|
||||
it "exports nothing" do
|
||||
@@ -33,5 +39,20 @@ RSpec.describe DfcIo do
|
||||
*%w(@id @type dfc-b:affiliates)
|
||||
)
|
||||
end
|
||||
|
||||
it "recognises loaded vocabularies" do
|
||||
json = DfcIo.export(order)
|
||||
result = JSON.parse(json)
|
||||
|
||||
expect(result["dfc-b:hasOrderStatus"]).to eq "dfc-v:Held"
|
||||
end
|
||||
end
|
||||
|
||||
describe ".import" do
|
||||
it "recognises loaded vocabularies" do
|
||||
result = DfcIo.import(DfcIo.export(order))
|
||||
|
||||
expect(result.orderStatus).to eq orderstate.HELD
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,4 +21,10 @@ RSpec.describe DfcLoader do
|
||||
)
|
||||
expect(result["dfc-b:name"]).to eq "Tomato"
|
||||
end
|
||||
|
||||
it "loads vocabularies" do
|
||||
terms = DfcLoader.vocabulary("vocabulary")
|
||||
expect(terms.STATES.ORDERSTATE.HELD.semanticId)
|
||||
.to eq "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#Held"
|
||||
end
|
||||
end
|
||||
|
||||
450
engines/dfc_provider/vendor/context_1.8.2.json
vendored
Normal file
450
engines/dfc_provider/vendor/context_1.8.2.json
vendored
Normal file
@@ -0,0 +1,450 @@
|
||||
{
|
||||
"@context": {
|
||||
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
||||
"skos" : "http://www.w3.org/2004/02/skos/core#",
|
||||
"dfc": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#",
|
||||
"dc": "http://purl.org/dc/elements/1.1/#",
|
||||
"dfc-b": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#",
|
||||
"dfc-t": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_TechnicalOntology.owl#",
|
||||
"dfc-m": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/measures.rdf#",
|
||||
"dfc-pt": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/productTypes.rdf#",
|
||||
"dfc-f": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#",
|
||||
"dfc-v": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#",
|
||||
"ontosec": "http://www.semanticweb.org/ontologies/2008/11/OntologySecurity.owl#",
|
||||
"dfc-b:DFC_BusinessOntology_ObjectProperty": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:DFC_Interface_Property": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:addressOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:affiliatedTo": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:affiliates": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:allergenCharacteristicOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:belongsTo": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:brandOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:certificateOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:characteristicOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:claimOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:composedOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:composes": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:concernedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:concerns": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:constituedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:constitutes": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:consumedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:consumes": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:containerInformationOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:coordinatedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:coordinates": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:definedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:defines": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:deliveredAt": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:facetOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:from": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:geographicalOriginOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasAddress": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasAllergenCharacteristic": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasAllergenDimension": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasBrand": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasCertification": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasCharacteristic": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasClaim": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasContainerInformation": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasDimension": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasFacet": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasFulfilmentStatus": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasGeographicalOrigin": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasIngredient": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasInput": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasLabellingCharacteristic": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasLabellingDimension": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasMainContact": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasNatureOrigin": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasNutrientCharacteristic": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasNutrientDimension": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasObject": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasOffer": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasOption": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasOrderStatus": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasOutput": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasPart": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasPartOrigin": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasPaymentMethod": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasPaymentStatus": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasPhoneNumber": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasPhysicalCharacteristic": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasPhysicalDimension": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasPrice": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasProcess": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasQuantity": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasReference": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasSocialMedia": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasStatus": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasTemperature": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasTransformationType": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasType": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hasUnit": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:holds": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hostedAt": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:hosts": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:identifiedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:identifies": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:industrializedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:industrializes": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:inputOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:isIngredientOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:isPriceOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:isTemperatureOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:labellingCharacteristicOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:listedIn": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:lists": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:localizedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:localizes": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:mainContactOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:maintainedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:maintains": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:managedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:manages": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:natureOriginOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:nutrientCharacteristicOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:objectOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:offeredThrough": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:offers": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:offersTo": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:optionOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:orderedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:orders": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:outputOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:ownedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:owns": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:paidWith": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:partOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:partOriginOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:phoneNumberOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:physicalCharacteristicOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:pickedUpAt": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:processOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:producedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:produces": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:proposedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:proposes": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:referenceOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:referencedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:references": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:refersTo": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:representedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:represents": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:requestedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:requests": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:satisfiedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:satisfies": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:selectedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:selects": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:sells": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:socialMediaOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:soldBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:storedIn": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:stores": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:suppliedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:supplies": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:suppliesTo": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:to": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:tracedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:traces": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:transformedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:transforms": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:typeOf": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-b:uses": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-t:represent": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-t:hasPivot": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-t:hostedBy": {
|
||||
"@type": "@id"
|
||||
},
|
||||
"dfc-t:owner": {
|
||||
"@type": "@id"
|
||||
}
|
||||
}
|
||||
}
|
||||
351
engines/dfc_provider/vendor/vocabulary.json
vendored
Normal file
351
engines/dfc_provider/vendor/vocabulary.json
vendored
Normal file
@@ -0,0 +1,351 @@
|
||||
[ {
|
||||
"@graph" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#",
|
||||
"@type" : [ "http://www.w3.org/2002/07/owl#Ontology" ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#Cancelled",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#OrderState"
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#PaymentState"
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#FulfilmentState"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Cancelled"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#Complete",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#OrderState"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Complete"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#ConceptScheme" ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "DFC_Vocabulary"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#Draft",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#OrderState"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Draft"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#Fulfilled",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#FulfilmentState"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Fulfilled"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#FulfilmentState",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#States"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Fulfilment state"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#Held",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#OrderState"
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#FulfilmentState"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Held"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#OrderState",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#States"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Order state"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#Paid",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#PaymentState"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Paid"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#PaymentState",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#States"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Payment state"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#States",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "States"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#topConceptOf" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#Unfulfilled",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#FulfilmentState"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Unfulfilled"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#Unpaid",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#PaymentState"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Unpaid"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#accept",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "accept"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#c_734fc709",
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "FulfilmentState"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#combine",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "combine"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#consume",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "consume"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#dropoff",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "dropoff"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#lower",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "lower"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#modify",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "modify"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#move",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "move"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#pickup",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "pickup"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#produce",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "produce"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#raise",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "raise"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#separate",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "separate"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Transformation type"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#topConceptOf" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#use",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#transformationType"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#DFC_Vocabulary"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "use"
|
||||
} ]
|
||||
} ],
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#"
|
||||
} ]
|
||||
@@ -36,6 +36,7 @@ RSpec.describe CompleteBackorderJob do
|
||||
let(:beans) { ofn_order.line_items[0].variant }
|
||||
let(:chia) { chia_item.variant }
|
||||
let(:chia_item) { ofn_order.line_items[1] }
|
||||
let(:order_status) { DfcLoader.vocabulary("vocabulary").STATES.ORDERSTATE }
|
||||
|
||||
describe "#perform" do
|
||||
before do
|
||||
@@ -69,8 +70,8 @@ RSpec.describe CompleteBackorderJob do
|
||||
subject.perform(user, distributor, order_cycle, order.semanticId)
|
||||
current_order = orderer.find_order(order.semanticId)
|
||||
}.to change {
|
||||
current_order.orderStatus[:path]
|
||||
}.from("Held").to("Complete")
|
||||
current_order.orderStatus
|
||||
}.from(order_status.HELD).to(order_status.COMPLETE)
|
||||
.and change {
|
||||
current_order.lines[0].quantity.to_i
|
||||
}.from(3).to(2)
|
||||
@@ -99,8 +100,8 @@ RSpec.describe CompleteBackorderJob do
|
||||
subject.perform(user, distributor, order_cycle, order.semanticId)
|
||||
current_order = orderer.find_order(order.semanticId)
|
||||
}.to change {
|
||||
current_order.orderStatus[:path]
|
||||
}.from("Held").to("Complete")
|
||||
current_order.orderStatus
|
||||
}.from(order_status.HELD).to(order_status.COMPLETE)
|
||||
.and change {
|
||||
current_order.lines.count
|
||||
}.from(1).to(0)
|
||||
|
||||
Reference in New Issue
Block a user