Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oppia Android Promoted Stories Domain Layer #2272

Merged
merged 295 commits into from
Jan 31, 2021
Merged
Show file tree
Hide file tree
Changes from 229 commits
Commits
Show all changes
295 commits
Select commit Hold shift + click to select a range
46ca860
Merge branch 'refactor-topic-list-adapter-to-use-bindable-adapter' of…
jcqli Dec 15, 2020
7dd9fb0
Revert "Add viewmodels to bazel build"
jcqli Dec 15, 2020
02bba56
fixed recommended list
veena14cs Dec 15, 2020
b9b226b
Apply test changes from #2253
jcqli Dec 15, 2020
0097bfa
Address review comments
jcqli Dec 16, 2020
594d8c0
Resolve conflicts
jcqli Dec 16, 2020
9c6ea9f
Fix linter errors
jcqli Dec 16, 2020
27f878f
Fix linter errors
jcqli Dec 16, 2020
27112a3
fixed index error
veena14cs Dec 16, 2020
a0abcc3
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Dec 16, 2020
1a9fdc4
added timestamp for recently played
veena14cs Dec 16, 2020
435270a
Add view models to bazel build file
jcqli Dec 17, 2020
5f93d32
Refactor all topics list to return empty list if no topics
jcqli Dec 17, 2020
b184d1e
Remove duplicated HomeViewModel in bazel build
jcqli Dec 17, 2020
cec345d
Fix linter error & filepath for AllTopicsViewModel in bazel build
jcqli Dec 17, 2020
f2b6271
removed walkthrough field
veena14cs Dec 17, 2020
4e6926c
writting testcases
veena14cs Dec 17, 2020
872ccc3
fixing testcase
veena14cs Dec 17, 2020
1115eaf
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Dec 17, 2020
d2bcbea
Merge remote-tracking branch 'upstream/develop' into develop
veena14cs Dec 17, 2020
a6a940f
Merge branch 'promoted-story' into develop
veena14cs Dec 17, 2020
e07c7e6
Seperated UI part from this PR
veena14cs Dec 17, 2020
e9a1ed1
Removed UI implementation from this PR
veena14cs Dec 17, 2020
f164aa9
Update TopicListControllerTest.kt
veena14cs Dec 17, 2020
859fd4a
Merge remote-tracking branch 'upstream/develop' into refactor-topic-l…
jcqli Dec 17, 2020
0026e36
Remove test helper for home fragment
jcqli Dec 17, 2020
a264442
Add completing all topics to story progress test helper
jcqli Dec 18, 2020
95d0af9
Add tests for no promtoed stories on home fragment and all topics com…
jcqli Dec 18, 2020
2570dde
Address review comments
jcqli Dec 18, 2020
5633194
Set View All button visiblity in view model
jcqli Dec 18, 2020
f906d0d
Fix linter issues
jcqli Dec 18, 2020
d971e13
Add comment to explain test topic exploration progress in test helper
jcqli Dec 18, 2020
4401137
renamed functions
veena14cs Dec 18, 2020
6469399
Merge branch 'develop' into promoted-story
veena14cs Dec 18, 2020
84ac947
Merge branch 'pr/2246' into promoted-story
veena14cs Dec 18, 2020
88ac966
Merge commit 'refs/pull/2246/head' of https://github.com/oppia/oppia-…
veena14cs Dec 18, 2020
948cfb1
updated testcases
veena14cs Dec 21, 2020
05d0057
Update topic.proto
veena14cs Dec 21, 2020
5327b74
updated proto.
veena14cs Dec 21, 2020
31a9d8b
Merge remote-tracking branch 'upstream/develop' into refactor-topic-l…
jcqli Dec 21, 2020
01c3653
Address review comments
jcqli Dec 22, 2020
f347994
Set routing / listeners in home activity
jcqli Dec 22, 2020
26b082c
More review comments
jcqli Dec 22, 2020
92b6bed
Address review comments
jcqli Dec 22, 2020
e304b63
Fix linter issues
jcqli Dec 22, 2020
ac7a029
Fix linter errors
jcqli Dec 22, 2020
8e5d5af
Fix test errors (linter & bazel)
jcqli Dec 22, 2020
795718b
Update TopicListController.kt
veena14cs Dec 22, 2020
03f6887
Fix bazel errors and add tests for no user progress case
jcqli Dec 22, 2020
2e87b69
Remove double declaration of TopicSummaryViewModel
jcqli Dec 22, 2020
c845113
Move PromotedStoryViewModel to be declared with resources
jcqli Dec 22, 2020
ca30f39
Remove curly brace on padding dimensions in promotedstorylistview
jcqli Dec 22, 2020
9a4c82c
Remove Int type from padding value
jcqli Dec 23, 2020
130803f
updated nit changes.
veena14cs Dec 23, 2020
6d31714
fixed nit changes
veena14cs Dec 23, 2020
f449b5c
Update TopicListController.kt
veena14cs Dec 23, 2020
42456b9
Delete gradle.xml
veena14cs Dec 23, 2020
4beaf32
Update strings.xml
veena14cs Dec 23, 2020
f2e4710
Update TopicListControllerTest.kt
veena14cs Dec 23, 2020
b13c629
Update TopicListControllerTest.kt
veena14cs Dec 23, 2020
28b60a2
Address review comments
jcqli Dec 23, 2020
3f23dbb
Add BindingAdapter for padding end
jcqli Dec 23, 2020
9566c62
Remove unused import
jcqli Dec 23, 2020
b37f624
Fix comments
jcqli Dec 23, 2020
5cc9b28
Use int in BindingAdapter
jcqli Dec 23, 2020
b527e16
Rename BindingAdapter?
jcqli Dec 23, 2020
f67afed
Refactor BindingAdapter naming
jcqli Dec 23, 2020
c7fc75b
Add view to bazel build
jcqli Dec 23, 2020
4f48b76
Add SnapHelper to build
jcqli Dec 23, 2020
51311b2
Create HomeFragmentView to handle layout
jcqli Dec 23, 2020
1ad8e52
Handle layout in presenter again
jcqli Dec 24, 2020
11fa3c1
Fix linter errors
jcqli Dec 24, 2020
0df343e
Add recyclerview to snap helper in build
jcqli Dec 24, 2020
f9e9494
Add databidning dependency
jcqli Dec 24, 2020
7d94895
WOrk on bazel errors
jcqli Dec 24, 2020
8a0bc4a
WOrk on bazel errors
jcqli Dec 24, 2020
6de46c3
WOrk on bazel errors
jcqli Dec 24, 2020
55a4597
Enable data-binding in build?
jcqli Dec 24, 2020
a308621
Remove enable data binding for snap helper
jcqli Dec 24, 2020
94e9f3b
Add custom package?
jcqli Dec 24, 2020
aa5656a
Use shim for bindings in PromotedStoryListView
jcqli Dec 24, 2020
666de4d
Address review comments
jcqli Dec 24, 2020
6fc5312
Attach to window and use view component
jcqli Dec 24, 2020
19c98a2
Use application injection in PromotedStoryListView, add bounds check …
jcqli Dec 24, 2020
057f937
Fix linter errors
jcqli Dec 24, 2020
6f19edc
Merge branch 'develop' into refactor-topic-list-adapter-to-use-bindab…
veena14cs Dec 24, 2020
010a129
Merge commit 'refs/pull/2246/head' of https://github.com/oppia/oppia-…
veena14cs Dec 24, 2020
a2113b2
updated implementaion with stories for you
veena14cs Dec 25, 2020
60e0f52
Merge branch 'refactor-topic-list-adapter-to-use-bindable-adapter-vee…
veena14cs Dec 25, 2020
1714d15
updated code.
veena14cs Dec 25, 2020
c43a187
Update TopicListControllerTest.kt
veena14cs Dec 25, 2020
e43a9fd
Update topic.proto
veena14cs Dec 26, 2020
002420c
fixed nit changes and lint error
veena14cs Dec 30, 2020
9330df1
Update topic.proto
veena14cs Dec 30, 2020
136abc8
Delete coming_soon_topics.json
veena14cs Dec 30, 2020
586bd3f
Update TopicListControllerTest.kt
veena14cs Dec 30, 2020
ed5b3de
Merge remote-tracking branch 'upstream/develop' into refactor-topic-l…
jcqli Jan 4, 2021
f455660
Merge remote-tracking branch 'upstream/develop' into refactor-topic-l…
jcqli Jan 5, 2021
9b23ee7
Use fragment injection in custom recycler view, override equals in vi…
jcqli Jan 5, 2021
206bc41
Shorten error message
jcqli Jan 5, 2021
7c23c9f
Shorten error message
jcqli Jan 5, 2021
8f37116
Merge branch 'refactor-topic-list-adapter-to-use-bindable-adapter' of…
jcqli Jan 5, 2021
6701b05
fixed nit changes
veena14cs Jan 6, 2021
a1bb425
Merge remote-tracking branch 'upstream/develop' into refactor-topic-l…
jcqli Jan 6, 2021
7e71d54
Add hashcode to view models and address review comments
jcqli Jan 6, 2021
cfa1d49
Start tests for view model equals
jcqli Jan 6, 2021
11fb309
Merge remote-tracking branch 'upstream/develop' into refactor-topic-l…
jcqli Jan 7, 2021
def4ae3
Add view model tests
jcqli Jan 7, 2021
86224fa
Use test activity to get fragment
jcqli Jan 8, 2021
4faf7e7
Create intent in test activity
jcqli Jan 8, 2021
92b2389
Add test for WelcomeViewModel
jcqli Jan 8, 2021
d1bcc2d
Clarify test names and start PromotedStoryListViewModel
jcqli Jan 8, 2021
f15d105
Update test_exp_id_4.json
veena14cs Jan 8, 2021
923b1df
Merge branch 'develop' into refactor-topic-list-adapter-to-use-bindab…
veena14cs Jan 8, 2021
8796b18
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 8, 2021
8605073
Merge commit 'refs/pull/2246/head' of https://github.com/oppia/oppia-…
veena14cs Jan 8, 2021
baebaad
Merge branch 'refactor-topic-list-adapter-to-use-bindable-adapter-vee…
veena14cs Jan 8, 2021
f11e530
Add tests for equals definition and hashcode of WelcomeViewModel and …
jcqli Jan 8, 2021
23c816b
Add tests for PromotedStoryListViewModel
jcqli Jan 8, 2021
93e6477
Update TopicListController.kt
veena14cs Jan 8, 2021
e9e0d52
Add tests for TopicSummaryViewModel
jcqli Jan 8, 2021
57abbea
Shorten comment
jcqli Jan 8, 2021
502a6f7
Address review comments
jcqli Jan 8, 2021
e05ba31
Separate WelcomeViewModel into own test
jcqli Jan 8, 2021
dc1c8af
Separate PromotedStoryViewModel test
jcqli Jan 8, 2021
8dae244
Separate PromotedStoryListViewModel tests
jcqli Jan 8, 2021
e7576c9
Separate TopicSummaryViewModel tests
jcqli Jan 8, 2021
401ddb0
Remove combined ViewModel tests
jcqli Jan 8, 2021
a8818ba
Fix lint errors
jcqli Jan 8, 2021
fc8d16f
Create fragment in view model test
jcqli Jan 8, 2021
c004111
Remove fragment transaction from test activity
jcqli Jan 8, 2021
01d96cb
Fix linter errors
jcqli Jan 8, 2021
a8e47a8
Use helpers and improve readability of promoted story list view model…
jcqli Jan 9, 2021
c89b077
Improve readability for WelcomeViewModel tests
jcqli Jan 9, 2021
b2c6bcf
Simplilfy promtoed story view model and welcome view model tests
jcqli Jan 9, 2021
3bc2364
Simplify topic summary and promtoed story view models
jcqli Jan 9, 2021
a15141c
Clarify test names
jcqli Jan 9, 2021
ef1bc50
Update TopicController.kt
veena14cs Jan 9, 2021
5034a62
Fixed nit.
veena14cs Jan 9, 2021
8ec9850
fixed issues
veena14cs Jan 9, 2021
b08f615
Update TopicListController.kt
veena14cs Jan 10, 2021
85a2900
Update model/src/main/proto/topic.proto
veena14cs Jan 11, 2021
6815047
Removed ongoingstory list.
veena14cs Jan 11, 2021
c073c8d
Move test helpers beneath test cases
jcqli Jan 11, 2021
805efcd
Address review comments
jcqli Jan 11, 2021
35c7b85
Optimized code.
veena14cs Jan 11, 2021
685ffb7
Update StoryProgressController.kt
veena14cs Jan 11, 2021
411a67a
Merge remote-tracking branch 'upstream/develop' into refactor-topic-l…
jcqli Jan 11, 2021
7923100
Merge commit 'refs/pull/2246/head' of https://github.com/oppia/oppia-…
veena14cs Jan 12, 2021
39c7beb
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 12, 2021
5c1959d
fixing nit changes
veena14cs Jan 12, 2021
597c3bf
Update HomeViewModel.kt
veena14cs Jan 12, 2021
ccac3da
Address comments for HomeActivityTest
jcqli Jan 12, 2021
1d66248
Import ActivityScenario.launch for view model tests
jcqli Jan 12, 2021
65173e2
Use named parameters in StoryProgressTestHelperTest
jcqli Jan 12, 2021
83c99b1
Clarify new user used for no story progress in ProfileTestHelpr
jcqli Jan 12, 2021
1f25997
Order view model alphabetically
jcqli Jan 12, 2021
356e03e
Add readability fixes from review
jcqli Jan 12, 2021
0641c8e
Fix comments
jcqli Jan 12, 2021
0d08d9a
Resolve merge conflicts
jcqli Jan 12, 2021
86a2a36
Add dummy data in promoted story list view to appropriately initiate …
jcqli Jan 13, 2021
1bcd610
Merge commit 'refs/pull/2246/head' of https://github.com/oppia/oppia-…
veena14cs Jan 13, 2021
b5c56f4
Merge commit 'refs/pull/2246/head' of https://github.com/oppia/oppia-…
veena14cs Jan 13, 2021
b0b5045
Merge remote-tracking branch 'upstream/develop' into refactor-topic-l…
jcqli Jan 13, 2021
346fc10
Use BindingAdapter on the data list of promtoed stories
jcqli Jan 13, 2021
67eb418
Remove static binding adapter for data-binding in promoted story list…
jcqli Jan 14, 2021
e1e0703
Address review comments
jcqli Jan 14, 2021
4116a55
Merge branch 'refactor-topic-list-adapter-to-use-bindable-adapter-vee…
veena14cs Jan 14, 2021
f67521e
updated
veena14cs Jan 14, 2021
60c9cfc
Remove extra space in layout
jcqli Jan 14, 2021
03e076c
Merge commit 'refs/pull/2246/head' of https://github.com/oppia/oppia-…
veena14cs Jan 14, 2021
bc6b71c
Merge branch 'refactor-topic-list-adapter-to-use-bindable-adapter-vee…
veena14cs Jan 14, 2021
de22e9a
updated topic ontroller
veena14cs Jan 18, 2021
7874e25
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 18, 2021
0d84080
Update promoted_story_list.xml
veena14cs Jan 18, 2021
1388c52
fixed implementation and updated testcases
veena14cs Jan 18, 2021
97f16f7
updated
veena14cs Jan 18, 2021
16a68ad
fixed lint errors
veena14cs Jan 18, 2021
de0cfba
Update StoryProgressTestHelperTest.kt
veena14cs Jan 19, 2021
07ec5e6
Update StoryProgressTestHelperTest.kt
veena14cs Jan 19, 2021
d55273d
fixed lint
veena14cs Jan 19, 2021
8b2f3e3
Update topic.proto
veena14cs Jan 19, 2021
47656be
Update TopicListController.kt
veena14cs Jan 19, 2021
a021b80
Fixed issues
veena14cs Jan 20, 2021
427de92
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 20, 2021
8f573de
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 20, 2021
9cf9701
fixed nit changes
veena14cs Jan 20, 2021
08b9eef
Update TopicListController.kt
veena14cs Jan 20, 2021
d7e5a3f
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 21, 2021
f4ad67b
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 21, 2021
7f7ea3f
Update TopicListController.kt
veena14cs Jan 21, 2021
49c5bdb
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 21, 2021
f78db26
Update TopicListControllerTest.kt
veena14cs Jan 22, 2021
d2a3079
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 22, 2021
b75d103
Update TopicListControllerTest.kt
veena14cs Jan 22, 2021
a37015e
updated implementation
veena14cs Jan 22, 2021
b6529db
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 22, 2021
fb55314
updated storyProgressController
veena14cs Jan 22, 2021
acd25c4
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 23, 2021
d54f6b9
updated changes
veena14cs Jan 23, 2021
f1d4b80
Update topic.proto
veena14cs Jan 23, 2021
ff2a983
Updated changes
veena14cs Jan 23, 2021
0aa5327
Update domain/src/test/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 23, 2021
fc94cec
implemented changes
veena14cs Jan 23, 2021
f797fa3
updated list ids
veena14cs Jan 24, 2021
ad91320
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 24, 2021
6c4d2f1
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 24, 2021
03244c1
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 24, 2021
06af4c7
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 24, 2021
3e157bc
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 24, 2021
5bb4566
Update domain/src/main/java/org/oppia/android/domain/topic/StoryProgr…
veena14cs Jan 24, 2021
3d43745
updated
veena14cs Jan 24, 2021
6f12d2d
added helper tests
veena14cs Jan 24, 2021
615d2f5
Update StoryProgressTestHelperTest.kt
veena14cs Jan 24, 2021
394566a
Update TopicController.kt
veena14cs Jan 24, 2021
fb155e2
Updated Suggestion logic
veena14cs Jan 25, 2021
486ba33
Update TopicListController.kt
veena14cs Jan 26, 2021
c8e99b8
rename testcase
veena14cs Jan 26, 2021
6255455
Updated implementation changes and testcases as per discussion.
veena14cs Jan 27, 2021
14cee39
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 28, 2021
2441187
updated with develop code to pass ci tests.
veena14cs Jan 28, 2021
530b13a
fixed changes
veena14cs Jan 28, 2021
ad14c9f
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 28, 2021
dddbcda
Update TopicListControllerTest.kt
veena14cs Jan 28, 2021
e78f7ab
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 29, 2021
d5f074e
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 29, 2021
ed9185f
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 29, 2021
193344d
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 29, 2021
e9dd454
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 29, 2021
ddf4bb0
Update domain/src/test/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 29, 2021
70fcf8a
fixed testcases and implementation
veena14cs Jan 29, 2021
d06fcc6
Update TopicListController.kt
veena14cs Jan 29, 2021
f23615c
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 29, 2021
d91733c
fixing changes
veena14cs Jan 29, 2021
17afb19
Update TopicListControllerTest.kt
veena14cs Jan 29, 2021
a74776e
Update TopicListControllerTest.kt
veena14cs Jan 29, 2021
b6697fa
Fixed suggested changes
veena14cs Jan 29, 2021
860e8e1
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 29, 2021
804a506
Update StoryProgressTestHelper.kt
veena14cs Jan 29, 2021
834e471
Update StoryProgressTestHelperTest.kt
veena14cs Jan 29, 2021
6b83e09
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 30, 2021
6351f1d
Update TopicListControllerTest.kt
veena14cs Jan 30, 2021
fdc28cc
Merge branch 'promoted-story' of https://github.com/veena14cs/oppia-a…
veena14cs Jan 30, 2021
357ba9a
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 30, 2021
0837760
Merge remote-tracking branch 'upstream/develop' into promoted-story
veena14cs Jan 30, 2021
cc9b9b5
Fixed itestcases
veena14cs Jan 30, 2021
07d7113
Update TopicListControllerTest.kt
veena14cs Jan 31, 2021
47a4897
Update domain/src/test/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 31, 2021
1e7d32a
Update domain/src/test/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 31, 2021
51a4c09
Update domain/src/main/java/org/oppia/android/domain/topic/TopicListC…
veena14cs Jan 31, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import org.oppia.android.util.data.DataProvider
import org.oppia.android.util.data.DataProviders
import org.oppia.android.util.data.DataProviders.Companion.transformAsync
import org.oppia.android.util.logging.ConsoleLogger
import org.oppia.android.util.system.OppiaClock
import javax.inject.Inject
import javax.inject.Singleton

