Ignore:
Timestamp:
08/18/21 21:17:28 (5 months ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master
Children:
a59d5c4
Parents:
ff579df
Message:

Fix bug: display_time_shift was lost when conference was reloaded.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sql/sqlengine.cpp

    rff579df r763b877  
    145145
    146146
    147 void SqlEngine::addConferenceToDB(QHash<QString,QString> &aConference, int conferenceId) {
     147void SqlEngine::addConferenceToDB(QHash<QString,QString> &aConference, int conferenceId, bool omit_display_time_shift) {
    148148    QSqlQuery query(db);
    149149    bool insert = conferenceId <= 0;
     
    154154                                                ":day_change,:timeslot_duration,:utc_offset,:display_time_shift,:active)");
    155155    } else { // update conference
    156         query.prepare("UPDATE CONFERENCE set title=:title, url=:url, subtitle=:subtitle, venue=:venue, city=:city, start=:start, end=:end,"
    157                                             "day_change=:day_change, timeslot_duration=:timeslot_duration, utc_offset=:utc_offset, display_time_shift=:display_time_shift, active=:active "
    158                       "WHERE id=:id");
     156        QString update = "UPDATE CONFERENCE set title=:title, url=:url, subtitle=:subtitle, venue=:venue, city=:city, start=:start, end=:end, "
     157                         "day_change=:day_change, timeslot_duration=:timeslot_duration, utc_offset=:utc_offset";
     158        if (!omit_display_time_shift) update += ", display_time_shift=:display_time_shift";
     159        update += ", active=:active WHERE id=:id";
     160        query.prepare(update);
    159161    }
    160162    foreach (QString prop_name, (QList<QString>() << "title" << "url" << "subtitle" << "venue" << "city")) {
     
    169171    if (!aConference.value("utc_offset").isEmpty()) utc_offset = aConference["utc_offset"].toInt();
    170172    query.bindValue(":utc_offset", utc_offset);
    171     QVariant display_time_shift;
    172     if (!aConference.value("display_time_shift").isEmpty()) display_time_shift = aConference["display_time_shift"].toInt();
    173     query.bindValue(":display_time_shift", display_time_shift);
     173    if (!omit_display_time_shift) {
     174        QVariant display_time_shift;
     175        if (!aConference.value("display_time_shift").isEmpty()) display_time_shift = aConference["display_time_shift"].toInt();
     176        query.bindValue(":display_time_shift", display_time_shift);
     177    }
    174178    query.bindValue(":active", 1);
    175179    if (!insert) query.bindValue(":id", conferenceId);
Note: See TracChangeset for help on using the changeset viewer.