From 2c41176a6e37a4568f8f92bfb5b45b5b248589bd Mon Sep 17 00:00:00 2001 From: Sonal Yadav Date: Fri, 11 Apr 2025 14:30:47 +0530 Subject: [PATCH] =?UTF-8?q?Mark=20=E2=9D=8C=20for=20closed=20locations=20(?= =?UTF-8?q?P3999)=20in=20Nearby=20(#6273)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Exclude closed locations (P3999) from Nearby query * feat: Show ❌ for P3999 items (official closure) * revert changes * Add P3999 (date of closure) support for non-existent places * Typo fixing * fix-typo * . --------- Co-authored-by: Nicolas Raoul --- app/src/main/java/fr/free/nrw/commons/nearby/Place.java | 4 +++- .../java/fr/free/nrw/commons/nearby/model/NearbyResultItem.kt | 4 ++++ app/src/main/resources/queries/query_for_item.rq | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/Place.java b/app/src/main/java/fr/free/nrw/commons/nearby/Place.java index 3b3b798eb..402399a24 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/Place.java +++ b/app/src/main/java/fr/free/nrw/commons/nearby/Place.java @@ -153,7 +153,9 @@ public class Place implements Parcelable { .build(), item.getPic().getValue(), // Checking if the place exists or not - (item.getDestroyed().getValue() == "") && (item.getEndTime().getValue() == ""), entityId); + (item.getDestroyed().getValue() == "") && (item.getEndTime().getValue() == "") + && (item.getDateOfOfficialClosure().getValue() == ""), + entityId); } /** diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/model/NearbyResultItem.kt b/app/src/main/java/fr/free/nrw/commons/nearby/model/NearbyResultItem.kt index f28cc833e..a6227a145 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/model/NearbyResultItem.kt +++ b/app/src/main/java/fr/free/nrw/commons/nearby/model/NearbyResultItem.kt @@ -18,6 +18,7 @@ class NearbyResultItem( @field:SerializedName("description") private val description: ResultTuple?, @field:SerializedName("endTime") private val endTime: ResultTuple?, @field:SerializedName("monument") private val monument: ResultTuple?, + @field:SerializedName("dateOfOfficialClosure") private val dateOfOfficialClosure: ResultTuple?, ) { fun getItem(): ResultTuple = item ?: ResultTuple() @@ -41,6 +42,8 @@ class NearbyResultItem( fun getDestroyed(): ResultTuple = destroyed ?: ResultTuple() + fun getDateOfOfficialClosure(): ResultTuple = dateOfOfficialClosure ?: ResultTuple() + fun getDescription(): ResultTuple = description ?: ResultTuple() fun getEndTime(): ResultTuple = endTime ?: ResultTuple() @@ -48,4 +51,5 @@ class NearbyResultItem( fun getAddress(): String = address?.value ?: "" fun getMonument(): ResultTuple? = monument + } diff --git a/app/src/main/resources/queries/query_for_item.rq b/app/src/main/resources/queries/query_for_item.rq index 4a946ac96..edcb29ddf 100644 --- a/app/src/main/resources/queries/query_for_item.rq +++ b/app/src/main/resources/queries/query_for_item.rq @@ -10,6 +10,7 @@ SELECT (SAMPLE(?wikipediaArticle) AS ?wikipediaArticle) (SAMPLE(?commonsArticle) AS ?commonsArticle) (SAMPLE(?commonsCategory) AS ?commonsCategory) + (SAMPLE(?dateOfOfficialClosure) AS ?dateOfOfficialClosure) WHERE { SERVICE { values ?item { @@ -45,6 +46,7 @@ WHERE { # Get existence OPTIONAL {?item wdt:P576 ?destroyed} OPTIONAL {?item wdt:P582 ?endTime} + OPTIONAL {?item wdt:P3999 ?dateOfOfficialClosure} # Get Commons category OPTIONAL {?item wdt:P373 ?commonsCategory}