mirror of
https://github.com/InsanusMokrassar/PlaguPoster.git
synced 2025-09-15 04:59:41 +00:00
complete timer plugin
This commit is contained in:
@@ -101,6 +101,7 @@ object Plugin : Plugin {
|
||||
}
|
||||
|
||||
val post = postsRepo.getById(postId) ?: return false
|
||||
ratingsRepo.set(postId, Rating(0.0))
|
||||
for (content in post.content) {
|
||||
runCatchingSafely {
|
||||
val sent = send(
|
||||
@@ -140,7 +141,7 @@ object Plugin : Plugin {
|
||||
}
|
||||
}
|
||||
|
||||
postsRepo.deletedObjectsIdsFlow.subscribeSafelyWithoutExceptions(this) { postId ->
|
||||
ratingsRepo.onValueRemoved.subscribeSafelyWithoutExceptions(this) { postId ->
|
||||
detachPoll(postId)
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package dev.inmo.plaguposter.ratings.exposed
|
||||
|
||||
import dev.inmo.micro_utils.pagination.utils.optionallyReverse
|
||||
import dev.inmo.micro_utils.repos.exposed.initTable
|
||||
import dev.inmo.micro_utils.repos.exposed.keyvalue.AbstractExposedKeyValueRepo
|
||||
import dev.inmo.plaguposter.posts.models.PostId
|
||||
import dev.inmo.plaguposter.ratings.models.Rating
|
||||
@@ -24,6 +25,10 @@ class ExposedRatingsRepo (
|
||||
override val ResultRow.asObject: Rating
|
||||
get() = get(ratingsColumn).let(::Rating)
|
||||
|
||||
init {
|
||||
initTable()
|
||||
}
|
||||
|
||||
override fun update(k: PostId, v: Rating, it: UpdateBuilder<Int>) {
|
||||
it[ratingsColumn] = v.double
|
||||
}
|
||||
|
Reference in New Issue
Block a user