3472: Give polls a default duration (#3473)

This commit is contained in:
UlrichKu 2023-03-21 18:52:38 +01:00 committed by GitHub
parent 3fc1892c7d
commit d754df8f07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,8 +75,10 @@ fun showAddPollDialog(
}
}
val DAY_SECONDS = 60 * 60 * 24
val desiredDuration = poll?.expiresIn ?: DAY_SECONDS
val pollDurationId = durations.indexOfLast {
it <= (poll?.expiresIn ?: 0)
it <= desiredDuration
}
binding.pollDurationSpinner.setSelection(pollDurationId)