- Timestamp:
- 10/17/11 23:49:51 (11 years ago)
- Branches:
- master, qt5
- Children:
- 018d4d6
- Parents:
- 11d7ec5
- Location:
- src/mvc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mvc/event.cpp
r11d7ec5 r9196cb0 44 44 } 45 45 46 Event Event::getById(int id, int conferenceId) 47 { 46 Event Event::getById(int id, int conferenceId) { 48 47 QSqlQuery query; 49 48 query.prepare(selectQuery() + "WHERE id = :id AND xid_conference = :conf"); … … 53 52 } 54 53 55 QList<Event> Event::getByDate(const QDate& date, int conferenceId, QString orderBy) 56 {54 55 QList<Event> Event::getByDate(const QDate& date, int conferenceId, QString orderBy) { 57 56 QSqlQuery query; 58 57 query.prepare(selectQuery() + QString("WHERE xid_conference = :conf AND start >= :start AND start < :end ORDER BY %1").arg(orderBy)); … … 60 59 query.bindValue(":start", convertToDb(date, QVariant::DateTime)); 61 60 query.bindValue(":end", convertToDb(date.addDays(1), QVariant::DateTime)); 62 63 61 return load(query); 64 62 } … … 69 67 QString aliasEvent("E"); 70 68 QString aliasEventRoom("R"); 71 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(69 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( 72 70 columnsForSelect(aliasEvent), Event::sTableName, aliasEvent, "EVENT_ROOM", aliasEventRoom)); 73 71 query.bindValue(":conf", conferenceId); … … 85 83 ( start >= :s1 AND ( start + duration ) < :e1 ) \ 86 84 OR ( ( start + duration ) > :s2 AND start < :e2 ) ) \ 87 AND favourite = 1 AND NOT id = :id ORDER BY start ");85 AND favourite = 1 AND NOT id = :id ORDER BY start, duration"); 88 86 query.bindValue(":conf", event.conferenceId()); 89 87 query.bindValue(":s1", convertToDb(event.start(), QVariant::DateTime)); … … 100 98 { 101 99 QSqlQuery query; 102 query.prepare(selectQuery() + QString("WHERE xid_conference = :conf AND start >= :start AND start < :end AND favourite = 1 ORDER BY start "));100 query.prepare(selectQuery() + QString("WHERE xid_conference = :conf AND start >= :start AND start < :end AND favourite = 1 ORDER BY start, duration")); 103 101 query.bindValue(":conf", conferenceId); 104 102 query.bindValue(":start", convertToDb(date, QVariant::DateTime)); -
src/mvc/eventmodel.cpp
r11d7ec5 r9196cb0 242 242 if(Conference::getAll().count()) 243 243 { 244 mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start ");244 mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start, duration"); 245 245 } 246 246 createTimeGroups(); … … 265 265 { 266 266 try{ 267 mEvents = Event::getSearchResultByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start ");267 mEvents = Event::getSearchResultByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start, duration"); 268 268 } 269 269 catch( OrmException &e ){ … … 286 286 if (Conference::getAll().count()) 287 287 { 288 mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "xid_track, start ");288 mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "xid_track, start, duration"); 289 289 } 290 290 createTrackGroups();
Note: See TracChangeset
for help on using the changeset viewer.