mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-06 11:58:38 +00:00
Fix test compilation and level activity flattening
This commit is contained in:
parent
180cac5aa9
commit
b41b01a6eb
3 changed files with 18 additions and 6 deletions
|
@ -283,11 +283,13 @@ public class ActivityController : ControllerBase
|
|||
foreach (IGrouping<InnerActivityGroup, ActivityDto> item in itemGroup)
|
||||
{
|
||||
Logger.Debug(
|
||||
@$" Inner group key: TargetId={item.Key.TargetId}, UserId={item.Key.UserId}, Type={item.Key.Type}", LogArea.Activity);
|
||||
@$" Inner group key: TargetId={item.Key.TargetId}, UserId={item.Key.UserId}, Type={item.Key.Type}",
|
||||
LogArea.Activity);
|
||||
foreach (ActivityDto activity in item)
|
||||
{
|
||||
Logger.Debug(
|
||||
@$" Activity: {activity.GroupType}, Timestamp: {activity.Activity.Timestamp}, UserId: {activity.Activity.UserId}, EventType: {activity.Activity.Type}, TargetId: {activity.TargetId}", LogArea.Activity);
|
||||
@$" Activity: {activity.GroupType}, Timestamp: {activity.Activity.Timestamp}, UserId: {activity.Activity.UserId}, EventType: {activity.Activity.Type}, TargetId: {activity.TargetId}",
|
||||
LogArea.Activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -308,6 +310,14 @@ public class ActivityController : ControllerBase
|
|||
IQueryable<ActivityDto> activityQuery = this.database.Activities.ToActivityDto()
|
||||
.Where(a => a.Activity.Type != EventType.NewsPost && a.Activity.Type != EventType.MMPickLevel);
|
||||
|
||||
if (token.GameVersion != GameVersion.LittleBigPlanet3)
|
||||
{
|
||||
activityQuery = activityQuery.Where(a =>
|
||||
a.Activity.Type != EventType.CreatePlaylist &&
|
||||
a.Activity.Type != EventType.HeartPlaylist &&
|
||||
a.Activity.Type != EventType.AddLevelToPlaylist);
|
||||
}
|
||||
|
||||
bool isLevelActivity = username == null;
|
||||
|
||||
// Slot activity
|
||||
|
@ -346,6 +356,7 @@ public class ActivityController : ControllerBase
|
|||
return this.Ok(GameStream.CreateFromGroups(token,
|
||||
outerGroups,
|
||||
times.Start.ToUnixTimeMilliseconds(),
|
||||
oldestTimestamp, isLevelActivity));
|
||||
oldestTimestamp,
|
||||
isLevelActivity));
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ using LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers.Slots;
|
|||
using LBPUnion.ProjectLighthouse.Tests.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
||||
using LBPUnion.ProjectLighthouse.Types.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Types.Serialization.Review;
|
||||
using LBPUnion.ProjectLighthouse.Types.Users;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Xunit;
|
||||
|
|
|
@ -134,9 +134,10 @@ public class GameStream : ILbpSerializable, INeedsPreparationForSerialization
|
|||
gameStream.Groups = groups.Select(GameStreamGroup.CreateFromGroup).ToList();
|
||||
|
||||
// Workaround for level activity because it shouldn't contain nested activity groups
|
||||
if (gameStream.Groups.Count == 1 && groups.First().Key.GroupType == ActivityGroupType.Level && removeNesting)
|
||||
if (gameStream.Groups.Count >= 1 && groups.All(g => g.Key.GroupType == ActivityGroupType.Level) && removeNesting)
|
||||
{
|
||||
gameStream.Groups = gameStream.Groups.First().Groups;
|
||||
// Flatten all inner groups into a single list
|
||||
gameStream.Groups = gameStream.Groups.Select(g => g.Groups).SelectMany(g => g).ToList();
|
||||
}
|
||||
|
||||
// Workaround to turn a single subgroup into the primary group for news and team picks
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue