Small fixes in MemberAdminWindow

This commit is contained in:
2023-07-20 21:01:12 +02:00
parent 9ba45e58f6
commit 75322da405
2 changed files with 23 additions and 17 deletions

@ -30,8 +30,6 @@ namespace Elwig.Windows {
CommandBindings.Add(new CommandBinding(CtrlF, FocusSearchInput));
ExemptInputs = new Control[] {
SearchInput, ActiveMemberInput, MemberList,
NewMemberButton, EditMemberButton, DeleteMemberButton,
ResetButton, SaveButton, CancelButton
};
RequiredInputs = new Control[] {
MgNrInput, GivenNameInput, FamilyNameInput,
@ -74,12 +72,14 @@ namespace Elwig.Windows {
List<Member> members = await memberQuery.ToListAsync();
if (TextFilter.Count > 0) {
members = members
var dict = members
.ToDictionary(m => m, m => m.SearchScore(TextFilter))
.OrderByDescending(a => a.Value)
.ThenBy(a => a.Key.FamilyName)
.ThenBy(a => a.Key.GivenName)
.Where(a => a.Value > 0)
.ThenBy(a => a.Key.GivenName);
var threshold = dict.Select(a => a.Value).Max() * 3 / 4;
members = dict
.Where(a => a.Value > threshold)
.Select(a => a.Key)
.ToList();
} else {