def mockery(iter,pock,lamb,teams,players): while(int(fundefs.getTeam(iter)) is not int(pock)): team = int(fundefs.getTeam(iter)) autoplayer = playerdefs.autoPick(0,lamb,players,teams[team-1]) teams[team-1].append(autoplayer) autoplayer.setPicked(iter) players.remove(autoplayer) iter+=1 rets = {'players':players,'team':teams,'iter':iter} return rets
def draft(): pock = int(session['pock']) username = session['user'] iter = int(request.form["iter"]) chosen = int(request.form["chosen"]) tList = request.form["teams"] pList = request.form["players"] teamList = playerdefs.tLister(tList) players = playerdefs.pLister(pList) mypick = fundefs.returnPlayer(chosen,players) players.remove(mypick) mypick.setPicked(iter) teamList[fundefs.getTeam(iter)-1].append(mypick) iter+=1 if int(pock) == int(iter): tteam = teamList players = playerdefs.setDustyValues(username,pock,players,tteam[pock-1]) tplayers = sorted(players,key=playerdefs.getKeyD) else: tteam = teamList players = playerdefs.setDustyValues(username,pock,players,tteam[pock-1]) tplayers = sorted(players,key=playerdefs.getKeyMC) round = int(iter-1)/10 + 1 players=[e.serialize() for e in tplayers] team = [] for lop in tteam: team.append([e.serialize() for e in lop]) return jsonify(iter=iter,round=round,team=team,players=players)
def mock(): pock = int(session['pock']) lamb = int(session['lamb']) username = session['user'] iter = int(request.form["iter"]) chosen = int(request.form["chosen"]) tList = request.form["teams"] pList = request.form["players"] teamList = playerdefs.tLister(tList) players = playerdefs.pLister(pList) mypick = fundefs.returnPlayer(chosen,players) players.remove(mypick) mypick.setPicked(iter) teamList[fundefs.getTeam(iter)-1].append(mypick) iter+=1 pRem = mockery(iter,pock,lamb,teamList,players) tteam = pRem['team'] tplayers = pRem['players'] iter = pRem['iter'] players = playerdefs.setDustyValues(username,pock,tplayers,tteam[pock-1]) tplayers = sorted(players,key=playerdefs.getKeyD) round = int(iter-1)/10 + 1 players=[e.serialize() for e in tplayers] team = [] for lop in tteam: team.append([e.serialize() for e in lop]) return jsonify(iter=iter,round=round,team=team,players=players)