@@ -68,7+66,7 @@ QList<Event> Event::getByDateAndRoom(const QDate& date, int conferenceId)
QSqlQuery query;
QString aliasEvent("E");
QString aliasEventRoom("R");
- query.prepare(QString("SELECT %1 FROM %2 %3, %4 %5 WHERE %3.xid_conference = :conf AND %3.start >= :start AND %3.start < :end AND %3.id = R.xid_event ORDER BY %5.xid_room, %3.start").arg(
+ query.prepare(QString("SELECT %1 FROM %2 %3, %4 %5 WHERE %3.xid_conference = :conf AND %3.start >= :start AND %3.start < :end AND %3.id = R.xid_event ORDER BY %5.xid_room, %3.start, %3.duration").arg(
@@ -109,10+93,11 @@ QList<Event> Event::conflictEvents(int aEventId, int conferenceId)
return load(query);
}
+
QList<Event> Event::getFavByDate(const QDate& date, int conferenceId)
{
QSqlQuery query;
- query.prepare(selectQuery() + QString("WHERE xid_conference = :conf AND start >= :start AND start < :end AND favourite = 1 ORDER BY start"));
+ query.prepare(selectQuery() + QString("WHERE xid_conference = :conf AND start >= :start AND start < :end AND favourite = 1 ORDER BY start, duration"));
- query.prepare("SELECT person.name FROM person INNER JOIN event_person ON person.id = event_person.xid_person AND event_person.xid_event = :id AND event_person.xid_conference = :conf");
+ query.prepare("SELECT person.name FROM person INNER JOIN event_person ON person.id = event_person.xid_person AND event_person.xid_event = :id AND event_person.xid_conference = :conf1 AND person.xid_conference = :conf2");
query.bindValue(":id", id());
- query.bindValue(":conf", conferenceId());
- query.exec();
- // TODO: handle qeury error
- //qDebug() << query.lastError();
+ query.bindValue(":conf1", conferenceId());
+ query.bindValue(":conf2", conferenceId());
+ if (!query.exec()) qDebug() << query.lastError();