~aleteoryx/muditaos

f74051ea4221c5e899626114c866833aaabb0d2d — pawpMudita 5 years ago ee3167c
[EGD-3130] NoName contacts at the end of contact list
2 files changed, 3 insertions(+), 2 deletions(-)

M changelog.md
M module-db/Tables/ContactsTable.cpp
M changelog.md => changelog.md +1 -0
@@ 10,6 10,7 @@
### Fixed

* `[desktopApp]` Fixed endpoint handling.
* `[phonebook]` Sort list of contacts by first name if there is no second name.

### Other
* `[desktopApp]` Added functional tests.

M module-db/Tables/ContactsTable.cpp => module-db/Tables/ContactsTable.cpp +2 -2
@@ 169,14 169,14 @@ std::vector<std::uint32_t> ContactsTable::GetIDsSortedByField(
    query += " ORDER BY group_id DESC ";
    query += " , (contact_name.name_alternative IS NULL OR contact_name.name_alternative ='') ";
    query += " AND (contact_name.name_primary IS NULL OR contact_name.name_primary ='') ASC ";
    query += " , contact_name.name_alternative || ' ' || contact_name.name_primary ";
    query += " , UPPER(contact_name.name_alternative || contact_name.name_primary) ";

    if (limit > 0) {
        query += " LIMIT " + std::to_string(limit);
        query += " OFFSET " + std::to_string(offset);
    }

    query += " COLLATE NOCASE;";
    query += " ;";

    auto queryRet = db->query(query.c_str());
    if ((queryRet == nullptr) || (queryRet->getRowCount() == 0)) {