From 927e0dfbb953841795433b871f98cb628899dcb1 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sat, 27 Jan 2024 23:05:27 +0100 Subject: [PATCH] fix: add creationDate on proposition --- Assets/Scripts/DatabaseClasses/Proposition.cs | 1 + Assets/Scripts/RoomManager.cs | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/DatabaseClasses/Proposition.cs b/Assets/Scripts/DatabaseClasses/Proposition.cs index 2fe170c..b63278b 100644 --- a/Assets/Scripts/DatabaseClasses/Proposition.cs +++ b/Assets/Scripts/DatabaseClasses/Proposition.cs @@ -8,4 +8,5 @@ public class Proposition public string photoUrl; public Player owner; public string[] voters; + public double creationDate; } diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index e8b3204..4742796 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -244,7 +244,12 @@ public void GeneratePrompts() { Dictionary propositions = new(); Player basePlayer = fullPlayers[0]; - propositions.Add(Guid.NewGuid().ToString(), new Proposition() { owner = basePlayer }); + + propositions.Add(Guid.NewGuid().ToString(), new Proposition() + { + owner = basePlayer, + creationDate = DateTime.Now.ToOADate() + }); for (int i = 1; i < fullPlayers.Count(); i++) { @@ -252,7 +257,12 @@ public void GeneratePrompts() if (basePlayer.id != secondPlayer.id) { - propositions.Add(Guid.NewGuid().ToString(), new Proposition() { owner = secondPlayer }); + propositions.Add(Guid.NewGuid().ToString(), new Proposition() + { + owner = secondPlayer, + creationDate = DateTime.Now.ToOADate() + }); + fullPlayers.RemoveAt(0); break; }