Replace history query with actual upsert

(cherry picked from commit cd0294b1b6)
This commit is contained in:
arkon
2022-05-29 12:12:06 -04:00
committed by Jobobby04
parent d5a09b4035
commit 2ae1b6ac3e
4 changed files with 21 additions and 34 deletions
@@ -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)