Skip to content

Commit

Permalink
fix: hype-train-progress and hype-train-end events were generating in…
Browse files Browse the repository at this point in the history
…correct output
  • Loading branch information
greebowarrior committed Jul 22, 2021
1 parent 18e417a commit ad5943e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions internal/events/types/hype_train/hype_train_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (e Event) GenerateEvent(params events.MockEventParameters) (events.MockEven
lastType := util.RandomType()

//Local variables which will be used for the trigger params below
localLevel := util.RandomInt(5)
localTotal := util.RandomInt(10 * 100)
localGoal := util.RandomInt(10*100*100) + localTotal
localProgress := (localTotal / localGoal)
Expand Down Expand Up @@ -92,11 +93,20 @@ func (e Event) GenerateEvent(params events.MockEventParameters) (events.MockEven
UserLoginWhoMadeContribution: "cli_user2",
},
StartedAtTimestamp: util.GetTimestamp().Format(time.RFC3339Nano),
ExpiresAtTimestamp: util.GetTimestamp().Format(time.RFC3339Nano),
ExpiresAtTimestamp: util.GetTimestamp().Add(5 * time.Minute).Format(time.RFC3339Nano),
},
}
if triggerMapping[params.Transport][params.Trigger] == "hype-train-end " {
if triggerMapping[params.Transport][params.Trigger] == "channel.hype_train.progress" {
body.Event.Level = localLevel
}
if triggerMapping[params.Transport][params.Trigger] == "channel.hype_train.end" {
body.Event.CooldownEndsAtTimestamp = util.GetTimestamp().Add(1 * time.Hour).Format(time.RFC3339Nano)
body.Event.EndedAtTimestamp = util.GetTimestamp().Format(time.RFC3339Nano)
body.Event.ExpiresAtTimestamp = ""
body.Event.Goal = 0
body.Event.Level = localLevel
body.Event.Progress = 0
body.Event.StartedAtTimestamp = util.GetTimestamp().Add(5 * -time.Minute).Format(time.RFC3339Nano)
}
event, err = json.Marshal(body)
if err != nil {
Expand Down

0 comments on commit ad5943e

Please sign in to comment.