Add bet total participants and stakes
continuous-integration/drone/push Build is passing Details

pull/5/head
avalin 8 months ago
parent 866bc358ba
commit c4525ad97e

@ -36,6 +36,7 @@ fun BetScreenCard(
date: String,
time: String,
players: List<User>,
totalParticipants: Int,
onClickParticipate: () -> Unit,
onClickCard: () -> Unit,
modifier: Modifier = Modifier,
@ -80,8 +81,8 @@ fun BetScreenCard(
Text(
text = pluralStringResource(
id = R.plurals.bet_players_waiting_format,
players.size,
players.size
totalParticipants,
totalParticipants
),
style = AllInTheme.typography.sm2,
color = AllInTheme.colors.onBackground2
@ -108,6 +109,7 @@ private fun BetScreenCardPreview() {
title = "Emre va réussir son TP de CI/CD mercredi?",
date = "12 Sept.",
time = "13:00",
totalParticipants = 25,
players = listOf(
User(id = "", username = "Lucas D", email = "", coins = 0),
),
@ -128,6 +130,7 @@ private fun BetScreenCardNoPlayersPreview() {
title = "Emre va réussir son TP de CI/CD mercredi?",
date = "12 Sept.",
time = "13:00",
totalParticipants = 25,
players = emptyList(),
onClickParticipate = {},
onClickCard = {}
@ -146,10 +149,11 @@ private fun BetScreenCardDisabledPreview() {
title = "Emre va réussir son TP de CI/CD mercredi?",
date = "12 Sept.",
time = "13:00",
totalParticipants = 25,
players = emptyList(),
onClickParticipate = {},
onClickCard = {},
enabled = false
enabled = false,
)
}
}

@ -76,9 +76,8 @@ fun BetScreenLoadedContent(
item {
Box(Modifier.fillMaxWidth()) {
BetScreenPopularCard(
nbPlayers = 12, // Todo : Players
points = 2.35f, // Todo : Points
pointUnit = "k",
nbPlayers = it.totalParticipants,
points = it.totalStakes,
title = it.phrase,
onClick = { selectBet(it, false) },
enabled = !isRefreshing,
@ -137,6 +136,7 @@ fun BetScreenLoadedContent(
date = it.endRegisterDate.formatToMediumDateNoYear(),
time = it.endRegisterDate.formatToTime(),
players = emptyList(), // TODO : Players
totalParticipants = it.totalParticipants,
onClickParticipate = { selectBet(it, true) },
onClickCard = { selectBet(it, false) },
enabled = !isRefreshing,
@ -153,17 +153,19 @@ fun BetScreenLoadedContent(
Spacer(modifier = Modifier.height(24.dp))
}
}
}
if (bets.isEmpty()) {
AllInEmptyView(
text = stringResource(id = R.string.bet_empty_text),
subtext = null,
image = painterResource(id = R.drawable.video_game),
modifier = Modifier
.fillMaxWidth()
.align(Alignment.Center)
)
if (bets.isEmpty()) {
item {
AllInEmptyView(
text = stringResource(id = R.string.bet_empty_text),
subtext = null,
image = painterResource(id = R.drawable.video_game),
modifier = Modifier
.fillMaxWidth()
.fillParentMaxHeight(.5f)
)
}
}
}
PullRefreshIndicator(
@ -187,7 +189,9 @@ private fun BetScreenLoadedContentPreview() {
endRegisterDate = ZonedDateTime.now(),
endBetDate = ZonedDateTime.now(),
isPublic = false,
betStatus = BetStatus.IN_PROGRESS
betStatus = BetStatus.IN_PROGRESS,
totalParticipants = 200,
totalStakes = 2500
),
filters = emptyList(),
bets = emptyList(),

@ -1,5 +1,6 @@
package fr.iut.alldev.allin.ui.bet.components
import android.icu.text.CompactDecimalFormat
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@ -11,9 +12,11 @@ import androidx.compose.foundation.layout.width
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
@ -22,24 +25,29 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.os.ConfigurationCompat
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.ext.shadow
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInBouncyCard
import fr.iut.alldev.allin.ui.core.HighlightedText
import kotlin.math.ceil
@Composable
fun BetScreenPopularCard(
nbPlayers: Int,
points: Float,
pointUnit: String,
points: Int,
title: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true
) {
val configuration = LocalConfiguration.current
val numberFormat = remember(configuration) {
val locale = ConfigurationCompat.getLocales(configuration).get(0) ?: java.util.Locale.getDefault()
CompactDecimalFormat.getInstance(locale, CompactDecimalFormat.CompactStyle.SHORT)
}
AllInBouncyCard(
modifier = modifier
.let {
@ -114,15 +122,11 @@ fun BetScreenPopularCard(
style = AllInTheme.typography.p1,
fontSize = 15.sp
)
val pointsText = if (points % 1 == 0f) {
stringResource(id = R.string.int_and_unit, points.toInt(), pointUnit)
} else {
stringResource(id = R.string.float_and_unit, points, pointUnit)
}
val pointsText = numberFormat.format(points)
HighlightedText(
text = pluralStringResource(
id = R.plurals.bet_points_at_stake_format,
if (pointUnit.isEmpty()) ceil(points).toInt() else 2,
points,
pointsText
),
query = pointsText,
@ -145,8 +149,7 @@ private fun BetScreenPopularCardPreview() {
AllInTheme {
BetScreenPopularCard(
nbPlayers = 12,
points = 2.35f,
pointUnit = "k",
points = 2350,
title = "Emre va réussir son TP de CI/CD mercredi?",
onClick = {}
)
@ -159,8 +162,7 @@ private fun BetScreenPopularCardSingularPreview() {
AllInTheme {
BetScreenPopularCard(
nbPlayers = 1,
points = 1.0f,
pointUnit = "",
points = 150,
title = "Emre va réussir son TP de CI/CD mercredi?",
onClick = {}
)

@ -44,11 +44,11 @@ import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.data.ext.formatToMediumDateNoYear
import fr.iut.alldev.allin.data.ext.formatToTime
import fr.iut.alldev.allin.data.model.bet.BetStatus
import fr.iut.alldev.allin.data.model.bet.BinaryBet
import fr.iut.alldev.allin.data.model.bet.CustomBet
import fr.iut.alldev.allin.data.model.bet.MatchBet
import fr.iut.alldev.allin.data.model.bet.NO_VALUE
import fr.iut.alldev.allin.data.model.bet.YES_VALUE
import fr.iut.alldev.allin.data.model.bet.BinaryBet
import fr.iut.alldev.allin.data.model.bet.vo.BetAnswerDetail
import fr.iut.alldev.allin.data.model.bet.vo.BetDetail
import fr.iut.alldev.allin.ext.formatToSimple
@ -303,7 +303,9 @@ private fun BetConfirmationBottomSheetContentPreview() {
endBetDate = ZonedDateTime.now(),
isPublic = true,
betStatus = BetStatus.FINISHED,
creator = "creator"
creator = "creator",
totalStakes = 0,
totalParticipants = 0
),
answers = listOf(
BetAnswerDetail(

@ -142,6 +142,8 @@ private fun BetResultBottomSheetContentPreview() {
isPublic = true,
betStatus = BetStatus.IN_PROGRESS,
creator = "creator",
totalStakes = 0,
totalParticipants = 0
),
stake = 4175,
winnings = 2600,

@ -1,6 +1,5 @@
package fr.iut.alldev.allin.ui.betStatus.components
import android.content.res.Configuration
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@ -21,11 +20,11 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.os.ConfigurationCompat
import fr.iut.alldev.allin.data.model.bet.Bet
import fr.iut.alldev.allin.data.model.bet.BinaryBet
import fr.iut.alldev.allin.data.model.bet.CustomBet
import fr.iut.alldev.allin.data.model.bet.MatchBet
import fr.iut.alldev.allin.data.model.bet.NO_VALUE
import fr.iut.alldev.allin.data.model.bet.YES_VALUE
import fr.iut.alldev.allin.data.model.bet.BinaryBet
import fr.iut.alldev.allin.data.model.bet.vo.BetDetail
import fr.iut.alldev.allin.ext.formatToSimple
import fr.iut.alldev.allin.theme.AllInColorToken
@ -152,7 +151,6 @@ fun Bet.getAnswerFromParticipationIdx(idx: Int) =
}
@Preview
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun ParticipationAnswersPreview(
@PreviewParameter(BetDetailPreviewProvider::class) bet: BetDetail,

@ -22,10 +22,10 @@ fun HighlightedText(
text: String,
query: String,
highlightStyle: SpanStyle,
modifier: Modifier = Modifier,
fontSize: TextUnit = TextUnit.Unspecified,
fontStyle: FontStyle? = null,
fontWeight: FontWeight? = null,
modifier: Modifier = Modifier,
color: Color = Color.Unspecified,
textAlign: TextAlign? = null,
style: TextStyle = LocalTextStyle.current

@ -69,7 +69,13 @@ fun FriendsScreenContent(
}
}
},
SectionElement(stringResource(id = R.string.friends_requests_tab)) {
SectionElement(
stringResource(
id = R.string.friends_requests_tab,
(requestsTabState as? FriendsScreenViewModel.RequestsTabState.Loaded)
?.users?.size ?: 0
)
) {
when (requestsTabState) {
is FriendsScreenViewModel.RequestsTabState.Loaded -> {

@ -2,6 +2,7 @@ package fr.iut.alldev.allin.ui.friends.tabs
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
@ -12,12 +13,14 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Search
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.rememberVectorPainter
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.data.model.FriendStatus
@ -35,48 +38,59 @@ fun FriendsScreenAddTab(
onToggleDeleteFriend: (User) -> Unit,
setSearch: (String) -> Unit,
) {
LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding = WindowInsets.navigationBars.asPaddingValues(start = 24.dp, end = 24.dp, top = 18.dp),
verticalArrangement = Arrangement.spacedBy(11.dp),
) {
stickyHeader {
AllInTextField(
value = search,
onValueChange = setSearch,
leadingIcon = rememberVectorPainter(image = Icons.Default.Search),
modifier = Modifier
.background(
Brush.verticalGradient(
0.5f to AllInTheme.colors.mainSurface,
1f to Color.Transparent
Box {
LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding = WindowInsets.navigationBars.asPaddingValues(start = 24.dp, end = 24.dp, top = 18.dp),
verticalArrangement = Arrangement.spacedBy(11.dp),
) {
stickyHeader {
AllInTextField(
value = search,
onValueChange = setSearch,
leadingIcon = rememberVectorPainter(image = Icons.Default.Search),
modifier = Modifier
.background(
Brush.verticalGradient(
0.5f to AllInTheme.colors.mainSurface,
1f to Color.Transparent
)
)
)
.fillMaxWidth()
.padding(vertical = 8.dp)
)
}
.fillMaxWidth()
.padding(vertical = 8.dp)
)
}
items(friends) {
FriendsScreenLine(
username = it.username,
status = it.friendStatus ?: FriendStatus.NOT_FRIEND,
toggleIsFriend = { onToggleDeleteFriend(it) }
)
items(friends) {
FriendsScreenLine(
username = it.username,
status = it.friendStatus ?: FriendStatus.NOT_FRIEND,
toggleIsFriend = { onToggleDeleteFriend(it) }
)
}
}
if (friends.isEmpty() && search.isBlank()) {
item {
AllInEmptyView(
text = stringResource(id = R.string.friends_empty_text),
subtext = stringResource(id = R.string.friends_empty_subtext),
image = painterResource(id = R.drawable.silhouettes),
modifier = Modifier
.fillMaxWidth()
.padding(top = 24.dp)
)
}
AllInEmptyView(
text = stringResource(id = R.string.friends_empty_text),
subtext = stringResource(id = R.string.friends_empty_subtext),
image = painterResource(id = R.drawable.silhouettes),
modifier = Modifier.align(Alignment.Center)
)
}
}
}
@Preview
@Composable
private fun FriendsScreenAddTabPreview() {
AllInTheme {
FriendsScreenAddTab(
friends = emptyList(),
search = "",
onToggleDeleteFriend = { },
setSearch = { }
)
}
}

@ -1,16 +1,24 @@
package fr.iut.alldev.allin.ui.friends.tabs
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.data.model.User
import fr.iut.alldev.allin.ext.asPaddingValues
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.bet.AllInEmptyView
import fr.iut.alldev.allin.ui.friends.components.FriendsScreenRequestLine
@Composable
@ -19,18 +27,40 @@ fun FriendsScreenRequestsTab(
acceptRequest: (User) -> Unit,
declineRequest: (User) -> Unit
) {
LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding = WindowInsets.navigationBars.asPaddingValues(start = 24.dp, end = 24.dp, top = 18.dp),
verticalArrangement = Arrangement.spacedBy(11.dp),
) {
items(requests) {
FriendsScreenRequestLine(
username = it.username,
accept = { acceptRequest(it) },
decline = { declineRequest(it) }
Box {
LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding = WindowInsets.navigationBars.asPaddingValues(start = 24.dp, end = 24.dp, top = 18.dp),
verticalArrangement = Arrangement.spacedBy(11.dp),
) {
items(requests) {
FriendsScreenRequestLine(
username = it.username,
accept = { acceptRequest(it) },
decline = { declineRequest(it) }
)
}
}
if (requests.isEmpty()) {
AllInEmptyView(
text = stringResource(id = R.string.friends_requests_empty_text),
subtext = null,
image = painterResource(id = R.drawable.mailbox),
modifier = Modifier.align(Alignment.Center)
)
}
}
}
@Preview
@Composable
private fun FriendsScreenRequestsTabPreview() {
AllInTheme {
FriendsScreenRequestsTab(
requests = emptyList(),
acceptRequest = { },
declineRequest = { }
)
}
}

@ -3,9 +3,9 @@ package fr.iut.alldev.allin.ui.preview
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import fr.iut.alldev.allin.data.model.bet.Bet
import fr.iut.alldev.allin.data.model.bet.BetStatus
import fr.iut.alldev.allin.data.model.bet.BinaryBet
import fr.iut.alldev.allin.data.model.bet.CustomBet
import fr.iut.alldev.allin.data.model.bet.MatchBet
import fr.iut.alldev.allin.data.model.bet.BinaryBet
import java.time.ZonedDateTime
class BetPreviewProvider : PreviewParameterProvider<Bet> {
@ -18,7 +18,9 @@ class BetPreviewProvider : PreviewParameterProvider<Bet> {
endBetDate = ZonedDateTime.now(),
isPublic = true,
betStatus = BetStatus.FINISHED,
creator = "creator"
creator = "creator",
totalStakes = 0,
totalParticipants = 0
),
MatchBet(
id = "2",
@ -30,7 +32,9 @@ class BetPreviewProvider : PreviewParameterProvider<Bet> {
betStatus = BetStatus.FINISHED,
creator = "creator",
nameTeam1 = "The Monarchs",
nameTeam2 = "Climate Change"
nameTeam2 = "Climate Change",
totalStakes = 0,
totalParticipants = 0
),
CustomBet(
id = "3",
@ -46,8 +50,9 @@ class BetPreviewProvider : PreviewParameterProvider<Bet> {
"Answer 2",
"Answer 3",
"Answer 4"
)
),
totalStakes = 0,
totalParticipants = 0
),
)
}

@ -3,9 +3,9 @@ package fr.iut.alldev.allin.ui.preview
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import fr.iut.alldev.allin.data.model.bet.Bet
import fr.iut.alldev.allin.data.model.bet.BetStatus
import fr.iut.alldev.allin.data.model.bet.BinaryBet
import fr.iut.alldev.allin.data.model.bet.CustomBet
import fr.iut.alldev.allin.data.model.bet.MatchBet
import fr.iut.alldev.allin.data.model.bet.BinaryBet
import java.time.ZonedDateTime
@ -20,7 +20,9 @@ class BetWithStatusPreviewProvider : PreviewParameterProvider<Bet> {
endBetDate = ZonedDateTime.now(),
isPublic = true,
betStatus = status,
creator = "creator"
creator = "creator",
totalStakes = 0,
totalParticipants = 0
),
MatchBet(
id = "2",
@ -32,7 +34,9 @@ class BetWithStatusPreviewProvider : PreviewParameterProvider<Bet> {
betStatus = status,
creator = "creator",
nameTeam1 = "The Monarchs",
nameTeam2 = "Climate Change"
nameTeam2 = "Climate Change",
totalStakes = 0,
totalParticipants = 0
),
CustomBet(
id = "3",
@ -48,8 +52,9 @@ class BetWithStatusPreviewProvider : PreviewParameterProvider<Bet> {
"Answer 2",
"Answer 3",
"Answer 4"
)
),
totalStakes = 0,
totalParticipants = 0
)
)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

@ -172,11 +172,12 @@
<string name="friends_title">Amis</string>
<string name="friends_request_sent">Requête envoyée</string>
<string name="friends_add_tab">Ajouter</string>
<string name="friends_requests_tab">Demandes</string>
<string name="friends_requests_tab">Demandes (%d)</string>
<string name="friends_requests_accept">Accepter</string>
<string name="friends_requests_decline">Refuser</string>
<string name="friends_empty_text">Vous n\'avez pas encore d\'amis</string>
<string name="friends_empty_subtext">Ajoutez des amis depuis cet écran</string>
<string name="friends_requests_empty_text">Aucunes demandes d\'amis en attentes</string>
<!--Daily reward-->
<string name="daily_reward_title">Récompense quotidienne</string>

@ -169,11 +169,12 @@
<string name="friends_title">Friends</string>
<string name="friends_request_sent">Request sent</string>
<string name="friends_add_tab">Add friends</string>
<string name="friends_requests_tab">Requests</string>
<string name="friends_requests_tab">Requests (%d)</string>
<string name="friends_requests_accept">Accept</string>
<string name="friends_requests_decline">Decline</string>
<string name="friends_empty_text">You don\'t have any friends yet</string>
<string name="friends_empty_subtext">Add new friends from this screen</string>
<string name="friends_requests_empty_text">No currently pending friend requests</string>
<!--Daily reward-->
<string name="daily_reward_title">Daily reward</string>

@ -7,11 +7,11 @@ import fr.iut.alldev.allin.data.model.bet.BetResult
import fr.iut.alldev.allin.data.model.bet.BetResultDetail
import fr.iut.alldev.allin.data.model.bet.BetStatus
import fr.iut.alldev.allin.data.model.bet.BetType
import fr.iut.alldev.allin.data.model.bet.BinaryBet
import fr.iut.alldev.allin.data.model.bet.CustomBet
import fr.iut.alldev.allin.data.model.bet.MatchBet
import fr.iut.alldev.allin.data.model.bet.NO_VALUE
import fr.iut.alldev.allin.data.model.bet.YES_VALUE
import fr.iut.alldev.allin.data.model.bet.BinaryBet
import fr.iut.alldev.allin.data.model.bet.vo.BetAnswerDetail
import fr.iut.alldev.allin.data.model.bet.vo.BetDetail
import fr.iut.alldev.allin.data.serialization.ZonedDateTimeSerializer
@ -30,7 +30,10 @@ data class ResponseBet(
@Serializable(ZonedDateTimeSerializer::class) var endBet: ZonedDateTime,
var isPrivate: Boolean,
var response: List<String>,
val createdBy: String
val createdBy: String,
var popularityscore: Int = 0,
val totalStakes: Int = 0,
val totalParticipants: Int = 0
) {
fun toBet(): Bet = when {
response.toSet() == setOf(YES_VALUE, NO_VALUE) -> {
@ -42,7 +45,9 @@ data class ResponseBet(
endBetDate = endBet,
isPublic = !isPrivate,
betStatus = status,
creator = createdBy
creator = createdBy,
totalStakes = totalStakes,
totalParticipants = totalParticipants
)
}
@ -57,7 +62,9 @@ data class ResponseBet(
betStatus = status,
creator = createdBy,
nameTeam1 = response.firstOrNull() ?: "",
nameTeam2 = response.lastOrNull() ?: ""
nameTeam2 = response.lastOrNull() ?: "",
totalStakes = totalStakes,
totalParticipants = totalParticipants
)
}
@ -71,7 +78,9 @@ data class ResponseBet(
isPublic = !isPrivate,
betStatus = status,
creator = createdBy,
possibleAnswers = response
possibleAnswers = response,
totalStakes = totalStakes,
totalParticipants = totalParticipants
)
}
}

@ -12,6 +12,8 @@ sealed class Bet(
open val endBetDate: ZonedDateTime,
open val isPublic: Boolean,
open val betStatus: BetStatus,
open val totalStakes: Int,
open val totalParticipants: Int
) {
abstract fun getBetType(): BetType
abstract fun getResponses(): List<String>

@ -15,9 +15,8 @@ class BetFactory {
isPublic: Boolean,
nameTeam1: String = "",
nameTeam2: String = "",
possibleAnswers: List<String> = emptyList(),
): Bet =
possibleAnswers: List<String> = emptyList()
): Bet =
when (betType) {
BetType.BINARY -> {
BinaryBet(
@ -28,7 +27,9 @@ class BetFactory {
endRegisterDate = endRegisterDate,
endBetDate = endBetDate,
isPublic = isPublic,
betStatus = BetStatus.WAITING
betStatus = BetStatus.WAITING,
totalStakes = 0,
totalParticipants = 0
)
}
@ -43,7 +44,9 @@ class BetFactory {
isPublic = isPublic,
betStatus = BetStatus.WAITING,
nameTeam1 = nameTeam1,
nameTeam2 = nameTeam2
nameTeam2 = nameTeam2,
totalStakes = 0,
totalParticipants = 0
)
}
@ -58,7 +61,9 @@ class BetFactory {
endBetDate = endBetDate,
isPublic = isPublic,
betStatus = BetStatus.WAITING,
possibleAnswers = possibleAnswers
possibleAnswers = possibleAnswers,
totalStakes = 0,
totalParticipants = 0
)
}
}

@ -13,7 +13,9 @@ data class BinaryBet(
override val endRegisterDate: ZonedDateTime,
override val endBetDate: ZonedDateTime,
override val isPublic: Boolean,
override val betStatus: BetStatus
override val betStatus: BetStatus,
override val totalStakes: Int,
override val totalParticipants: Int
) : Bet(
id,
creator,
@ -22,7 +24,9 @@ data class BinaryBet(
endRegisterDate,
endBetDate,
isPublic,
betStatus
betStatus,
totalStakes,
totalParticipants
) {
override fun getBetType() = BetType.BINARY
override fun getResponses(): List<String> = listOf(YES_VALUE, NO_VALUE)

@ -11,6 +11,8 @@ data class CustomBet(
override val endBetDate: ZonedDateTime,
override val isPublic: Boolean,
override val betStatus: BetStatus,
override val totalStakes: Int,
override val totalParticipants: Int,
val possibleAnswers: List<String>
) : Bet(
id,
@ -20,7 +22,9 @@ data class CustomBet(
endRegisterDate,
endBetDate,
isPublic,
betStatus
betStatus,
totalStakes,
totalParticipants
) {
override fun getBetType() = BetType.CUSTOM

@ -11,6 +11,8 @@ data class MatchBet(
override val endBetDate: ZonedDateTime,
override val isPublic: Boolean,
override val betStatus: BetStatus,
override val totalStakes: Int,
override val totalParticipants: Int,
val nameTeam1: String,
val nameTeam2: String
) : Bet(
@ -21,7 +23,9 @@ data class MatchBet(
endRegisterDate,
endBetDate,
isPublic,
betStatus
betStatus,
totalStakes,
totalParticipants
) {
override fun getBetType() = BetType.MATCH
override fun getResponses(): List<String> = listOf(nameTeam1, nameTeam2)

Loading…
Cancel
Save