Skip to content

[BUG] Add from CSV/XML does a bad search #33

@retched

Description

@retched

When importing in a CSV file, the code is supposed to update the status under certain conditions:

  • If a player AND TeamID match:
    • Then Update the Status of the necessary Team
  • If a player is found, but the TeamID does not match
    • Update the Status AND the TeamID of the matching ID
  • If a player's nickname is found but the name is GUEST99999:
    • Update the TeamID AND Membership ID
  • If the nickname AND player number are not found, but the TeamID some how matches..
    • Ask, should they match?

For Each player In lstFileData
Dim index As Integer = lstTournTeams.IndexOf(lstTournTeams.Find(Function(p) p.PlayerA.MembershipNumber = player.PlayerA.MembershipNumber And p.TeamID = player.TeamID And p.PlayerA.MembershipNumber <> "GUEST99999"))
Dim altIndex As Integer = lstTournTeams.IndexOf(lstTournTeams.Find(Function(p) p.PlayerA.MembershipNumber = player.PlayerA.MembershipNumber And p.TeamID = player.TeamID And p.PlayerA.MembershipNumber <> "GUEST99999"))
Dim teamIDSearch As Integer = lstTournTeams.IndexOf(lstTournTeams.Find(Function(p) p.TeamID = player.TeamID And p.TeamID <> "0"))
If index <> -1 Then
If lstTournTeams(index).Status < player.Status Then
lstTournTeams(index).Status = player.Status
lstTournTeams(index).TeamID = player.TeamID
End If
ElseIf altIndex <> -1 And (player.PlayerA.MembershipNumber <> "GUEST99999" Or player.PlayerA.MembershipNumber <> "0000000986") Then
lstTournTeams(altIndex).TeamID = player.TeamID
lstTournTeams(altIndex).Status = player.Status
Else
lstTournTeams.Add(player)
End If
Next

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions