Skip to content

Commit

Permalink
[BUGFIX] fix booked controller search filter (#324)
Browse files Browse the repository at this point in the history
That part was missed during refactoring of the search models.
  • Loading branch information
jonaseberle committed Jul 3, 2023
1 parent 94dd97a commit a1ee09b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/models/filters/BookedAtcSortFilter.cpp
Expand Up @@ -3,8 +3,8 @@
bool BookedAtcSortFilter::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const {
if (this->_from.isValid() && this->_to.isValid()) {
if (sourceModel()->index(source_row, 0, source_parent).isValid()) {
QDateTime starts = sourceModel()->index(source_row, 4, source_parent).data(Qt::EditRole).toDateTime().toUTC();
QDateTime ends = sourceModel()->index(source_row, 5, source_parent).data(Qt::EditRole).toDateTime().toUTC();
QDateTime starts = sourceModel()->index(source_row, 4, source_parent).data(Qt::UserRole).toDateTime().toUTC();
QDateTime ends = sourceModel()->index(source_row, 5, source_parent).data(Qt::UserRole).toDateTime().toUTC();
if (
(_to == _from && _from <= ends) // _to == _from means for: ever
|| (_from <= starts && _to >= starts)
Expand All @@ -21,8 +21,8 @@ bool BookedAtcSortFilter::filterAcceptsRow(int source_row, const QModelIndex& so
}

bool BookedAtcSortFilter::lessThan(const QModelIndex &left, const QModelIndex &right) const {
auto leftData = sourceModel()->data(left, Qt::EditRole);
auto rightData = sourceModel()->data(right, Qt::EditRole);
auto leftData = sourceModel()->data(left, Qt::UserRole);
auto rightData = sourceModel()->data(right, Qt::UserRole);

if (leftData.userType() == QMetaType::QDateTime) {
return leftData.toDateTime() < rightData.toDateTime();
Expand Down

0 comments on commit a1ee09b

Please sign in to comment.