Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[mkcal] Load events without end time set when looking in a date range…
…. Contributes to JB#51406
  • Loading branch information
dcaliste committed Oct 6, 2020
1 parent 91a9530 commit b27fc56
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/sqlitestorage.h
Expand Up @@ -643,7 +643,7 @@ public Q_SLOTS:
#define SELECT_COMPONENTS_BY_ATTENDEE \
"select * from components where ComponentId in (select DISTINCT ComponentId from attendee) and DateDeleted=0"
#define SELECT_COMPONENTS_BY_DATE_BOTH \
"select * from Components where DateStart<=? and DateEndDue>=? and DateDeleted=0"
"select * from Components where DateStart<=? and (DateEndDue>=? or DateEndDue=0) and DateDeleted=0"
#define SELECT_COMPONENTS_BY_DATE_START \
"select * from Components where DateEndDue>=? and DateDeleted=0"
#define SELECT_COMPONENTS_BY_DATE_END \
Expand Down
14 changes: 13 additions & 1 deletion tests/tst_storage.cpp
Expand Up @@ -341,7 +341,7 @@ void tst_storage::tst_allday()
m_calendar->addEvent(event, NotebookId);
m_storage->save();
QString uid = event->uid();
reloadDb();
reloadDb(QDate(2012, 1, 1), QDate(2014, 1, 1));

auto fetchedEvent = m_calendar->event(uid);
QVERIFY(fetchedEvent.data());
Expand Down Expand Up @@ -1942,4 +1942,16 @@ void tst_storage::reloadDb()
openDb();
}

void tst_storage::reloadDb(const QDate &from, const QDate &to)
{
m_storage.clear();
m_calendar.clear();

m_calendar = ExtendedCalendar::Ptr(new ExtendedCalendar(KDateTime::Spec::LocalZone()));
m_storage = m_calendar->defaultStorage(m_calendar);
m_storage->open();

m_storage->load(from, to);
}

QTEST_GUILESS_MAIN(tst_storage)
1 change: 1 addition & 0 deletions tests/tst_storage.h
Expand Up @@ -77,6 +77,7 @@ private slots:
private:
void openDb(bool clear = false);
void reloadDb();
void reloadDb(const QDate &from, const QDate &to);

ExtendedCalendar::Ptr m_calendar;
ExtendedStorage::Ptr m_storage;
Expand Down

0 comments on commit b27fc56

Please sign in to comment.