Changeset 9196cb0 in confclerk_git


Ignore:
Timestamp:
10/17/11 23:49:51 (11 years ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master, qt5
Children:
018d4d6
Parents:
11d7ec5
Message:

Sorted by duration additionally to start.

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/gui/searchtabcontainer.cpp

    r11d7ec5 r9196cb0  
    7777    {
    7878        try{
    79             int count = Event::getSearchResultByDate(d, confId, "start").count();
     79            int count = Event::getSearchResultByDate(d, confId, "start, duration").count();
    8080            if(count && (firstDateWithFounds==endDate))
    8181                firstDateWithFounds=d;
  • src/mvc/event.cpp

    r11d7ec5 r9196cb0  
    4444}
    4545
    46 Event Event::getById(int id, int conferenceId)
    47 {
     46Event Event::getById(int id, int conferenceId) {
    4847    QSqlQuery query;
    4948    query.prepare(selectQuery() + "WHERE id = :id AND xid_conference = :conf");
     
    5352}
    5453
    55 QList<Event> Event::getByDate(const QDate& date, int conferenceId, QString orderBy)
    56 {
     54
     55QList<Event> Event::getByDate(const QDate& date, int conferenceId, QString orderBy) {
    5756    QSqlQuery query;
    5857    query.prepare(selectQuery() + QString("WHERE xid_conference = :conf AND start >= :start AND start < :end ORDER BY %1").arg(orderBy));
     
    6059    query.bindValue(":start", convertToDb(date, QVariant::DateTime));
    6160    query.bindValue(":end", convertToDb(date.addDays(1), QVariant::DateTime));
    62 
    6361    return load(query);
    6462}
     
    6967    QString aliasEvent("E");
    7068    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(
    7270                    columnsForSelect(aliasEvent), Event::sTableName, aliasEvent, "EVENT_ROOM", aliasEventRoom));
    7371    query.bindValue(":conf", conferenceId);
     
    8583           ( start >= :s1 AND ( start + duration ) < :e1 ) \
    8684        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");
    8886    query.bindValue(":conf", event.conferenceId());
    8987    query.bindValue(":s1", convertToDb(event.start(), QVariant::DateTime));
     
    10098{
    10199    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"));
    103101    query.bindValue(":conf", conferenceId);
    104102    query.bindValue(":start", convertToDb(date, QVariant::DateTime));
  • src/mvc/eventmodel.cpp

    r11d7ec5 r9196cb0  
    242242    if(Conference::getAll().count())
    243243    {
    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");
    245245    }
    246246    createTimeGroups();
     
    265265    {
    266266        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");
    268268        }
    269269        catch( OrmException &e  ){
     
    286286    if (Conference::getAll().count())
    287287    {
    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");
    289289    }
    290290    createTrackGroups();
Note: See TracChangeset for help on using the changeset viewer.