diff --git a/Client/Services/EventRegistrationService.cs b/Client/Services/EventRegistrationService.cs index 6e45618..3462820 100644 --- a/Client/Services/EventRegistrationService.cs +++ b/Client/Services/EventRegistrationService.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Net.Http; using System.Threading.Tasks; using Microsoft.Extensions.Logging; +using Oqtane.Models; using Oqtane.Services; using Oqtane.Shared; using SZUAbsolventenverein.Module.EventRegistration.Models; @@ -15,27 +16,6 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services private string Apiurl => CreateApiUrl("EventRegistration"); - /*public async Task> GetEventRegistrationsAsync(int ModuleId) - { - List EventRegistrations = await GetJsonAsync>(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty().ToList()); - return EventRegistrations.OrderBy(item => item.Name).ToList(); - } - - public async Task GetEventRegistrationAsync(int EventRegistrationId, int ModuleId) - { - return await GetJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistrationId}/{ModuleId}", EntityNames.Module, ModuleId)); - } - - public async Task AddEventRegistrationAsync(Models.Event EventRegistration) - { - return await PostJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}", EntityNames.Module, EventRegistration.ModuleId), EventRegistration); - } - - public async Task UpdateEventRegistrationAsync(Models.Event EventRegistration) - { - return await PutJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistration.EventRegistrationId}", EntityNames.Module, EventRegistration.ModuleId), EventRegistration); - }*/ - public async Task> GetEventsAsync(int ModuleId) { List EventRegistrations = await GetJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty().ToList()); @@ -80,5 +60,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services { throw new System.NotImplementedException(); } + + public Task> GetRecommendedResponses(int EventId, int ModuleId) + { + throw new System.NotImplementedException(); + } } } diff --git a/Server/Services/EventRegistrationService.cs b/Server/Services/EventRegistrationService.cs index 19ca9ab..ca5b73d 100644 --- a/Server/Services/EventRegistrationService.cs +++ b/Server/Services/EventRegistrationService.cs @@ -169,16 +169,9 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services IEnumerable gu = responses.Join(users, r => r.OwnerId, u => u.UserId, - (response, user) => new GroupingUser(user, response)).GroupJoin(userSettings, gu => gu.User.UserId, - s => s.EntityId, (gu, s) => - { - gu.Settings = s; - gu.TargetJahr = targetStartjahr; - gu.TargetFachrichtung = targetFachrichtung; - - return gu; - }).OrderBy(gu => gu.Score()); - return gu.Select(gu => gu.User).ToList(); + (response, user) => (response, user)).GroupJoin(userSettings, ru => ru.user.UserId, + s => s.EntityId, (ru, s) => new GroupingUser(ru.user, ru.response, s, targetStartjahr, targetFachrichtung)).OrderBy(gu => gu.Score()); + return gu.Select(gu => gu.User).Take(10).ToList(); } else { @@ -259,10 +252,13 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services set { _targetyear = value; } } - public GroupingUser(User user, Response response) + public GroupingUser(User user, Response response, IEnumerable settings, int targetyear, string targetfachrichtung) { _user = user; _response = response; + Settings = settings; + TargetJahr = targetyear; + TargetFachrichtung = targetfachrichtung; } public int Score()