diff --git a/src/modules/otus/components/Panel/PanelInventory/PanelInventory.vue b/src/modules/otus/components/Panel/PanelInventory/PanelInventory.vue
index fffa445..a7380cd 100644
--- a/src/modules/otus/components/Panel/PanelInventory/PanelInventory.vue
+++ b/src/modules/otus/components/Panel/PanelInventory/PanelInventory.vue
@@ -8,10 +8,35 @@
/>
- Collection Objects
+
+ Inventory
+ [{{inventory.length}}]
+
+
+
+ Collection Objects
+ [{{collectionObjects.length}}]
+
+
+
+ -
+
+
+ {{ collectionObject.id }} — length {{JSON.stringify(collectionObject).length}}
+
+
+ -
+ {{ entry[0] }}: {{ entry[1] }}
+
+
+
+
+
+
+
Inventory
@@ -21,12 +46,12 @@
{{ makeInventoryLabel(inventoryItem) }}
-
+
-
- Full Record
+ Full Record ({{Object.keys(inventoryItem).length}} items)
-
+
- {{ entry[0] }}
- {{ entry[1] }}
@@ -37,23 +62,6 @@
- Collection Objects
-
-
- -
-
-
- {{ collectionObject.id }} — length {{JSON.stringify(collectionObject).length}}
-
-
- -
- {{ entry[0] }}: {{ entry[1] }}
-
-
-
-
-
-
@@ -89,11 +97,11 @@ function makeInventoryDetails(item) {
return [
makeInventoryCollectionDate(item),
item.recordedBy && `Recorded by ${item.recordedBy}`,
- item.identifiedBy && `Identified by ${item.identifiedBy}, ${item.dateIdentified}`,
+ makeIdentifiedByDesccription(item),
item.georeferencedBy && `Georeferenced by ${item.georeferencedBy}${makeGeoreferenceUncertainty(item)}`,
// CollectionObject #1234
item.dwc_occurrence_object_id && `${item.dwc_occurrence_object_type} #${item.dwc_occurrence_object_id}`,
- ]
+ ].filter(Boolean)
}
function makeLocationDescription(item) {
@@ -104,6 +112,13 @@ function makeLocationDescription(item) {
].filter(Boolean).join(", ")
}
+function makeIdentifiedByDesccription(item) {
+ return [
+ item.identifiedBy && `Identified by ${item.identifiedBy}`,
+ item.dateIdentified,
+ ].filter(Boolean).join(", ")
+}
+
function makeInventoryCollectionDate(item) {
if (!item.year) return null
const date = new Date(item.year, item.month, item.day)
@@ -128,7 +143,7 @@ watch(
TaxonWorks.getCollectionObjects(props.otuId)
).then(({data}) => {
collectionObjects.value = data
- console.log(data)
+ console.log('CollectionObjects', data)
}).catch(
e => collectionObjects.value = `Error: ${e}`
).finally(() => isLoading.value = {...isLoading.value, collectionObjects: false})
@@ -146,10 +161,10 @@ watch(
isLoading.value = {...isLoading.value, inventory: true}
useOtuPageRequest('panel:inventory', () =>
- TaxonWorks.getInventory(props.otuId)
+ TaxonWorks.getInventoryDarwinCore(props.otuId)
).then(({data}) => {
inventory.value = data
- console.log(data)
+ console.log('Inventory (Darwin Core)', data)
}).catch(
e => inventory.value = `Error: ${e}`
).finally(() => isLoading.value = {...isLoading.value, inventory: false})
diff --git a/src/modules/otus/services/TaxonWorks.js b/src/modules/otus/services/TaxonWorks.js
index 9c11a45..9a29d57 100644
--- a/src/modules/otus/services/TaxonWorks.js
+++ b/src/modules/otus/services/TaxonWorks.js
@@ -62,7 +62,9 @@ export default class TaxonWorks {
// Note that this could support multiple OTUs.
// The API takes a comma-separated list of OTU IDs.
static getCollectionObjects(otuId, opt) {
- // See taxonworks/lib/collection_object/filter.rb Queries:CollectionObject:Filter for full list of options
+ return makeAPIRequest.get(`/collection_objects?otu_id[]=${otuId}`, opt)
+ // See taxonworks/lib/collection_object/filter.rb Queries:CollectionObject:Filter for full list of options.
+ // However, none seems to change the result.
/*
@with_buffered_collecting_event = boolean_param(params, :with_buffered_collecting_event)
@with_buffered_determinations = boolean_param(params, :with_buffered_determinations)
@@ -70,11 +72,10 @@ export default class TaxonWorks {
*/
// return makeAPIRequest.get(`/collection_objects?otu_id[]=${otuId}&with_buffered_determination=true`, opt)
// return makeAPIRequest.get(`/collection_objects?otu_id[]=${otuId}&descendants=true`, opt)
- return makeAPIRequest.get(`/collection_objects?otu_id[]=${otuId}`, opt)
// return makeAPIRequest.get(`/collection_objects?otu_id[]=${otuId}/dwc.json`, opt)
}
- static getInventory(otuId, opt) {
+ static getInventoryDarwinCore(otuId, opt) {
return makeAPIRequest.get(`/otus/${otuId}/inventory/dwc.json`, opt)
}