Replace history query with actual upsert

This commit is contained in:
arkon
2022-05-29 12:12:06 -04:00
parent 0dbe82c781
commit cd0294b1b6
4 changed files with 21 additions and 34 deletions

View File

@@ -93,22 +93,12 @@ class HistoryRepositoryImpl(
override suspend fun upsertHistory(historyUpdate: HistoryUpdate) {
try {
try {
handler.await {
historyQueries.insert(
historyUpdate.chapterId,
historyUpdate.readAt,
historyUpdate.sessionReadDuration,
)
}
} catch (e: Exception) {
handler.await {
historyQueries.update(
historyUpdate.readAt,
historyUpdate.sessionReadDuration,
historyUpdate.chapterId,
)
}
handler.await {
historyQueries.upsert(
historyUpdate.chapterId,
historyUpdate.readAt,
historyUpdate.sessionReadDuration,
)
}
} catch (e: Exception) {
logcat(LogPriority.ERROR, throwable = e)