From e9ba8c2bd2bf34a50ac25f16fb11e1a224efb72c Mon Sep 17 00:00:00 2001 From: Levin Herr Date: Fri, 11 Oct 2024 12:01:46 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20wikidata=20improvements=20(#2952?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/API/v1/ExperimentalController.php | 2 +- .../Controllers/Frontend/OpenData/WikidataController.php | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/API/v1/ExperimentalController.php b/app/Http/Controllers/API/v1/ExperimentalController.php index aaadd5f40..38cf4cc0c 100644 --- a/app/Http/Controllers/API/v1/ExperimentalController.php +++ b/app/Http/Controllers/API/v1/ExperimentalController.php @@ -40,7 +40,7 @@ public function fetchWikidata(int $stationId): JsonResponse { private static function checkGeneralRateLimit(): bool { $key = "fetch-wikidata-user:" . auth()->id(); - if (RateLimiter::tooManyAttempts($key, 10)) { + if (RateLimiter::tooManyAttempts($key, 20)) { return false; } RateLimiter::increment($key); diff --git a/app/Http/Controllers/Frontend/OpenData/WikidataController.php b/app/Http/Controllers/Frontend/OpenData/WikidataController.php index 7ae5583ab..45a4c048a 100644 --- a/app/Http/Controllers/Frontend/OpenData/WikidataController.php +++ b/app/Http/Controllers/Frontend/OpenData/WikidataController.php @@ -12,13 +12,10 @@ public function indexHelpPage(): View { //get stations the user was travelling recently, without a wikidata id $destinationStationsWithoutWikidata = Station::join('train_stopovers', 'train_stations.id', '=', 'train_stopovers.train_station_id') - ->join('train_checkins', 'train_checkins.destination_stopover_id', '=', 'train_stopovers.id') - ->where('train_checkins.user_id', auth()->id()) - ->where('train_stations.ibnr', '>', 1000000) + ->where('train_stations.ibnr', '>', 8000000) ->whereNull('train_stations.wikidata_id') ->select('train_stations.*') ->limit(50) - ->orderByDesc('train_checkins.created_at') ->distinct() ->get();