Commit 592e2cdd authored by Frederik Wegner's avatar Frederik Wegner

checked corrected all userage of duel.CurrentRound of correct interpretation.

parent 1f982639
Pipeline #843 failed with stage
in 2 minutes and 32 seconds
......@@ -386,7 +386,7 @@ func (m *MySQLDuelQuery) GetAllDuels(userID uint32) ([]schemas.DuelSchema, error
if valid := nullRound.ToRound(&round); valid {
// Check if round is current round
if round.ID == duels[len(duels)-1].CurrentRound {
if round.Number == duels[len(duels)-1].CurrentRound {
// Check if round has been answered
pendingQuestions, errpending := m.pendingQuestions(db, round.ID, userID)
if errpending != nil {
......@@ -507,7 +507,7 @@ func (m *MySQLDuelQuery) getDuel(db dbhandler.DBAccess, id, userID uint32) (*sch
// Check if round is current round
// this has to be done after the check for containsParticipant, as pendingQuestion does not check that
for _, r := range duel.Rounds {
if r.ID == duel.CurrentRound {
if r.Number == duel.CurrentRound {
pendingQuestions, errpending := m.pendingQuestions(db, r.ID, userID)
if errpending != nil {
return nil, fmt.Errorf("Could not check for pending questions. %s", errpending.Error())
......
......@@ -100,7 +100,7 @@ func (d *DuelSchema) AddRound(round InfoRoundSchema) {
func (d *DuelSchema) GetCurrentRound() *InfoRoundSchema {
if d.CurrentRound > 0 {
for i, r := range d.Rounds {
if r.ID == d.CurrentRound {
if r.Number == d.CurrentRound {
return &d.Rounds[i]
}
}
......
......@@ -129,14 +129,16 @@ func (m *mockDuel) SetPool(duelID, poolID, userID uint32) (*schemas.DuelSchema,
number = r.Number + 1
}
d.AddRound(schemas.InfoRoundSchema{
newRound := schemas.InfoRoundSchema{
ID: m.nextRoundID,
Number: number,
Pool: *p,
UserStarted: getMockUserInfo(mockUsers[userID]),
})
}
d.AddRound(newRound)
d.CurrentRound = m.nextRoundID
d.CurrentRound = newRound.Number
m.nextRoundID++
return d, nil
......@@ -216,7 +218,7 @@ func newMockDuel() mockDuel {
Score: 25,
},
},
CurrentRound: 4,
CurrentRound: 2,
MaxRounds: 10,
Rounds: []schemas.InfoRoundSchema{
schemas.InfoRoundSchema{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment