fix randomizing interval bug

This commit is contained in:
Xavier Valls 2021-05-10 19:15:24 +02:00
parent c669765256
commit a174ec4ee7

View File

@ -215,9 +215,9 @@ void EditEntryWidget::setupMain()
TimeDelta delta = std::get<1>(m_extensionOnPwUpdate) * std::get<0>(m_extensionOnPwUpdate); TimeDelta delta = std::get<1>(m_extensionOnPwUpdate) * std::get<0>(m_extensionOnPwUpdate);
QDateTime now = Clock::currentDateTime(); QDateTime now = Clock::currentDateTime();
QDateTime expiryDateTime = now + delta; QDateTime expiryDateTime = now + delta;
if (m_mainUi->randomizeExtensionDeadline->isEnabled()) { if (m_mainUi->randomizeExtensionDeadline->isChecked()) {
expiryDateTime = expiryDateTime =
expiryDateTime.addDays(-QRandomGenerator::global()->bounded(0, m_daysRandomizeExtension)); expiryDateTime.addDays(-QRandomGenerator::global()->bounded(0, m_daysRandomizeExtension+1));
} }
m_mainUi->expireDatePicker->setDateTime(expiryDateTime); m_mainUi->expireDatePicker->setDateTime(expiryDateTime);
} }