fix bug that caused duplicate event lineup entries

This commit is contained in:
2022-08-05 12:59:58 -05:00
parent 9fbcfa622b
commit c79aff9b4f
3 changed files with 29 additions and 10 deletions

View File

@@ -25,6 +25,7 @@ def edit_lineup(request, event_ids, team_id):
EventLineupEntry,
Member,
)
from teamsnap.forms import LineupEntryFormset
client = get_teamsnap_client(request)
@@ -199,11 +200,11 @@ def edit_lineup(request, event_ids, team_id):
def submit_lineup(request, team_id, event_id):
from pyteamsnap.objects import Event, EventLineup, EventLineupEntry
from pyteamsnap.objects import EventLineup, EventLineupEntry
from teamsnap.forms import LineupEntryFormset
client = get_teamsnap_client(request)
ts_event = Event.get(client, event_id)
ts_lineup = EventLineup.search(client, event_id=event_id)
event_lineup_id = ts_lineup[0].data["id"]
if request.GET:
@@ -247,7 +248,8 @@ def submit_lineup(request, team_id, event_id):
pass
else:
pass
return JsonResponse(ts_event.data)
ts_event_lineup_entries = EventLineupEntry.search(client, event_id=event_id)
return JsonResponse([lue.data for lue in ts_event_lineup_entries], safe=False)
return HttpResponseServerError
@@ -258,7 +260,6 @@ def multi_lineup_choose(request, team_id=None):
team_id=request.user.teamsnap_preferences.managed_team_id,
)
from django.forms import formset_factory
from pyteamsnap.objects import Event
from .forms import EventChooseForm