Skip to content

Commit e3cb67c

Browse files
committed
correct update scripts
1 parent 51ef36b commit e3cb67c

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

repo/backend/fragments_register_builder.xqm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ declare function fragments:handleCiteStructure($bdd as xs:string, $resource as e
115115
for $cite in $citeStructure/tei:citeStructure
116116
return
117117
fragments:handleCiteStructure($bdd, $resource, $ref, $cite, $level + 1, $resourceId, $node-id, $node-id, $maxCiteDepth, $csv)
118-
else ()
119118
)
120119
};
121120

scripts/add_document.xq

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,20 @@ declare variable $docPath external := ();
1414
if (file:exists($docPath))
1515
then
1616
let $parentIds :=
17-
let $path := substring-after($docPath, "data/")
17+
let $pathInData := substring-after($docPath, "data/")
18+
let $pathCollection := functx:substring-before-last($pathInData, "/")
19+
let $collectionId := if (contains($pathCollection, "/")) then functx:substring-after-last($pathCollection, "/") else $pathCollection
1820
return
19-
let $collId := if (contains($path, "/")) then functx:substring-after-last(replace($path, "/", ""), "/") else "project"
20-
return $collId
21-
let $coll := db:get($dbName, $G:resourcesRegister)//dots:collection[@dtsResourceId = $parentIds]
21+
$collectionId
2222
return
23-
if ($parentIds = "project" or $coll)
24-
then
25-
(
26-
add_doc:handleAddition($dbName, $docPath),
27-
script:success(("Le document a bien été ajouté à la base ", $dbName, "."))
28-
)
23+
let $coll := if ($parentIds = "") then "project" else db:get($dbName, $G:resourcesRegister)//dots:collection[@dtsResourceId = $parentIds]
24+
return
25+
if ($parentIds = "project" or $coll)
26+
then
27+
(
28+
add_doc:handleAddition($dbName, $docPath),
29+
script:success(("Le document a bien été ajouté à la base ", $dbName, "."))
30+
)
2931
else script:error("La collection n'existe pas.")
3032
else
3133
script:error("Le fichier n'existe pas.")

scripts/update_document.xq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ then
3030
return
3131
$collectionId
3232
return
33-
let $coll := if ($parentIds = "") then $parentIds else db:get($dbName, $G:resourcesRegister)//dots:collection[@dtsResourceId = $parentIds]
33+
let $coll := if ($parentIds = "") then "project" else db:get($dbName, $G:resourcesRegister)//dots:collection[@dtsResourceId = $parentIds]
3434
return
3535
if ($parentIds = "project" or $coll)
3636
then

0 commit comments

Comments
 (0)