Tweak content flag filtering [skip ci]

This commit is contained in:
Akkadius 2020-05-24 01:36:17 -05:00
parent 56c4eb280f
commit e474df2b12
2 changed files with 5 additions and 10 deletions

View File

@ -54,22 +54,17 @@ namespace ContentFilterCriteria {
); );
std::vector<std::string> flags = content_service.GetContentFlags(); std::vector<std::string> flags = content_service.GetContentFlags();
std::string flags_in_filter;
for (auto &flag: flags) {
flag = "'" + flag + "'";
}
std::string flags_in_filter;
if (!flags.empty()) { if (!flags.empty()) {
flags_in_filter = fmt::format( flags_in_filter = fmt::format(
" OR {}content_flags IN ({})", " OR CONCAT(',', {}content_flags, ',') REGEXP ',({}),' ",
table_prefix, table_prefix,
implode(", ", flags) implode("|", flags)
); );
} }
criteria += fmt::format( criteria += fmt::format(
" AND ({}content_flags IS NULL{})", " AND ({}content_flags IS NULL{}) ",
table_prefix, table_prefix,
flags_in_filter flags_in_filter
); );

View File

@ -417,7 +417,7 @@ int main(int argc, char** argv) {
set_content_flags.push_back(flags.flag_name); set_content_flags.push_back(flags.flag_name);
LogInfo( LogInfo(
"Enabling content-flag [{}]", "Enabled content flag [{}]",
flags.flag_name flags.flag_name
); );
} }