Coverage for functions \ flipdare \ message \ vote_message.py: 78%

23 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-05-08 12:22 +1000

1# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved. 

2# 

3# This file is part of Flipdare's proprietary software and contains 

4# confidential and copyrighted material. Unauthorised copying, 

5# modification, distribution, or use of this file is strictly 

6# prohibited without prior written permission from Flipdare Pty Ltd. 

7# 

8# This software includes third-party components licensed under MIT, 

9# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details. 

10# 

11 

12from flipdare.generated.shared.model.dare.ballot_result import BallotResult 

13 

14 

15class VoteMessage: 

16 STARTED = "has been locked in! Time to vote!" 

17 VOTE_ACCEPTED = "got a big 'W' and good vibes all around!" 

18 VOTE_REJECTED = "got a 'L' but don't worry, there's always next time!" 

19 VOTE_TIE = "glitched the matrix, better luck next time!" 

20 REMINDER = "is ping'ing! time to put up!" 

21 EXPIRED = "didn't get any buzz.. better luck next time!" 

22 

23 @staticmethod 

24 def from_result(result: BallotResult | None = None) -> str: 

25 if result is None: 

26 return VoteMessage.STARTED 

27 

28 match result: 

29 case BallotResult.ACCEPTED | BallotResult.AUTO_ACCEPTED: 

30 return VoteMessage.VOTE_ACCEPTED 

31 case BallotResult.TIE: 

32 return VoteMessage.VOTE_TIE 

33 case BallotResult.REJECTED | BallotResult.AUTO_REJECTED: 

34 return VoteMessage.VOTE_REJECTED 

35 case BallotResult.NOT_ENOUGH_VOTES: 

36 return VoteMessage.REMINDER 

37 case BallotResult.EXPIRED: 

38 return VoteMessage.EXPIRED