change sqlQuery for random articles

This commit is contained in:
Chumva 2018-04-26 19:04:10 +03:00
parent 4946440e57
commit 7ce8b69be1

View file

@ -208,11 +208,10 @@ public class TravelDbHelper {
SQLiteConnection conn = openConnection(); SQLiteConnection conn = openConnection();
if (conn != null) { if (conn != null) {
TravelArticle travelArticle; TravelArticle travelArticle;
SQLiteCursor cursor = conn.rawQuery("SELECT * FROM " String lang = application.getLanguage();
+ ARTICLES_TABLE_NAME SQLiteCursor cursor = conn.rawQuery("SELECT * FROM wikivoyage_articles"
+ " WHERE article_id IN (SELECT article_id FROM " + " WHERE title IN (SELECT title FROM popular_articles WHERE lang = ?"
+ ARTICLES_TABLE_NAME + " ORDER BY RANDOM()) ORDER BY RANDOM() LIMIT 100", new String[]{lang});
+ " ORDER BY RANDOM() LIMIT 100) LIMIT 100", null);
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {
do { do {
travelArticle = readArticle(cursor); travelArticle = readArticle(cursor);