Fix issues with newly created estimation

This commit is contained in:
Pijus Kamandulis 2024-10-11 20:47:24 +03:00
parent 8fa5493890
commit 9b45d372fa
1 changed files with 10 additions and 6 deletions

View File

@ -36,13 +36,17 @@ const mapEstimationSession = (
data: DatabaseModels.EstimationSession,
{ userId }: { userId?: string },
) => {
const sessionState = JSON.parse(
data.sessionState,
) as EntityModels.SessionState;
const sessionState: EntityModels.SessionState = data.sessionState
? JSON.parse(data.sessionState)
: {
votes: [],
};
const tickets = data.tickets.map<EntityModels.EstimationSessionTicket>(
(ticket) => JSON.parse(ticket),
);
const tickets = data.tickets
? data.tickets.map<EntityModels.EstimationSessionTicket>((ticket) =>
JSON.parse(ticket),
)
: [];
const result: EntityModels.EstimationSession = {
id: data.$id,