Implement dynamic group management features with exclusions and mode handling
Enhanced the group management system by introducing dynamic group capabilities, allowing for the exclusion of elements from dynamic groups. Updated the Group and GroupItem models to support a new GroupMode, enabling the distinction between static and dynamic groups. Implemented API endpoints for excluding elements and updated related services to handle group composition based on the selected mode. Improved the frontend to accommodate these changes, including new API functions and UI components for managing exclusions and group modes, thereby enhancing the overall user experience in group management.
This commit is contained in:
@@ -13,6 +13,9 @@ public class GroupItem
|
||||
public GroupElementKind ElementKind { get; private set; }
|
||||
public Guid ElementId { get; private set; }
|
||||
|
||||
/// <summary>Чем эта позиция является для группы — см. <see cref="GroupItemRole"/>.</summary>
|
||||
public GroupItemRole Role { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Вес при случайном выборе внутри группы (по умолчанию 1). Не конфликтует с остыванием, если
|
||||
/// применять их в правильном порядке: сначала остывание отсекает недавно показанное, затем
|
||||
@@ -31,7 +34,8 @@ public class GroupItem
|
||||
Guid groupId,
|
||||
GroupElementKind elementKind,
|
||||
Guid elementId,
|
||||
int position
|
||||
int position,
|
||||
GroupItemRole role = GroupItemRole.Member
|
||||
) =>
|
||||
new()
|
||||
{
|
||||
@@ -39,10 +43,13 @@ public class GroupItem
|
||||
GroupId = groupId,
|
||||
ElementKind = elementKind,
|
||||
ElementId = elementId,
|
||||
Role = role,
|
||||
Weight = DefaultWeight,
|
||||
Position = position,
|
||||
};
|
||||
|
||||
internal void SetRole(GroupItemRole role) => Role = role;
|
||||
|
||||
internal void SetPosition(int position) => Position = position;
|
||||
|
||||
internal void SetWeight(int weight) => Weight = Math.Max(0, weight);
|
||||
|
||||
Reference in New Issue
Block a user