File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed 
app/src/main/java/org/wikipedia Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ interface HistoryEntryDao {
3030    @Query(" SELECT COUNT(*) FROM (SELECT DISTINCT HistoryEntry.lang, HistoryEntry.apiTitle FROM HistoryEntry WHERE timestamp > :timestamp)" 
3131    suspend  fun  getDistinctEntriesCountSince (timestamp :  Long ): Int? 
3232
33-     @Query(" SELECT DISTINCT  displayTitle FROM HistoryEntry ORDER BY timestamp  DESC LIMIT :limit" 
34-     suspend  fun  getLatestArticleTitles (limit :  Int ): List <String >
33+     @Query(" SELECT displayTitle FROM HistoryEntry WHERE timestamp > :timestamp GROUP BY displayTitle  ORDER BY COUNT(displayTitle)  DESC LIMIT :limit" 
34+     suspend  fun  getTopVisitedEntriesSince (limit :  Int ,  timestamp :   Long ): List <String >
3535
3636    @Query(" SELECT COUNT(*) FROM HistoryEntry" 
3737    suspend  fun  getHistoryCount (): Int 
Original file line number Diff line number Diff line change @@ -66,17 +66,14 @@ class YearInReviewViewModel() : ViewModel() {
6666            }
6767
6868            val  topVisitedArticlesForTheYear =  async {
69-                 //  TODO: update the query
70-                 AppDatabase .instance.historyEntryDao().getLatestArticleTitles(MINIMUM_READ_COUNT )
69+                 AppDatabase .instance.historyEntryDao().getTopVisitedEntriesSince(MINIMUM_READ_COUNT , yearAgo)
7170                    .map { StringUtil .fromHtml(it).toString() }
7271            }
7372
7473            val  totalTimeSpent =  async {
7574                AppDatabase .instance.historyEntryWithImageDao().getTimeSpentSinceTimeStamp(yearAgo)
7675            }
7776
78-             //  TODO: think about the actual data to show.
79- 
8077            val  impactDataJob =  async {
8178                if  (AccountUtil .isLoggedIn) {
8279                    val  wikiSite =  WikipediaApp .instance.wikiSite
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments