Changeset 31d8a4c for src


Ignore:
Timestamp:
07/28/21 23:42:45 (11 months ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master
Children:
ffb6be7
Parents:
e4dcafe
Message:

Adjust alarm logic to include UTC offset or displayTimeShift.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/event.cpp

    re4dcafe r31d8a4c  
    104104
    105105QList<Event> Event::getImminentAlarmEvents(int maxSecToAlarm, int conferenceId) {
     106    Conference conference = Conference::getById(conferenceId);
    106107    QSqlQuery query;
    107108    query.prepare(selectQuery() + "WHERE xid_conference = :conf AND (start < :start AND alarm = 1) ORDER BY start, duration");
    108109    query.bindValue(":conf", conferenceId);
    109     query.bindValue(":start", convertToDb(QDateTime::currentDateTime().addSecs(maxSecToAlarm), QVariant::DateTime));
     110    QDateTime start;
     111    if (conference.hasUtcOffset()) {
     112        start = QDateTime::currentDateTimeUtc().addSecs(conference.utcOffset() * 60);
     113    } else {
     114        start = QDateTime::currentDateTime();
     115        if (conference.hasDisplayTimeShift()) start = start.addSecs(conference.displayTimeShift() * 60);
     116    }
     117    start = start.addSecs(maxSecToAlarm);
     118    query.bindValue(":start", convertToDb(start, QVariant::DateTime));
    110119    return load(query);
    111120}
Note: See TracChangeset for help on using the changeset viewer.