Commit 318ac801 authored by Jian Li's avatar Jian Li Committed by Jian Li
Browse files

remove added to descAdded

parent a795fb74
Pipeline #12010 passed with stage
in 19 minutes and 23 seconds
......@@ -886,7 +886,7 @@ std::string Media::sortRequest( const QueryParameters* params )
auto sort = params != nullptr ? params->sort : SortingCriteria::Default;
auto desc = params != nullptr ? params->desc : false;
auto added = false;
auto descAdded = false;
switch ( sort )
{
case SortingCriteria::Duration:
......@@ -904,7 +904,7 @@ std::string Media::sortRequest( const QueryParameters* params )
break;
case SortingCriteria::Filename:
req += sqlite::Tools::sortedStringField("m.filename",desc,true);
added = true;
descAdded = true;
break;
case SortingCriteria::LastModificationDate:
req += "f.last_modification_date";
......@@ -919,11 +919,11 @@ std::string Media::sortRequest( const QueryParameters* params )
req += ", att.track_number";
else
req += ", att.track_number";
added = true;
descAdded = true;
break;
case SortingCriteria::Artist:
req += sqlite::Tools::sortedStringField("art.name",desc,false);
added = true;
descAdded = true;
break;
case SortingCriteria::TrackId:
req += sqlite::Tools::sortedStringField("alb.title",false,false);
......@@ -931,7 +931,7 @@ std::string Media::sortRequest( const QueryParameters* params )
req += ", att.track_number DESC, att.disc_number";
else
req += ", att.track_number, att.disc_number";
added = true;
descAdded = true;
break;
default:
LOG_WARN( "Unsupported sorting criteria, falling back to SortingCriteria::Default (Alpha)" );
......@@ -939,10 +939,10 @@ std::string Media::sortRequest( const QueryParameters* params )
case SortingCriteria::Default:
case SortingCriteria::Alpha:
req += sqlite::Tools::sortedStringField("m.title",desc,false);
added = true;
descAdded = true;
break;
}
if ( desc == true && !added)
if ( desc == true && !descAdded)
req += " DESC";
return req;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment