Skip to content

Commit 36f43b5

Browse files
committed
add line ups available boolean field
1 parent ce0afc2 commit 36f43b5

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

api-models/src/main/scala/com/gu/mobile.notifications.client/models/Payloads.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ object FootballMatchStatusPayload {
192192
"matchStatus" -> o.matchStatus,
193193
"eventId" -> o.eventId,
194194
"kickOffTimestamp" -> o.kickOffTimestamp,
195+
"lineupsAvailable" -> o.lineupsAvailable,
195196
"debug" -> o.debug
196197
)
197198
}
@@ -223,6 +224,7 @@ case class FootballMatchStatusPayload(
223224
matchStatus: String,
224225
eventId: String,
225226
kickOffTimestamp: Option[Long] = None,
227+
lineupsAvailable: Option[Boolean] = None,
226228
debug: Boolean,
227229
dryRun: Option[Boolean]
228230
) extends NotificationPayload with derivedId {

football/src/main/scala/com/gu/mobile/notifications/football/notificationbuilders/MatchStatusNotificationBuilder.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class MatchStatusNotificationBuilder(mapiHost: String) {
6969
matchStatus = status,
7070
eventId = UUID.nameUUIDFromBytes(triggeringEvent.eventId.getBytes).toString,
7171
kickOffTimestamp = Some(matchInfo.date.toEpochSecond),
72+
lineupsAvailable = Some(matchInfo.lineupsAvailable),
7273
debug = false,
7374
dryRun = None
7475
)

football/src/test/scala/com/gu/mobile/notifications/football/notificationbuilders/MatchStatusNotificationBuilderSpec.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,23 @@ class MatchStatusNotificationBuilderSpec extends Specification {
4848
eventId = UUID.nameUUIDFromBytes("".getBytes).toString,
4949
matchStatus = "1st",
5050
kickOffTimestamp = Some(ZonedDateTime.parse("2000-01-01T00:00:00Z").toEpochSecond),
51+
lineupsAvailable = Some(false),
5152
debug = false,
5253
dryRun = None
5354
)
5455
}
5556

57+
"Include lineupsAvailable from matchInfo when false" in new MatchEventsContext {
58+
val notification = builder.build(baseGoal, matchInfo, List.empty, None)
59+
notification.lineupsAvailable shouldEqual Some(false)
60+
}
61+
62+
"Include lineupsAvailable from matchInfo when true" in new MatchEventsContext {
63+
val matchInfoWithLineups = matchInfo.copy(lineupsAvailable = true)
64+
val notification = builder.build(baseGoal, matchInfoWithLineups, List.empty, None)
65+
notification.lineupsAvailable shouldEqual Some(true)
66+
}
67+
5668
"Build a red card notification" in new WorldCupContext {
5769
val dismissal = dismissals.head
5870
val previousEvents = allEvents.takeWhile(_ != dismissal)

0 commit comments

Comments
 (0)