From e1216590e8542ce53ceb7b1c0391572b7151a270 Mon Sep 17 00:00:00 2001 From: Dmitry Pokidov Date: Tue, 31 Oct 2023 21:43:07 +1100 Subject: [PATCH] Added ticket id and ticket last name to voting --- DDD.Core/EloVoting/EloVote.cs | 6 +++++- DDD.Functions/EloVotingSubmitPair.cs | 4 +++- DDD.Functions/local.settings.json | 4 ++-- README.md | 10 ++++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/DDD.Core/EloVoting/EloVote.cs b/DDD.Core/EloVoting/EloVote.cs index 24a1ec1..dc07dce 100644 --- a/DDD.Core/EloVoting/EloVote.cs +++ b/DDD.Core/EloVoting/EloVote.cs @@ -5,7 +5,7 @@ public class EloVote : TableEntity { public EloVote() { } - public EloVote(string conferenceInstance, string voteId, string winnerSessionId, string loserSessionId, bool isDraw, string ipAddress, string voterSessionId) + public EloVote(string conferenceInstance, string voteId, string winnerSessionId, string loserSessionId, bool isDraw, string ipAddress, string voterSessionId, string voterTicket, string voterLastname) { PartitionKey = conferenceInstance; RowKey = voteId; @@ -14,6 +14,8 @@ public EloVote(string conferenceInstance, string voteId, string winnerSessionId, IsDraw = isDraw; IpAddress = ipAddress; VoterSessionId = voterSessionId; + VoterTicket = voterTicket; + VoterLastname = voterLastname; } public string WinnerSessionId { get; set; } @@ -21,6 +23,8 @@ public EloVote(string conferenceInstance, string voteId, string winnerSessionId, public bool IsDraw { get; set; } public string IpAddress { get; set; } public string VoterSessionId { get; set; } + public string VoterTicket { get; set; } + public string VoterLastname { get; set; } public string VoteId => RowKey; } } diff --git a/DDD.Functions/EloVotingSubmitPair.cs b/DDD.Functions/EloVotingSubmitPair.cs index fd42537..cb817fc 100644 --- a/DDD.Functions/EloVotingSubmitPair.cs +++ b/DDD.Functions/EloVotingSubmitPair.cs @@ -100,7 +100,7 @@ EloVotingConfig eloVoting // Save vote log.LogInformation("Successfully received elo vote with Id {winnerVoteId}; persisting...", winnerVoteId); - var eloVoteToPersist = new EloVote(conferenceYear, winnerVoteId, winnerSessionId, loserSessionId, vote.IsDraw, ip, vote.VoterSessionId); + var eloVoteToPersist = new EloVote(conferenceYear, winnerVoteId, winnerSessionId, loserSessionId, vote.IsDraw, ip, vote.VoterSessionId, vote.VoterTicket, vote.VoterLastname); await repo.CreateAsync(eloVoteToPersist); return new StatusCodeResult((int)HttpStatusCode.NoContent); @@ -112,5 +112,7 @@ public class EloVoteRequest public string LoserSessionId { get; set; } public bool IsDraw { get; set; } public string VoterSessionId { get; set; } + public string VoterTicket { get; set; } + public string VoterLastname { get; set; } } } diff --git a/DDD.Functions/local.settings.json b/DDD.Functions/local.settings.json index 22eea47..79c3eb0 100644 --- a/DDD.Functions/local.settings.json +++ b/DDD.Functions/local.settings.json @@ -46,7 +46,7 @@ "VotesConnectionString": "UseDevelopmentStorage=true", "VotingTable": "Votes", "VotingAvailableFrom": "2022-01-05T08:00:00+08:00", - "VotingAvailableTo": "2022-12-14T23:59:59+08:00", + "VotingAvailableTo": "2024-12-14T23:59:59+08:00", "TicketNumberWhileVoting": "Required", "WaitingListCanVoteWithEmail": "true", "MinVotes": "6", @@ -57,7 +57,7 @@ "EloPasswordPhrase":"Perth2022", "EloEnabled": "true", "EloAllowedTimeInSecondsToSubmit": "120", - "UserVotingSessionsConnectionString": "", + "UserVotingSessionsConnectionString": "AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;", "UserVotingSessionsDatabaseId": "dddperthdatatest", "UserVotingSessionsContainerId": "votesessions", "UserVotingSessionsCookieName": "DDDPerth.2022.UserSession", diff --git a/README.md b/README.md index 851e710..d261bbf 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,21 @@ This project contains backend functionality to run the DDD conferences, includin azurite -s -l /home/dimka/temp/azurite/ -d /home/dimka/temp/azurite/debug.log ``` +[Install CosmosDB emulator](https://learn.microsoft.com/en-us/azure/cosmos-db/emulator) + ### Commands Once: `npm install -g azurite` * `azurite -s -l /home/dimka/temp/azurite/ -d /home/dimka/temp/azurite/debug.log` +* ``` +docker run \ + --publish 8081:8081 \ + --publish 10250-10255:10250-10255 \ + --interactive \ + --tty \ + mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest +``` * `cd DDD.Functions && func host start --build --debug --verbose` ## Structure