Skip to content

Commit

Permalink
Merge pull request #610 from hbz/almaUpdates
Browse files Browse the repository at this point in the history
Alma updates for email feedback by I.N.
  • Loading branch information
fsteeg authored May 2, 2023
2 parents 14ecf44 + 851243c commit 0e6773d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/controllers/nwbib/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ public static Promise<Result> show(final String id) {
Logger.warn("No pagination session data for {}", id);
}
String cleanId = id.replace("#!", "");
String q = String.format("id:\"%s\" OR hbzId:%s OR almaMmsId:%s",
Lobid.longId(cleanId), cleanId, cleanId);
String q = String.format("id:\"%s\" OR hbzId:%s OR almaMmsId:%s OR zdbId:%s",
Lobid.longId(cleanId), cleanId, cleanId, cleanId);
return search(q, "", "", "", "", "", "", "", "", "", 0, 1, "", "", "", true,
"", "", "", "", "");
}
Expand Down
14 changes: 9 additions & 5 deletions app/controllers/nwbib/Lobid.java
Original file line number Diff line number Diff line change
Expand Up @@ -775,12 +775,16 @@ public static boolean compareIsil(String i1, String i2) {
// use secondary if main is equal, e.g. DE-5-11 before DE-5-20
return numerical(all1[2]) < numerical(all2[2]);
}
} else if (all1[1].equals(all2[1])) {
// same main sigel, prefer shorter, e.g. DE-5 before DE-5-11
return all1.length < all2.length;
} else if (all1.length == 2 && all2.length == 2) {
if (all1[1].equals(all2[1])) {
// same main sigel, prefer shorter, e.g. DE-5 before DE-5-11
return all1.length < all2.length;
}
// compare by main sigel, e.g. DE-5 before DE-6:
return numerical(all1[1]) < numerical(all2[1]);
}
// compare by main sigel, e.g. DE-5 before DE-6:
return numerical(all1[1]) < numerical(all2[1]);
// not actually an ISIL, compare given values as numbers:
return numerical(i1) < numerical(i2);
}

/**
Expand Down
16 changes: 11 additions & 5 deletions app/views/tags/result_doc.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,16 @@
}

@part_of(field: String, subField: String) = {
@if(!(doc \ field).isInstanceOf[JsUndefined]){
@Html(TableRow.VALUES_MULTI.process(new com.fasterxml.jackson.databind.ObjectMapper().readTree(doc.toString()),
@if(!(doc \ field).isInstanceOf[JsUndefined]){
@defining((doc \ field).as[Seq[JsValue]].sortBy((v: JsValue) => (v\"numbering").isInstanceOf[JsUndefined]).get(0)) { case (isPartOf) =>
@Html(TableRow.VALUES_MULTI.process(new com.fasterxml.jackson.databind.ObjectMapper().readTree(String.format("{\"%s\":[%s]}", field, isPartOf)),
field,
"q",
if(((doc \ field)(0) \ "numbering").asOpt[String].isDefined) {"Erschienen als"} else {"Erschienen in"},
Seq((((doc \ field)(0) \ subField)(0) \ "id").asOpt[String].getOrElse("--")),
if((isPartOf \ "numbering").asOpt[String].isDefined) {"Erschienen als"} else {"Erschienen in"},
Seq(((isPartOf \ subField)(0) \ "id").asOpt[String].getOrElse("--")),
Optional.of(Seq(subField, "numbering"))))
}
}
}

@contributions(contributions: Seq[JsValue]) = {
Expand Down Expand Up @@ -219,6 +221,10 @@
}
}

@lobidUrl(hbzId: String) = @{
"http://lobid.org/resources/" + hbzId + "#!"
}

@table(){
<tr><td>Titel</td><td><b>@((doc \ "title").asOpt[String].getOrElse(""))</b></td></tr>
@for(x <- (doc \ "otherTitleInformation").asOpt[Seq[JsValue]]) {
Expand All @@ -244,7 +250,7 @@
@result_field("In", "containedIn", doc, TableRow.LINKS)

@part_of("isPartOf", "hasSuperordinate")
@defining((doc \ "id").asOpt[String].getOrElse("")){ id =>
@defining(lobidUrl((doc \ "hbzId").asOpt[String].getOrElse(""))){ id =>
@subordinate("isPartOf.hasSuperordinate.id", id, "Bände", ("zugehöriger Band", "zugehörige Bände"))
@subordinate("containedIn.id", id, "Enthält", ("Beitrag", "Beiträge"))
}
Expand Down

0 comments on commit 0e6773d

Please sign in to comment.