Makulierte Exemplare zu Beginn löschen

This commit is contained in:
Felix Lohmeier 2021-01-09 13:52:06 +01:00
parent 7d1a87b294
commit 7e45458b9e
2 changed files with 119 additions and 48 deletions

View File

@ -63,6 +63,125 @@ echo
checkpoint "Transform"; echo
# ------------------------- Makulierte Medien löschen ------------------------ #
# spec_Z_03
# löscht alle Titel und deren Exemplare, die nur makulierte Ex. enthalten
# löscht dann alle verbliebenen makulierten Ex.
echo "Makulierte Medien löschen..."
if curl -fs \
--data project="${projects[$p]}" \
--data-urlencode "operations@-" \
"${endpoint}/command/core/apply-operations$(refine_csrf)" > /dev/null \
<< "JSON"
[
{
"op": "core/column-addition",
"engineConfig": {
"facets": [
{
"type": "text",
"name": "Column 1",
"columnName": "Column 1",
"query": "*********M",
"mode": "text",
"caseSensitive": false,
"invert": false
}
],
"mode": "record-based"
},
"baseColumnName": "Column 1",
"expression": "grel:value",
"onError": "set-to-blank",
"newColumnName": "tmp",
"columnInsertIndex": 1
},
{
"op": "core/column-move",
"columnName": "tmp",
"index": 0
},
{
"op": "core/row-removal",
"engineConfig": {
"facets": [
{
"type": "list",
"name": "Column 1",
"expression": "grel:if(isNonBlank(cells['tmp'].value),with(row.record.cells[columnName].value.join('').find(/EXSTA ./).uniques().join(''),v,v),null)",
"columnName": "Column 1",
"invert": false,
"omitBlank": false,
"omitError": false,
"selection": [
{
"v": {
"v": "EXSTA M",
"l": "EXSTA M"
}
}
],
"selectBlank": false,
"selectError": false
}
],
"mode": "record-based"
}
},
{
"op": "core/text-transform",
"engineConfig": {
"facets": [
{
"type": "text",
"name": "Column 1",
"columnName": "Column 1",
"query": "*********E",
"mode": "text",
"caseSensitive": false,
"invert": false
}
],
"mode": "row-based"
},
"columnName": "tmp",
"expression": "grel:cells['Column 1'].value",
"onError": "keep-original",
"repeat": false,
"repeatCount": 10
},
{
"op": "core/row-removal",
"engineConfig": {
"facets": [
{
"type": "text",
"name": "Column 1",
"columnName": "Column 1",
"query": "EXSTA M",
"mode": "text",
"caseSensitive": false,
"invert": false
}
],
"mode": "record-based"
}
},
{
"op": "core/column-removal",
"columnName": "tmp"
}
]
JSON
then
log "transformed ${p} (${projects[$p]})"
else
error "transform ${p} (${projects[$p]}) failed!"
fi
echo
# ---------------------- Mehrzeilige Inhalte extrahieren --------------------- #
# - Column 1 > Text filter > regular expression aktivieren > ^\* > invert

View File

@ -328,54 +328,6 @@ else
fi
echo
# ------------------------- Makulierte Medien löschen ------------------------ #
# spec_Z_03
# löscht alle Titel+Exemplare, die ausschließlich makulierte Ex. enthalten
echo "Makulierte Medien löschen..."
if curl -fs \
--data project="${projects[$p]}" \
--data-urlencode "operations@-" \
"${endpoint}/command/core/apply-operations$(refine_csrf)" > /dev/null \
<< "JSON"
[
{
"op": "core/row-removal",
"engineConfig": {
"facets": [
{
"type": "list",
"name": "E|EXSTA",
"expression": "grel:row.record.cells[columnName].value.uniques().join(',') == 'M'",
"columnName": "E|EXSTA",
"invert": false,
"omitBlank": false,
"omitError": false,
"selection": [
{
"v": {
"v": true,
"l": "true"
}
}
],
"selectBlank": false,
"selectError": false
}
],
"mode": "record-based"
}
}
]
JSON
then
log "transformed ${p} (${projects[$p]})"
else
error "transform ${p} (${projects[$p]}) failed!"
fi
echo
# ------------------------------------ File ---------------------------------- #
echo "Bibliothekskürzel aus Import-Dateiname..."