Skip to content

Commit

Permalink
fix: when country prefix is undefined don't crash reports
Browse files Browse the repository at this point in the history
  • Loading branch information
kaladivo committed Oct 18, 2024
1 parent a6c147d commit 8ddc9e6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/offer-service/src/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const reportTotalBuyOffersExpired = ({
)

const OffersStatsQueryResult = Schema.Struct({
countryPrefix: Schema.optional(CountryPrefixE),
countryPrefix: Schema.Union(CountryPrefixE, Schema.Null),
buy: Schema.Int,
sell: Schema.Int,
})
Expand Down Expand Up @@ -208,11 +208,11 @@ export const reportMetricsLayer = Layer.effectDiscard(
pipe(
Array.map(listOfCountries, (one) => [
reportTotalBuyOffers({
countryPrefix: one.countryPrefix,
countryPrefix: one.countryPrefix ?? undefined,
value: one.buy,
}),
reportTotalSellOffers({
countryPrefix: one.countryPrefix,
countryPrefix: one.countryPrefix ?? undefined,
value: one.sell,
}),
]),
Expand All @@ -228,11 +228,11 @@ export const reportMetricsLayer = Layer.effectDiscard(
pipe(
Array.map(listOfCountries, (one) => [
reportTotalBuyOffersExpired({
countryPrefix: one.countryPrefix,
countryPrefix: one.countryPrefix ?? undefined,
value: one.buy,
}),
reportTotalSellOffersExpired({
countryPrefix: one.countryPrefix,
countryPrefix: one.countryPrefix ?? undefined,
value: one.sell,
}),
]),
Expand Down

0 comments on commit 8ddc9e6

Please sign in to comment.