Cosmetic: Komment ERS entfernt und kleiner Cleanup beim Server Service
This commit is contained in:
@ -3,6 +3,7 @@ using System.Linq;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Oqtane.Models;
|
||||||
using Oqtane.Services;
|
using Oqtane.Services;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using SZUAbsolventenverein.Module.EventRegistration.Models;
|
using SZUAbsolventenverein.Module.EventRegistration.Models;
|
||||||
@ -15,27 +16,6 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
|
|
||||||
private string Apiurl => CreateApiUrl("EventRegistration");
|
private string Apiurl => CreateApiUrl("EventRegistration");
|
||||||
|
|
||||||
/*public async Task<List<Models.Event>> GetEventRegistrationsAsync(int ModuleId)
|
|
||||||
{
|
|
||||||
List<Models.Event> EventRegistrations = await GetJsonAsync<List<Models.Event>>(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty<Models.Event>().ToList());
|
|
||||||
return EventRegistrations.OrderBy(item => item.Name).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Models.Event> GetEventRegistrationAsync(int EventRegistrationId, int ModuleId)
|
|
||||||
{
|
|
||||||
return await GetJsonAsync<Models.Event>(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistrationId}/{ModuleId}", EntityNames.Module, ModuleId));
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Models.Event> AddEventRegistrationAsync(Models.Event EventRegistration)
|
|
||||||
{
|
|
||||||
return await PostJsonAsync<Models.Event>(CreateAuthorizationPolicyUrl($"{Apiurl}", EntityNames.Module, EventRegistration.ModuleId), EventRegistration);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Models.Event> UpdateEventRegistrationAsync(Models.Event EventRegistration)
|
|
||||||
{
|
|
||||||
return await PutJsonAsync<Models.Event>(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistration.EventRegistrationId}", EntityNames.Module, EventRegistration.ModuleId), EventRegistration);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public async Task<List<Event>> GetEventsAsync(int ModuleId)
|
public async Task<List<Event>> GetEventsAsync(int ModuleId)
|
||||||
{
|
{
|
||||||
List<Event> EventRegistrations = await GetJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty<Event>().ToList());
|
List<Event> EventRegistrations = await GetJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty<Event>().ToList());
|
||||||
@ -80,5 +60,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<List<User>> GetRecommendedResponses(int EventId, int ModuleId)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,16 +169,9 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
|
|
||||||
|
|
||||||
IEnumerable<GroupingUser> gu = responses.Join(users, r => r.OwnerId, u => u.UserId,
|
IEnumerable<GroupingUser> gu = responses.Join(users, r => r.OwnerId, u => u.UserId,
|
||||||
(response, user) => new GroupingUser(user, response)).GroupJoin(userSettings, gu => gu.User.UserId,
|
(response, user) => (response, user)).GroupJoin(userSettings, ru => ru.user.UserId,
|
||||||
s => s.EntityId, (gu, s) =>
|
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();
|
||||||
gu.Settings = s;
|
|
||||||
gu.TargetJahr = targetStartjahr;
|
|
||||||
gu.TargetFachrichtung = targetFachrichtung;
|
|
||||||
|
|
||||||
return gu;
|
|
||||||
}).OrderBy(gu => gu.Score());
|
|
||||||
return gu.Select(gu => gu.User).ToList();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -259,10 +252,13 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
set { _targetyear = value; }
|
set { _targetyear = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupingUser(User user, Response response)
|
public GroupingUser(User user, Response response, IEnumerable<Setting> settings, int targetyear, string targetfachrichtung)
|
||||||
{
|
{
|
||||||
_user = user;
|
_user = user;
|
||||||
_response = response;
|
_response = response;
|
||||||
|
Settings = settings;
|
||||||
|
TargetJahr = targetyear;
|
||||||
|
TargetFachrichtung = targetfachrichtung;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Score()
|
public int Score()
|
||||||
|
|||||||
Reference in New Issue
Block a user