From f0305a2ddd7578eabc07110a1baec9e924875a73 Mon Sep 17 00:00:00 2001 From: Jeff Mattson Date: Fri, 21 Aug 2020 12:29:26 -0400 Subject: [PATCH] save last activity timestamp --- src/TopoMojo.Core/Data/Stores/GamespaceStore.cs | 3 +++ src/TopoMojo.Core/Data/Stores/UserStore.cs | 2 ++ src/TopoMojo.Core/Services/GamespaceService.cs | 1 - 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/TopoMojo.Core/Data/Stores/GamespaceStore.cs b/src/TopoMojo.Core/Data/Stores/GamespaceStore.cs index ed5b4b64..7d45f372 100644 --- a/src/TopoMojo.Core/Data/Stores/GamespaceStore.cs +++ b/src/TopoMojo.Core/Data/Stores/GamespaceStore.cs @@ -21,6 +21,7 @@ public GamespaceStore ( public override async Task Add(Gamespace entity) { + if (entity.Workspace != null) { entity.Workspace.LaunchCount += 1; @@ -28,6 +29,8 @@ public override async Task Add(Gamespace entity) entity.Workspace.LastActivity = DateTime.UtcNow; } + entity.LastActivity = DateTime.UtcNow; + var gamespace = await base.Add(entity); return gamespace; diff --git a/src/TopoMojo.Core/Data/Stores/UserStore.cs b/src/TopoMojo.Core/Data/Stores/UserStore.cs index a08918b3..4cd28d48 100644 --- a/src/TopoMojo.Core/Data/Stores/UserStore.cs +++ b/src/TopoMojo.Core/Data/Stores/UserStore.cs @@ -88,6 +88,8 @@ public async Task MemberOf(string globalId, Models.User user) gamespace.LastActivity = DateTime.UtcNow; } + await DbContext.SaveChangesAsync(); + return result; } diff --git a/src/TopoMojo.Core/Services/GamespaceService.cs b/src/TopoMojo.Core/Services/GamespaceService.cs index 5c08bfa1..462d0d32 100644 --- a/src/TopoMojo.Core/Services/GamespaceService.cs +++ b/src/TopoMojo.Core/Services/GamespaceService.cs @@ -86,7 +86,6 @@ public async Task Launch(int workspaceId) { Name = workspace.Name, Workspace = workspace, - LastActivity = DateTime.UtcNow, ShareCode = Guid.NewGuid().ToString("N"), Audience = "topomojo" };