Rated people panel added

This commit is contained in:
2024-11-01 20:44:01 +01:00
Unverified
parent 226b2b619c
commit 1154cc547b
28 changed files with 479 additions and 59 deletions

View File

@@ -0,0 +1,35 @@
namespace WatchIt.Common.Model.Rating;
public class RatingResponseBuilder
{
#region FIELDS
private long _sum;
private long _count;
#endregion
#region CONSTRUCTORS
private RatingResponseBuilder() { }
public static RatingResponseBuilder Initialize() => new RatingResponseBuilder();
#endregion
#region PUBLIC METHODS
public RatingResponseBuilder Add<T>(IEnumerable<T> collection, Func<T, short> selector)
{
_sum += collection.Sum(x => selector(x));
_count += collection.Count();
return this;
}
public RatingResponse Build() => new RatingResponse(_sum, _count);
#endregion
}