Fix more than one current student (#311)

Fix #309
This commit is contained in:
Rafał Borcz 2019-03-28 23:07:59 +01:00 committed by Mikołaj Pich
parent c6c7357623
commit b97b94ae29
3 changed files with 7 additions and 7 deletions

View File

@ -11,10 +11,10 @@ cache:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
#branches:
# only:
# - master
# - 0.7.x
branches:
only:
- master
- 0.7.x
android:
licenses:

View File

@ -25,8 +25,8 @@ interface StudentDao {
@Query("SELECT * FROM Students")
fun loadAll(): Maybe<List<Student>>
@Query("UPDATE Students SET is_current = 1 WHERE student_id = :studentId")
fun updateCurrent(studentId: Int)
@Query("UPDATE Students SET is_current = 1 WHERE id = :id")
fun updateCurrent(id: Long)
@Query("UPDATE Students SET is_current = 0")
fun resetCurrent()

View File

@ -35,7 +35,7 @@ class StudentLocal @Inject constructor(
return Completable.fromCallable {
studentDb.run {
resetCurrent()
updateCurrent(student.studentId)
updateCurrent(student.id)
}
}
}