Commit 296ca215 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

fix albums right join db issue

parent 5aee3fcb
...@@ -31,6 +31,7 @@ class AlbumsContractModule @Inject constructor( ...@@ -31,6 +31,7 @@ class AlbumsContractModule @Inject constructor(
override fun getProgressAlbumList(albumId: Int): Observable<List<AlbumPreviewModel>> = override fun getProgressAlbumList(albumId: Int): Observable<List<AlbumPreviewModel>> =
fetchAlbums(albumId) fetchAlbums(albumId)
override fun getAlbumPhoto(photoId: Int): Observable<PhotoModel> { override fun getAlbumPhoto(photoId: Int): Observable<PhotoModel> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
} }
...@@ -63,7 +64,6 @@ class AlbumsContractModule @Inject constructor( ...@@ -63,7 +64,6 @@ class AlbumsContractModule @Inject constructor(
private val fetchTopLevelAlbumsDb = private val fetchTopLevelAlbumsDb =
db.getTopLevelAlbums() db.getTopLevelAlbums()
.toList()
.toObservable() .toObservable()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
......
...@@ -18,7 +18,7 @@ interface IDb { ...@@ -18,7 +18,7 @@ interface IDb {
fun <T : List<Persistable>> blockingUpsert(entity: T) fun <T : List<Persistable>> blockingUpsert(entity: T)
fun userObservableResult(uuid: Int): Observable<ReactiveResult<UserEntity>> fun userObservableResult(uuid: Int): Observable<ReactiveResult<UserEntity>>
fun fetchArticles(feedAlias: String, pageSize: Int, startIndex: Int): Observable<ArticleEntity> fun fetchArticles(feedAlias: String, pageSize: Int, startIndex: Int): Observable<ArticleEntity>
fun getTopLevelAlbums(): Observable<ImageAlbumEntity> fun getTopLevelAlbums(): Single<MutableList<ImageAlbumEntity>>
fun getChildAlbums(parentId: Int): Observable<ImageAlbumEntity> fun getChildAlbums(parentId: Int): Observable<ImageAlbumEntity>
fun checkIfExistsAlbumJunction(albumId: Int, parentAlbumId: Int): ImageAlbumJunctionEntity? fun checkIfExistsAlbumJunction(albumId: Int, parentAlbumId: Int): ImageAlbumJunctionEntity?
fun getFeed(feedAlias: String): ReactiveResult<FeedEntity> fun getFeed(feedAlias: String): ReactiveResult<FeedEntity>
......
...@@ -71,9 +71,12 @@ class RequeryRepository @Inject constructor( ...@@ -71,9 +71,12 @@ class RequeryRepository @Inject constructor(
fetchAll<ArticleEntity>().where(ArticleEntity.ID.eq(id)) fetchAll<ArticleEntity>().where(ArticleEntity.ID.eq(id))
.get() .get()
override fun getTopLevelAlbums(): Observable<ImageAlbumEntity> = override fun getTopLevelAlbums(): Single<MutableList<ImageAlbumEntity>> =
fetchAll<ImageAlbumEntity>() fetchAll<ImageAlbumEntity>()
.get().observable() .join(ImageAlbumJunctionEntity::class)
.on(ImageAlbumJunctionEntity.ALBUM_ID.eq(ImageAlbumEntity.ID))
.where(ImageAlbumJunctionEntity.ALBUM_ID.isNull())
.get().observable().toList()
override fun getChildAlbums(parentId:Int): Observable<ImageAlbumEntity> = override fun getChildAlbums(parentId:Int): Observable<ImageAlbumEntity> =
store.select(ImageAlbumEntity::class) store.select(ImageAlbumEntity::class)
......
...@@ -25,9 +25,11 @@ class AlbumsScreenPresenter @Inject constructor( ...@@ -25,9 +25,11 @@ class AlbumsScreenPresenter @Inject constructor(
override fun bindIntents() { override fun bindIntents() {
val fetchParents = interactor.fetchHeaderAlbums() val fetchParents = interactor.fetchHeaderAlbums()
.filter { !it.isNullOrEmpty() }
.map { AlbumsScreenViewState.AlbumsListLoaded(it,selectedIndex) } .map { AlbumsScreenViewState.AlbumsListLoaded(it,selectedIndex) }
val fetchSelected = interactor.fetchAlbumPhotos(selectedIndex) val fetchSelected = interactor.fetchAlbumPhotos(selectedIndex)
.filter { !it.isNullOrEmpty() }
.map { AlbumsScreenViewState.AlbumsSelected(it)} .map { AlbumsScreenViewState.AlbumsSelected(it)}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment