Revert default sort

This commit is contained in:
Meutel 2017-01-14 09:31:38 +01:00
parent 358ccc7eed
commit dca5b43600
3 changed files with 42 additions and 18 deletions

View File

@ -92,10 +92,14 @@ static int
query_authors(const char* sort, const char *order)
{
int query = STMT_AUTHORS_ID_ASC;
if (NULL != sort && 0 == strcmp(sort, "name"))
if (NULL != sort && 0 == strcmp(sort, "name")) {
query = STMT_AUTHORS_NAME_ASC;
if (NULL != order && 0 == strcmp(order, "desc"))
query++;
if (NULL != order && 0 == strcmp(order, "desc"))
query++;
} else {
if (NULL == order || 0 == strcmp(order, "desc"))
query++;
}
return query;
}

View File

@ -255,10 +255,14 @@ static int
query_books(const char* sort, const char *order)
{
int query = STMT_BOOKS_ID_ASC;
if (NULL != sort && 0 == strcmp(sort, "title"))
if (NULL != sort && 0 == strcmp(sort, "title")) {
query = STMT_BOOKS_TITLE_ASC;
if (NULL != order && 0 == strcmp(order, "desc"))
query++;
if (NULL != order && 0 == strcmp(order, "desc"))
query++;
} else {
if (NULL == order || 0 == strcmp(order, "desc"))
query++;
}
return query;
}
@ -266,10 +270,14 @@ static int
query_books_authors(const char* sort, const char *order)
{
int query = STMT_BOOKS_AUTHORS_ID_ASC;
if (NULL != sort && 0 == strcmp(sort, "title"))
if (NULL != sort && 0 == strcmp(sort, "title")) {
query = STMT_BOOKS_AUTHORS_TITLE_ASC;
if (NULL != order && 0 == strcmp(order, "desc"))
query++;
if (NULL != order && 0 == strcmp(order, "desc"))
query++;
} else {
if (NULL == order || 0 == strcmp(order, "desc"))
query++;
}
return query;
}
@ -277,10 +285,14 @@ static int
query_books_tags(const char* sort, const char *order)
{
int query = STMT_BOOKS_TAGS_ID_ASC;
if (NULL != sort && 0 == strcmp(sort, "title"))
if (NULL != sort && 0 == strcmp(sort, "title")) {
query = STMT_BOOKS_TAGS_TITLE_ASC;
if (NULL != order && 0 == strcmp(order, "desc"))
query++;
if (NULL != order && 0 == strcmp(order, "desc"))
query++;
} else {
if (NULL == order || 0 == strcmp(order, "desc"))
query++;
}
return query;
}

View File

@ -124,10 +124,14 @@ static int
query_series(const char* sort, const char *order)
{
int query = STMT_SERIES_ID_ASC;
if (NULL != sort && 0 == strcmp(sort, "name"))
if (NULL != sort && 0 == strcmp(sort, "name")) {
query = STMT_SERIES_NAME_ASC;
if (NULL != order && 0 == strcmp(order, "desc"))
query++;
if (NULL != order && 0 == strcmp(order, "desc"))
query++;
} else {
if (NULL == order || 0 == strcmp(order, "desc"))
query++;
}
return query;
}
@ -135,10 +139,14 @@ static int
query_seriesauth(const char* sort, const char *order)
{
int query = STMT_SERIES_AUTHORS_ID_ASC;
if (NULL != sort && 0 == strcmp(sort, "name"))
if (NULL != sort && 0 == strcmp(sort, "name")) {
query = STMT_SERIES_AUTHORS_NAME_ASC;
if (NULL != order && 0 == strcmp(order, "desc"))
query++;
if (NULL != order && 0 == strcmp(order, "desc"))
query++;
} else {
if (NULL == order || 0 == strcmp(order, "desc"))
query++;
}
return query;
}