fix the sort position

This commit is contained in:
Tamo 2021-10-27 14:27:29 +02:00 committed by marin postma
parent 31c7a0105b
commit 37ca50832c
No known key found for this signature in database
GPG Key ID: 6088B7721C3E39F9

View File

@ -172,12 +172,12 @@ make_setting_route!(
use serde_json::json;
analytics.publish(
"RankingRules Updated".to_string(),
json!({
"sort_position": setting.as_ref().map(|sort| sort.iter().filter(|s| s.contains(':')).count()),
}),
Some(req),
);
"RankingRules Updated".to_string(),
json!({
"sort_position": setting.as_ref().map(|sort| sort.iter().position(|s| s == "sort")),
}),
Some(req),
);
}
);
@ -218,7 +218,7 @@ pub async fn update_all(
"Settings Updated".to_string(),
json!({
"ranking_rules": {
"sort_position": settings.ranking_rules.as_ref().set().map(|sort| sort.iter().filter(|s| s.contains(':')).count()),
"sort_position": settings.ranking_rules.as_ref().set().map(|sort| sort.iter().position(|s| s == "sort")),
},
"sortable_attributes": {
"total": settings.sortable_attributes.as_ref().set().map(|sort| sort.len()),