Skip to content

Commit

Permalink
Added ticket id and ticket last name to voting
Browse files Browse the repository at this point in the history
  • Loading branch information
dooman87 committed Oct 31, 2023
1 parent cb3b7fb commit e121659
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion DDD.Core/EloVoting/EloVote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -14,13 +14,17 @@ public EloVote(string conferenceInstance, string voteId, string winnerSessionId,
IsDraw = isDraw;
IpAddress = ipAddress;
VoterSessionId = voterSessionId;
VoterTicket = voterTicket;
VoterLastname = voterLastname;
}

public string WinnerSessionId { get; set; }
public string LoserSessionId { get; set; }
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;
}
}
4 changes: 3 additions & 1 deletion DDD.Functions/EloVotingSubmitPair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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; }
}
}
4 changes: 2 additions & 2 deletions DDD.Functions/local.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e121659

Please sign in to comment.