Skip to content

Commit

Permalink
Fix #1562: Bug fix promoted story list (#1564)
Browse files Browse the repository at this point in the history
* Fixed promoted stories

* Nit revert

Co-authored-by: Rajat Talesra <talesra@google.com>
  • Loading branch information
rt4914 and Rajat Talesra committed Aug 6, 2020
1 parent ce6c082 commit 46aa6e5
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions app/src/main/java/org/oppia/app/home/HomeFragmentPresenter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,20 @@ class HomeFragmentPresenter @Inject constructor(
getAssumedSuccessfulOngoingStoryList().observe(
fragment,
Observer<OngoingStoryList> {
it.recentStoryList.take(limit).forEach { promotedStory ->
val recentStory = PromotedStoryViewModel(activity, internalProfileId)
recentStory.setPromotedStory(promotedStory)
promotedStoryList.add(recentStory)
promotedStoryList.clear()
if (it.recentStoryCount != 0) {
it.recentStoryList.take(limit).forEach { promotedStory ->
val recentStory = PromotedStoryViewModel(activity, internalProfileId)
recentStory.setPromotedStory(promotedStory)
promotedStoryList.add(recentStory)
}
} else {
// TODO(#936): Optimise this as part of recommended stories.
it.olderStoryList.take(limit).forEach { promotedStory ->
val oldStory = PromotedStoryViewModel(activity, internalProfileId)
oldStory.setPromotedStory(promotedStory)
promotedStoryList.add(oldStory)
}
}
topicListAdapter.notifyItemChanged(1)
}
Expand Down

0 comments on commit 46aa6e5

Please sign in to comment.