mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Adjust the counter function for filter with "none of the above"
So this should count dives with neither buddy nor divemaster, without a location, with no tags, etc. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
dae76cdc2d
commit
8086b39e11
2 changed files with 13 additions and 3 deletions
14
dive.c
14
dive.c
|
@ -2507,8 +2507,13 @@ int count_dives_with_tag(const char *tag)
|
||||||
struct dive *d;
|
struct dive *d;
|
||||||
|
|
||||||
for_each_dive (i, d) {
|
for_each_dive (i, d) {
|
||||||
if (taglist_contains(d->tag_list, tag))
|
if (same_string(tag, "")) {
|
||||||
|
// count dives with no tags
|
||||||
|
if (d->tag_list == NULL)
|
||||||
|
counter++;
|
||||||
|
} else if (taglist_contains(d->tag_list, tag)) {
|
||||||
counter++;
|
counter++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return counter;
|
return counter;
|
||||||
}
|
}
|
||||||
|
@ -2522,8 +2527,13 @@ int count_dives_with_person(const char *person)
|
||||||
struct dive *d;
|
struct dive *d;
|
||||||
|
|
||||||
for_each_dive (i, d) {
|
for_each_dive (i, d) {
|
||||||
if (string_sequence_contains(d->buddy, person) || string_sequence_contains(d->divemaster, person))
|
if (same_string(person, "")) {
|
||||||
|
// solo dive
|
||||||
|
if (same_string(d->buddy, "") && same_string(d->divemaster, ""))
|
||||||
|
counter++;
|
||||||
|
} else if (string_sequence_contains(d->buddy, person) || string_sequence_contains(d->divemaster, person)) {
|
||||||
counter++;
|
counter++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return counter;
|
return counter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ QVariant CLASS::data(const QModelIndex &index, int role) const \
|
||||||
return checkState[index.row()] ? Qt::Checked : Qt::Unchecked; \
|
return checkState[index.row()] ? Qt::Checked : Qt::Unchecked; \
|
||||||
} else if (role == Qt::DisplayRole) { \
|
} else if (role == Qt::DisplayRole) { \
|
||||||
QString value = stringList()[index.row()]; \
|
QString value = stringList()[index.row()]; \
|
||||||
int count = COUNTER_FUNCTION(value.toUtf8().data()); \
|
int count = COUNTER_FUNCTION((index.row() == rowCount() - 1) ? "" : value.toUtf8().data()); \
|
||||||
return value + QString(" (%1)").arg(count); \
|
return value + QString(" (%1)").arg(count); \
|
||||||
} \
|
} \
|
||||||
return QVariant(); \
|
return QVariant(); \
|
||||||
|
|
Loading…
Add table
Reference in a new issue