From 7ce8b69be15e69b5d92947a11b6f6ad7c1be270f Mon Sep 17 00:00:00 2001 From: Chumva Date: Thu, 26 Apr 2018 19:04:10 +0300 Subject: [PATCH] change sqlQuery for random articles --- .../net/osmand/plus/wikivoyage/data/TravelDbHelper.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java index 7260ca0e99..e3fc28e6a7 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java @@ -208,11 +208,10 @@ public class TravelDbHelper { SQLiteConnection conn = openConnection(); if (conn != null) { TravelArticle travelArticle; - SQLiteCursor cursor = conn.rawQuery("SELECT * FROM " - + ARTICLES_TABLE_NAME - + " WHERE article_id IN (SELECT article_id FROM " - + ARTICLES_TABLE_NAME - + " ORDER BY RANDOM() LIMIT 100) LIMIT 100", null); + String lang = application.getLanguage(); + SQLiteCursor cursor = conn.rawQuery("SELECT * FROM wikivoyage_articles" + + " WHERE title IN (SELECT title FROM popular_articles WHERE lang = ?" + + " ORDER BY RANDOM()) ORDER BY RANDOM() LIMIT 100", new String[]{lang}); if (cursor.moveToFirst()) { do { travelArticle = readArticle(cursor);