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

Consultation Report QA #443

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
WITH related_objects AS (
SELECT hierarchy.id as object_id,
relation.objectcsid,
relation.subjectcsid as repatriation_csid
relation.subjectcsid as inventory_csid
FROM relations_common relation
INNER JOIN hierarchy on hierarchy.name = relation.objectcsid
WHERE relation.objectdocumenttype = 'CollectionObject'
AND relation.subjectdocumenttype = 'NagpraInventory'
$P!{whereclause_cte}
),
related_exits AS (
SELECT DISTINCT ON (objs.repatriation_csid, hierarchy.id) objs.objectcsid,
objs.repatriation_csid,
SELECT DISTINCT ON (objs.inventory_csid, hierarchy.id) objs.objectcsid,
objs.inventory_csid,
hierarchy.id as exit_id,
relation.subjectcsid as exit_csid
FROM related_objects objs
Expand Down Expand Up @@ -92,7 +92,7 @@ FROM hierarchy inv_hierarchy
-- Related Object - Object count
-- Use regex matching because the refnames can contain subsets of the others
-- a word boundary (\y) allows us to match start/ends of refnames easily
SELECT objs.repatriation_csid,
SELECT objs.inventory_csid,
sum(
CASE
WHEN ocg.objectcounttype ~ 'minimum' THEN ocg.objectcount
Expand All @@ -109,16 +109,16 @@ FROM hierarchy inv_hierarchy
INNER JOIN related_objects objs ON objs.object_id = ocg_hierarchy.parentid
INNER JOIN objectcountgroup ocg ON ocg.id = ocg_hierarchy.id
WHERE ocg_hierarchy.name = 'collectionobjects_common:objectCountGroupList'
GROUP BY objs.repatriation_csid
) object_count ON object_count.repatriation_csid = inv_hierarchy.name
GROUP BY objs.inventory_csid
) object_count ON object_count.inventory_csid = inv_hierarchy.name
LEFT JOIN (
-- Related Object - Field Collection Sites
SELECT objs.repatriation_csid,
SELECT objs.inventory_csid,
array_agg(fcs.item) AS sites
FROM collectionobjects_common_fieldcollectionsites fcs
INNER JOIN related_objects objs ON objs.object_id = fcs.id
GROUP BY objs.repatriation_csid
) field_collection_sites ON field_collection_sites.repatriation_csid = inv_hierarchy.name
GROUP BY objs.inventory_csid
) field_collection_sites ON field_collection_sites.inventory_csid = inv_hierarchy.name
LEFT JOIN (
-- Related Consultations (Inventory -> Consultation)
-- Number of Consultation Log Entries
Expand All @@ -138,14 +138,14 @@ FROM hierarchy inv_hierarchy
-- Related Object Exits (Object -> ObjectExit (New))
-- Current owner with exit date
-- Allows NULL values to aggregate so we don't lose track of pairs
SELECT related_exits.repatriation_csid,
SELECT related_exits.inventory_csid,
array_agg(exit.exitdate) as exit_dates,
array_agg(owners.item) AS exit_owners
FROM exits_common exit
INNER JOIN related_exits on related_exits.exit_id = exit.id
LEFT JOIN exits_common_owners owners on owners.id = exit.id AND owners.pos = 0
GROUP BY related_exits.repatriation_csid
) exits ON exits.repatriation_csid = inv_hierarchy.name
GROUP BY related_exits.inventory_csid
) exits ON exits.inventory_csid = inv_hierarchy.name
$P!{whereclause}]]>
</queryString>
<field name="inventorynumber" class="java.lang.String">
Expand Down Expand Up @@ -204,74 +204,74 @@ $P!{whereclause}]]>
<band splitType="Stretch" />
</background>
<columnHeader>
<band height="44" splitType="Stretch">
<band height="60" splitType="Stretch">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout" />
<property name="com.jaspersoft.studio.unit.height" value="px" />
<staticText>
<reportElement style="Column header" x="0" y="0" width="100" height="44" uuid="581e80a8-aa61-4dda-b9f5-7f2155efb0c9">
<reportElement style="Column header" x="0" y="0" width="100" height="60" uuid="581e80a8-aa61-4dda-b9f5-7f2155efb0c9">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Organization(s)]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="100" y="0" width="100" height="44" uuid="6b5ebc64-5ae1-45c2-a327-0aeff2b2dbf5">
<reportElement style="Column header" x="100" y="0" width="100" height="60" uuid="6b5ebc64-5ae1-45c2-a327-0aeff2b2dbf5">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[NAGPRA Inventory Origination Date]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="200" y="0" width="100" height="44" uuid="24339136-4f9e-47d7-93f2-c16421e86c3d">
<reportElement style="Column header" x="200" y="0" width="100" height="60" uuid="24339136-4f9e-47d7-93f2-c16421e86c3d">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Inventory/Documentation Number]]></text>
<text><![CDATA[Inventory / Documentation Number]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="300" y="0" width="100" height="44" uuid="8413cd45-695a-4b51-8cab-df5cf012e78e">
<reportElement style="Column header" x="300" y="0" width="100" height="60" uuid="8413cd45-695a-4b51-8cab-df5cf012e78e">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Inventory Title]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="400" y="0" width="100" height="44" uuid="b279c2bd-3ba8-42e1-ab37-e39960f788d0">
<reportElement style="Column header" x="400" y="0" width="100" height="60" uuid="b279c2bd-3ba8-42e1-ab37-e39960f788d0">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[NAGPRA Inventory - Inventory Status]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="500" y="0" width="100" height="44" uuid="fe192ec5-2760-4e5f-80bf-6babeb8e2516">
<reportElement style="Column header" x="500" y="0" width="100" height="60" uuid="fe192ec5-2760-4e5f-80bf-6babeb8e2516">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[MNI Count]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="600" y="0" width="100" height="44" uuid="2fb0a6b9-bb96-44a8-9575-cb34cee53de2">
<reportElement style="Column header" x="600" y="0" width="100" height="60" uuid="2fb0a6b9-bb96-44a8-9575-cb34cee53de2">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[AFO Lot Count]]></text>
<text><![CDATA[AFO Count]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="700" y="0" width="100" height="44" uuid="c3bc7e35-43d8-4446-acba-f7ef559a54b2">
<reportElement style="Column header" x="700" y="0" width="100" height="60" uuid="c3bc7e35-43d8-4446-acba-f7ef559a54b2">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Archaeological Sites Related to NAGPRA Inventory]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="800" y="0" width="100" height="44" uuid="1ccb6b44-add8-4be3-8b1e-6babd829939c">
<reportElement style="Column header" x="800" y="0" width="100" height="60" uuid="1ccb6b44-add8-4be3-8b1e-6babd829939c">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Number of Associated Consultation Log Entries]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="900" y="0" width="100" height="44" uuid="77fe4cfa-6cd6-406e-9125-dd513caf64db">
<reportElement style="Column header" x="900" y="0" width="100" height="60" uuid="77fe4cfa-6cd6-406e-9125-dd513caf64db">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
Expand All @@ -293,7 +293,7 @@ $P!{whereclause}]]>
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
<textFieldExpression>
<![CDATA[$F{originationdate} !== null ? java.lang.String.format("%tF", $F{originationdate}) : '']]>
<![CDATA[$F{originationdate} !== null ? $F{originationdate}.toLocalDateTime().toLocalDate() : '']]>
</textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
Expand All @@ -312,7 +312,10 @@ $P!{whereclause}]]>
<reportElement style="Detail" x="400" y="0" width="100" height="30" uuid="09a21589-e9f4-4b31-8dcd-d989540c1b77">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
<textFieldExpression><![CDATA[$F{inventorystatus}]]></textFieldExpression>
<textFieldExpression><![CDATA[
var date = $F{inventorydate} !== null ? '(' + $F{inventorydate}.toLocalDateTime().toLocalDate() + ')' : '';
$F{inventorystatus} !== null ? $F{inventorystatus} + ' ' + date : date]]>
</textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" x="500" y="0" width="100" height="30" uuid="c2c43e42-0fc1-4fad-b5bb-d8c62b534524">
Expand Down Expand Up @@ -348,7 +351,7 @@ $P!{whereclause}]]>
if (!owner) {
return null;
}
return dates[index] === null ? owner : java.lang.String.format("%s (%tF)", owner, dates[index]);
return dates[index] === null ? owner : owner + ' (' + dates[index].toLocalDateTime().toLocalDate() + ')';
}).filter(owner => !!owner).join('; ')
]]>
</textFieldExpression>
Expand Down
Loading