Skip to content

Refactor function to render multiple ticket text, fix multiple types#104

Open
tomrndom wants to merge 3 commits intomainfrom
hotfix/ticket-owned-improvements
Open

Refactor function to render multiple ticket text, fix multiple types#104
tomrndom wants to merge 3 commits intomainfrom
hotfix/ticket-owned-improvements

Conversation

@tomrndom
Copy link
Contributor

@tomrndom tomrndom commented Jul 3, 2024

@tomrndom tomrndom requested a review from smarcet July 3, 2024 21:02
return `
${acc}${acc ? `${index+1===ownedTickets.length? ' and ' : ', '}` : ''}
${ownedTicket.qty} ${ownedTicket.type_name}${index === 0 ? !ownedTicket.type_name.toLowerCase().endsWith('ticket') ? ' ticket' : '' : ownedTicket.type_name.toLowerCase().endsWith('ticket') ? '' : ''}${ownedTicket.qty > 1 ? 's' : ''}`;
const lastTicket = index + 1 === ownedTickets.length;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could u extract this logic to a helper method and create the proper unit tests ?

Copy link
Collaborator

@smarcet smarcet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomrndom please review comments

Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
@tomrndom tomrndom force-pushed the hotfix/ticket-owned-improvements branch from 8ceb3c1 to b07abde Compare November 4, 2024 20:43
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants