satellite/satellitedb: fix nil value from offers table (#2587)

* fix nil value

* Oops
This commit is contained in:
Yingrong Zhao 2019-07-18 13:26:04 -04:00 committed by GitHub
parent 2e3ad0ce2a
commit 3e9f90b7ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,9 +70,15 @@ func (db *offersDB) GetCurrentByType(ctx context.Context, offerType rewards.Offe
}
o.AwardCredit = currency.Cents(awardCreditInCents)
o.InviteeCredit = currency.Cents(inviteeCreditInCents)
o.RedeemableCap = int(redeemableCap.Int64)
o.AwardCreditDurationDays = int(awardCreditDurationDays.Int64)
o.InviteeCreditDurationDays = int(inviteeCreditDurationDays.Int64)
if redeemableCap.Valid {
o.RedeemableCap = int(redeemableCap.Int64)
}
if awardCreditDurationDays.Valid {
o.AwardCreditDurationDays = int(awardCreditDurationDays.Int64)
}
if inviteeCreditDurationDays.Valid {
o.InviteeCreditDurationDays = int(inviteeCreditDurationDays.Int64)
}
return &o, nil
}