Expand All @@ -35,6 +36,7 @@ const val RATIOS_EXPLORATION_ID_0 = "2mzzFVDLuAj8"
const val RATIOS_EXPLORATION_ID_1 = "5NWuolNcwH6e"
const val RATIOS_EXPLORATION_ID_2 = "k2bQ7z5XHNbK"
const val RATIOS_EXPLORATION_ID_3 = "tIoSb3HZFN6e"
const val UPCOMING_TOPIC_ID_1 = "test_topic_id_2"

private const val CACHE_NAME = "topic_progress_database"
private const val RETRIEVE_TOPIC_PROGRESS_LIST_DATA_PROVIDER_ID =
Expand All @@ -55,6 +57,7 @@ private const val RECORD_RECENTLY_PLAYED_CHAPTER_PROVIDER_ID =
class StoryProgressController @Inject constructor(
private val cacheStoreFactory: PersistentCacheStore.Factory,
private val dataProviders: DataProviders,
private val oppiaClock: OppiaClock,
private val logger: ConsoleLogger
) {
// TODO(#21): Determine whether chapters can have missing prerequisites in the initial prototype,
Expand Down Expand Up @@ -110,7 +113,9 @@ class StoryProgressController @Inject constructor(
storyProgressBuilder.putChapterProgress(explorationId, chapterProgress)
val storyProgress = storyProgressBuilder.build()

val topicProgressBuilder = TopicProgress.newBuilder().setTopicId(topicId)
val topicProgressBuilder =
TopicProgress.newBuilder()
.setTopicId(topicId).setLastPlayedTimestamp(completionTimestamp)
if (topicProgressDatabase.topicProgressMap[topicId] != null) {
topicProgressBuilder
.putAllStoryProgress(topicProgressDatabase.topicProgressMap[topicId]!!.storyProgressMap)
Expand Down Expand Up @@ -191,7 +196,8 @@ class StoryProgressController @Inject constructor(
storyProgressBuilder.putChapterProgress(explorationId, chapterProgressBuilder.build())
val storyProgress = storyProgressBuilder.build()

val topicProgressBuilder = TopicProgress.newBuilder().setTopicId(topicId)
val topicProgressBuilder =
TopicProgress.newBuilder().setTopicId(topicId).setLastPlayedTimestamp(lastPlayedTimestamp)
if (topicProgressDatabase.topicProgressMap[topicId] != null) {
topicProgressBuilder
.putAllStoryProgress(topicProgressDatabase.topicProgressMap[topicId]!!.storyProgressMap)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,27 @@ class StoryProgressTestHelper @Inject constructor(
)
}

/**
* Marks full topic progress on the second test topic for a particular profile.
*
* @param profileId The profile we are setting topic progress for.
* @param timestampOlderThanOneWeek If the timestamp for completing the topic is from more than one week ago.
veena14cs marked this conversation as resolved.
Show resolved Hide resolved
*/
fun markFullProgressForSecondTestTopic(profileId: ProfileId, timestampOlderThanAWeek: Boolean) {
anandwana001 marked this conversation as resolved.
Show resolved Hide resolved
val timestamp = if (!timestampOlderThanAWeek) {
getCurrentTimestamp()
} else {
getOldTimestamp()
}
storyProgressController.recordCompletedChapter(
profileId,
TEST_TOPIC_ID_1,
TEST_STORY_ID_2,
TEST_EXPLORATION_ID_4,
timestamp
)
}

/**
* Marks one story progress full in ratios exploration for a particular profile.
veena14cs marked this conversation as resolved.
Show resolved Hide resolved
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,6 @@ class TopicController @Inject constructor(
)
}

// If there is no completed chapter, it cannot be an ongoing-topic.
if (completedChapterProgressList.isEmpty()) {
return false
}

// If there is at least 1 completed chapter and 1 not-completed chapter, it is definitely an
// ongoing-topic.
if (startedChapterProgressList.isNotEmpty()) {
Expand All @@ -274,6 +269,11 @@ class TopicController @Inject constructor(
}
}
}

// If there is no completed chapter, it cannot be an ongoing-topic.
if (completedChapterProgressList.isEmpty()) {
return false
}
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
return false
}

Expand Down
Loading