Skip to content

Commit

Permalink
Apply auto-formatting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
weco-bot authored and StepanBrychta committed Dec 2, 2024
1 parent b0ed1e3 commit b0a6815
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,17 @@ class WorksService(val elasticsearchService: ElasticsearchService)(
searchResponse.map {
case Right(resp) => {
val workTypeAggregation = resp.aggregations.getAgg("workType").get
val workTypeBuckets = workTypeAggregation.data("buckets").asInstanceOf[List[Map[String, Any]]]
val workTypeBuckets = workTypeAggregation
.data("buckets")
.asInstanceOf[List[Map[String, Any]]]

Right(
workTypeBuckets.map(bucket => bucket("key").asInstanceOf[String] -> bucket("doc_count").asInstanceOf[Int]).toMap
workTypeBuckets
.map(
bucket =>
bucket("key").asInstanceOf[String] -> bucket("doc_count")
.asInstanceOf[Int])
.toMap
)
}
case Left(err) => Left(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class WorksAggregationsTest extends AnyFunSpec with ApiWorksTestBase {
{
"count" : 1,
"data" : {
"id" : "GCHQ"
"id" : "GCHQ",
"label" : "GCHQ"
},
"type" : "AggregationBucket"
Expand Down Expand Up @@ -363,19 +363,15 @@ class WorksAggregationsTest extends AnyFunSpec with ApiWorksTestBase {
"count" : 3,
"data" : {
"id" : "cc-by",
"label" : "Attribution 4.0 International (CC BY 4.0)",
"type" : "License",
"url" : "http://creativecommons.org/licenses/by/4.0/"
"label" : "Attribution 4.0 International (CC BY 4.0)"
},
"type" : "AggregationBucket"
},
{
"count" : 2,
"data" : {
"id" : "cc-by-nc",
"label" : "Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)",
"type" : "License",
"url" : "https://creativecommons.org/licenses/by-nc/4.0/"
"label" : "Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)"
},
"type" : "AggregationBucket"
}
Expand Down Expand Up @@ -419,17 +415,15 @@ class WorksAggregationsTest extends AnyFunSpec with ApiWorksTestBase {
"count": 2,
"data": {
"label": "Closed stores",
"id": "closed-stores",
"type" : "Availability"
"id": "closed-stores"
},
"type": "AggregationBucket"
},
{
"count" : 2,
"data" : {
"id" : "online",
"label" : "Online",
"type" : "Availability"
"label" : "Online"
},
"type" : "AggregationBucket"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,8 @@ class FilterAndAggregateBySubjectTest
case (count, label) =>
(count, s"""
|{
| "concepts" : [
| ],
| "label" : "$label",
| "type" : "Subject"
| "id" : "$label",
| "label" : "$label"
| }
|""".stripMargin)
}
Expand All @@ -86,10 +84,8 @@ class FilterAndAggregateBySubjectTest
val redundantFilterBucket: String =
"""
|{
| "concepts" : [
| ],
| "label" : "Psychology, Pathological",
| "type" : "Subject"
| "id" : "Psychology, Pathological",
| "label" : "Psychology, Pathological"
| }
|""".stripMargin
val aggregationName: String = "subjects.label"
Expand Down

0 comments on commit b0a6815

Please sign in to comment.