from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random import string import json import itertools class Constants(BaseConstants): name_in_url = 'election_v3' players_per_group = None num_rounds = 1 endowment = c(10) instructions_template = 'election_v3/Instruction.html' class Subsession(BaseSubsession): def creating_session(self): for player in self.get_players(): # ELECTION PARAMETERS # number of teams player.nteams = random.choice([3, 4, 5]) # election system player.system = random.choice(['RCV', 'PR', 'MJ']) # general vote results player.voteresult = random.choice(["BL", "SL", "SW", "BW"]) # payouts # if player.system == "RCV" and player.voteresult == 1: # player.payout = 2 # elif player.system == "RCV" and player.nteams == 3 and player.voteresult == 2: # player.payout = 1 # elif player.system == "RCV" and player.nteams == 4 and player.voteresult == 2: # player.payout = 1.33 # elif player.system == "RCV" and player.nteams == 4 and player.voteresult == 3: # player.payout = 0.66 # elif player.system == "RCV" and player.nteams == 5 and player.voteresult == 2: # player.payout = 1.5 # elif player.system == "RCV" and player.nteams == 5 and player.voteresult == 3: # player.payout = 1 # elif player.system == "RCV" and player.nteams == 5 and player.voteresult == 4: # player.payout = 0.5 # elif player.system == "RCV" and player.nteams == 5 and player.voteresult == 5: # player.payout = 0 # SYSTEM INFO TEXT for player in self.get_players(): if player.system =='MJT': player.systeminfo = 'The team that receives the most votes in the district ' \ 'will send all its three representatives to the Council. ' player.systeminfo2 = 'Because the team receiving the most votes in the ' \ 'district gets to send all its three representatives ' \ 'to the Council,' elif player.system == "PR": player.systeminfo = 'Based on how many votes each team receives in the ' \ 'district, the number of representatives each team elects ' \ 'to the Coucil will be decided.' player.systeminfo2 = 'Because each team gets to send a number of ' \ 'representatives proportional to the share of votes it ' \ 'receives in the district,' else: player.systeminfo = 'Based on the average ranking each team receives in the district,' \ 'the team rated the highest will send all of its representatives to the Council. ' player.systeminfo2 = 'Because the team with the highest average ranking in the district' \ 'gets to send all of its representatives to the Council,' #player.team = random.choice(['A', 'B']) player.faketeam = random.choice(['Red Team', 'Blue Team']) player.faketeam1 = random.choice(['Red Team', 'Blue Team']) player.faketeam2 = random.choice(['Red Team', 'Blue Team']) # player.digits = ''.join(random.sample(string.digits, 3)) player.chars = "R_" + ''.join(random.sample(string.ascii_uppercase + string.digits, k=7)) #player.composition = random.choice([30, 45, 55, 70]) #player.outcome = random.choice(['Won', 'Lost']) # player.decisionrule = random.choice(['all-equal', 'winner-take-all', 'proportional']) # player.system = random.choice(['majoritarian', 'proportional']) #player.voteresult = random.choice([20, 40, 60, 80]) # player.voteresult = random.choice([40, 60]) #player.teamreps = random.choice([6, 9, 12]) # player.councilresult = random.choice([40, 60]) # player.teamreps = random.choice([3, 6]) # player.teamreturn = random.choice([25, 45, 60, 85]) player.c1 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c2 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c2 == player.c1): player.c2 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c3 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c3 == player.c2 or player.c3 == player.c1): player.c3 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c4 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c4 == player.c3 or player.c4 == player.c2 or player.c4 == player.c1): player.c4 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c5 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c5 == player.c4 or player.c5 == player.c3 or player.c5 == player.c2 or player.c5 == player.c1): player.c5 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c6 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c6 == player.c5 or player.c6 == player.c4 or player.c6 == player.c3 or player.c6 == player.c2 or player.c6 == player.c1): player.c6 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c7 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c7 == player.c6 or player.c7 == player.c5 or player.c7 == player.c4 or player.c7 == player.c3 or player.c7 == player.c2 or player.c7 == player.c1): player.c7 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c8 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c8 == player.c7 or player.c8 == player.c6 or player.c8 == player.c5 or player.c8 == player.c4 or player.c8 == player.c3 or player.c8 == player.c2 or player.c8 == player.c1): player.c8 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c9 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c9 == player.c8 or player.c9 == player.c7 or player.c9 == player.c6 or player.c9 == player.c5 or player.c9 == player.c4 or player.c9 == player.c3 or player.c9 == player.c2 or player.c9 == player.c1): player.c9 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c10 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c10 == player.c9 or player.c10 == player.c8 or player.c10 == player.c7 or player.c10 == player.c6 or player.c10 == player.c5 or player.c10 == player.c4 or player.c10 == player.c3 or player.c10 == player.c2 or player.c10 == player.c1): player.c10 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c11 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c11 == player.c10 or player.c11 == player.c9 or player.c11 == player.c8 or player.c11 == player.c7 or player.c11 == player.c6 or player.c11 == player.c5 or player.c11 == player.c4 or player.c11 == player.c3 or player.c11 == player.c2 or player.c11 == player.c1): player.c11 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c12 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c12 == player.c11 or player.c12 == player.c10 or player.c12 == player.c9 or player.c12 == player.c8 or player.c12 == player.c7 or player.c12 == player.c6 or player.c12 == player.c5 or player.c12 == player.c4 or player.c12 == player.c3 or player.c12 == player.c2 or player.c12 == player.c1): player.c12 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c13 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c13 == player.c12 or player.c13 == player.c11 or player.c13 == player.c10 or player.c13 == player.c9 or player.c13 == player.c8 or player.c13 == player.c7 or player.c13 == player.c6 or player.c13 == player.c5 or player.c13 == player.c4 or player.c13 == player.c3 or player.c13 == player.c2 or player.c13 == player.c1): player.c13 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c14 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c14 == player.c13 or player.c14 == player.c12 or player.c14 == player.c11 or player.c14 == player.c10 or player.c14 == player.c9 or player.c14 == player.c8 or player.c14 == player.c7 or player.c14 == player.c6 or player.c14 == player.c5 or player.c14 == player.c4 or player.c14 == player.c3 or player.c14 == player.c2 or player.c14 == player.c1): player.c14 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) player.c15 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) while (player.c15 == player.c14 or player.c15 == player.c13 or player.c15 == player.c12 or player.c15 == player.c11 or player.c15 == player.c10 or player.c15 == player.c9 or player.c15 == player.c8 or player.c15 == player.c7 or player.c15 == player.c6 or player.c15 == player.c5 or player.c15 == player.c4 or player.c15 == player.c3 or player.c15 == player.c2 or player.c15 == player.c1): player.c15 = random.choice(['Yet_Another_Hero', 'eltoro', 'just_human', 'epraider', 'minigogo', 'techleopard', 'otah017', 'beesknees9', 'palsc5', 'mcremaster', 'Experthead', 'homeric', 'giddeon', 'Reallychel', 'Nissa11', 'uber_mardook', 'MonsterUP', 'BrightHulk26', 'tmesis', 'peely98']) for player in self.get_players(): if player.faketeam == 'Red Team': player.fakeotherteam = 'Blue Team' else: player.fakeotherteam = 'Red Team' if player.faketeam1 == 'Red Team': player.fakeotherteam1 = 'Blue Team' else: player.fakeotherteam1 = 'Red Team' if player.faketeam2 == 'Red Team': player.fakeotherteam2 = 'Blue Team' else: player.fakeotherteam2 = 'Red Team' if player.voteresult == "BL": player.districtoutcome = 'lost' if player.system == 'MJ': player.decisionruleinfo = 'distribute $2 to each player who voted ' \ 'for the team that won a majority in the ' \ 'Council.' player.decisionruleinfo1 = 'Therefore, you are receiving $0 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'Your team did not win a majority in the ' \ 'Council. The Council is allocating $2 ' \ 'to each supporter of the winning team.' player.myteamtocouncil = 0 if player.nteams == 3: player.myteamvote = 3 player.team2vote = 12 player.team3vote = 5 player.team2oncouncil = 3 player.team3oncouncil = 0 elif player.nteams == 4: player.myteamvote = 2 player.team2vote = 10 player.team3vote = 5 player.team4vote = 3 player.team2oncouncil = 3 player.team3oncouncil = 0 player.team4oncouncil = 0 elif player.nteams == 5: player.myteamvote = 1 player.team2vote = 9 player.team3vote = 4 player.team4vote = 3 player.team5vote = 3 player.team2oncouncil = 3 player.team3oncouncil = 0 player.team4oncouncil = 0 player.team5oncouncil = 0 elif player.system == 'PR': player.decisionruleinfo = 'distribute $2 to each player who voted ' \ 'for the team that won a majority in the ' \ 'Council and distribute $1 to each player ' \ 'who voted for the minority in the Council.' player.decisionruleinfo1 = 'Therefore, you are receiving $0 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'Your team did not win a majority in the ' \ 'Council and did not win a minority in the ' \ 'Council. The Council is allocating $2 ' \ 'to each supporter of the majority team and' \ '$1 to each supporter of the minority team.' if player.nteams == 3: player.myteamvote = 3 player.team2vote = 12 player.team3vote = 5 player.myteamtocouncil = 0 player.team2oncouncil = 2 player.team3oncouncil = 1 elif player.nteams == 4: player.myteamvote = 2 player.team2vote = 10 player.team3vote = 5 player.team4vote = 3 player.myteamtocouncil = 0 player.team2oncouncil = 2 player.team3oncouncil = 1 player.team4oncouncil = 0 elif player.nteams == 5: player.myteamvote = 1 player.team2vote = 10 player.team3vote = 4 player.team4vote = 2 player.team5vote = 3 player.myteamtocouncil = 0 player.team2oncouncil = 2 player.team3oncouncil = 1 player.team4oncouncil = 0 player.team5oncouncil = 0 elif player.system == "RCV": if player.nteams == 3: player.decisionruleinfo = 'distribute $2 to each player who ranked ' \ 'the winning team first and $1 to each player ' \ 'who ranked the winning team second.' player.decisionruleinfo1 = 'Therefore, you are receiving $0 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'The team you ranked first placed third.' \ 'You ranked the winning team third.' \ 'The Council is allocating $2 to each ' \ 'player ranking the winning team first and' \ '$1 to each player ranking the winning team second.' myteamRCVshare = 2.35 myteamvote = 3 team2RCVshare = 2.1 team2vote = 5 team3RCVshare = 1.55 team3vote = 12 player.myteamtocouncil = 0 player.team2oncouncil = 0 player.team3oncouncil = 3 elif player.nteams == 4: player.decisionruleinfo = 'distribute $2 to each player who ranked ' \ 'the winning team first, $1.33 to each player ' \ 'who ranked the winning team second, ' \ 'and $0.67 to each player who ranked the ' \ 'winning team third.' player.decisionruleinfo1 = 'Therefore, you are receiving $0 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'The team you ranked first placed fourth.' \ 'You ranked the winning team fourth.' \ 'The Council is allocating $2 to each ' \ 'player ranking the winning team first,' \ '$1.33 to each player ranking the winning team second,' \ 'and $0.67 to each player ranking the winning team third.' myteamRCVshare = 3.2 myteamvote = 2 team2RCVshare = 2.75 team2vote = 3 team3RCVshare = 2.25 team3vote = 5 team4RCVshare = 1.8 team4vote = 10 player.myteamtocouncil = 0 player.team2oncouncil = 0 player.team3oncouncil = 0 player.team4oncouncil = 3 elif player.nteams == 5: player.decisionruleinfo = 'distribute $2 to each player who ranked ' \ 'the winning team first, $1.50 to each player ' \ 'who ranked the winning team second, ' \ '$1 to each player who ranked the ' \ 'winning team third, and $0.50 to each' \ 'player who ranked the winning team fourth.' player.decisionruleinfo1 = 'Therefore, you are receiving $0 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'The team you ranked first placed fifth.' \ 'You ranked the winning team fifth.' \ 'The Council is allocating $2 to each ' \ 'player ranking the winning team first,' \ '$1.50 to each player ranking the winning team second,' \ '$1 to each player ranking the winning team third, and' \ '$0.50 to each player ranking the winning team fourth.' myteamRCVshare = 4.25 myteamvote = 1 team2RCVshare = 3.55 team2vote = 2 team3RCVshare = 2.75 team3vote = 3 team4RCVshare = 2.5 team4vote = 4 team5RCVshare = 1.95 team5vote = 10 player.myteamtocouncil = 0 player.team2oncouncil = 0 player.team3oncouncil = 0 player.team4oncouncil = 0 player.team5oncouncil = 3 elif player.voteresult == "SL": player.districtoutcome = 'lost' if player.system == 'MJ': player.decisionruleinfo = 'distribute $2 to each player who voted ' \ 'for the team that won a majority in the ' \ 'Council.' player.decisionruleinfo1 = 'Therefore, you are receiving $0 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'Your team did not win a majority in the ' \ 'Council. The Council is allocating $2 ' \ 'to each supporter of the winning team.' player.myteamtocouncil = 0 if player.nteams == 3: player.myteamvote = 8 player.team2vote = 9 player.team3vote = 3 player.team2oncouncil = 3 player.team3oncouncil = 0 elif player.nteams == 4: player.myteamvote = 7 player.team2vote = 8 player.team3vote = 3 player.team4vote = 2 player.team2oncouncil = 3 player.team3oncouncil = 0 player.team4oncouncil = 0 elif player.nteams == 5: player.myteamvote = 6 player.team2vote = 7 player.team3vote = 3 player.team4vote = 2 player.team5vote = 2 player.team2oncouncil = 3 player.team3oncouncil = 0 player.team4oncouncil = 0 player.team5oncouncil = 0 elif player.system == 'PR': player.decisionruleinfo = 'distribute $2 to each player who voted ' \ 'for the team that won a majority in the ' \ 'Council and distribute $1 to each player ' \ 'who voted for the minority in the Council.' player.decisionruleinfo1 = 'Therefore you are receving $1 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'Your team did not win a majority in the ' \ 'Council but did win a minority in the ' \ 'Council. The Council is allocating $2 ' \ 'to each supporter of the majority team and' \ '$1 to each supporter of the minority team.' if player.nteams == 3: player.myteamvote = 8 player.team2vote = 9 player.team3vote = 3 player.myteamtocouncil = 1 player.team2oncouncil = 2 player.team3oncouncil = 0 elif player.nteams == 4: player.myteamvote = 7 player.team2vote = 8 player.team3vote = 3 player.team4vote = 2 player.myteamtocouncil = 1 player.team2oncouncil = 2 player.team3oncouncil = 0 player.team4oncouncil = 0 elif player.nteams == 5: player.myteamvote = 6 player.team2vote = 7 player.team3vote = 3 player.team4vote = 2 player.team5vote = 2 player.myteamtocouncil = 1 player.team2oncouncil = 2 player.team3oncouncil = 0 player.team4oncouncil = 0 player.team5oncouncil = 0 elif player.system == "RCV": if player.nteams == 3: player.decisionruleinfo = 'distribute $2 to each player who ranked ' \ 'the winning team first and $1 to each player ' \ 'who ranked the winning team second.' player.decisionruleinfo1 = 'Therefore, you are receiving $1 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'The team you ranked first placed second.' \ 'You ranked the winning team second.' \ 'The Council is allocating $2 to each ' \ 'player ranking the winning team first and' \ '$1 to each player ranking the winning team second.' myteamRCVshare = 2.1 myteamvote = 5 team2RCVshare = 1.55 team2vote = 12 team3RCVshare = 2.35 team3vote = 3 player.myteamtocouncil = 0 player.team2oncouncil = 3 player.team3oncouncil = 0 elif player.nteams == 4: player.decisionruleinfo = 'distribute $2 to each player who ranked ' \ 'the winning team first, $1.33 to each player ' \ 'who ranked the winning team second, ' \ 'and $0.67 to each player who ranked the ' \ 'winning team third.' player.decisionruleinfo1 = 'Therefore, you are receiving $1.33 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'The team you ranked first placed third.' \ 'You ranked the winning team second.' \ 'The Council is allocating $2 to each ' \ 'player ranking the winning team first,' \ '$1.33 to each player ranking the winning team second,' \ 'and $0.67 to each player ranking the winning team third.' myteamRCVshare = 2.75 myteamvote = 3 team2RCVshare = 1.8 team2vote = 10 team3RCVshare = 2.25 team3vote = 5 team4RCVshare = 3.2 team4vote = 2 player.myteamtocouncil = 0 player.team2oncouncil = 3 player.team3oncouncil = 0 player.team4oncouncil = 0 elif player.nteams == 5: player.decisionruleinfo = 'distribute $2 to each player who ranked ' \ 'the winning team first, $1.50 to each player ' \ 'who ranked the winning team second, ' \ '$1 to each player who ranked the ' \ 'winning team third, and $0.50 to each' \ 'player who ranked the winning team fourth.' player.decisionruleinfo1 = 'Therefore, you are receiving $1 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'The team you ranked first placed third.' \ 'You ranked the winning team third.' \ 'The Council is allocating $2 to each ' \ 'player ranking the winning team first,' \ '$1.50 to each player ranking the winning team second,' \ '$1 to each player ranking the winning team third, and' \ '$0.50 to each player ranking the winning team fourth.' myteamRCVshare = 2.75 myteamvote = 3 team2RCVshare = 3.55 team2vote = 2 team3RCVshare = 1.95 team3vote = 10 team4RCVshare = 2.5 team4vote = 4 team5RCVshare = 4.25 team5vote = 1 player.myteamtocouncil = 0 player.team2oncouncil = 0 player.team3oncouncil = 3 player.team4oncouncil = 0 player.team5oncouncil = 0 elif player.voteresult == "SW": player.districtoutcome = 'won' if player.system == 'MJ': player.decisionruleinfo = 'distribute $2 to each player who voted ' \ 'for the team that won a majority in the ' \ 'Council.' player.decisionruleinfo1 = 'Therefore, you are receiving $2 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'Your team won a majority in the ' \ 'Council. The Council is allocating $2 ' \ 'to each supporter of the winning team.' player.myteamtocouncil = 3 if player.nteams == 3: player.myteamvote = 9 player.team2vote = 8 player.team3vote = 3 player.team2oncouncil = 0 player.team3oncouncil = 0 elif player.nteams == 4: player.myteamvote = 8 player.team2vote = 7 player.team3vote = 3 player.team4vote = 2 player.team2oncouncil = 0 player.team3oncouncil = 0 player.team4oncouncil = 0 elif player.nteams == 5: player.myteamvote = 7 player.team2vote = 6 player.team3vote = 3 player.team4vote = 2 player.team5vote = 2 player.team2oncouncil = 0 player.team3oncouncil = 0 player.team4oncouncil = 0 player.team5oncouncil = 0 elif player.system == 'PR': player.decisionruleinfo = 'distribute $2 to each player who voted ' \ 'for the team that won a majority in the ' \ 'Council and distribute $1 to each player ' \ 'who voted for the minority in the Council.' player.decisionruleinfo1 = 'Therefore, you are receiving $2 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'Your team did win a majority in the ' \ 'Council. The Council is allocating $2 ' \ 'to each supporter of the majority team and' \ '$1 to each supporter of the minority team.' if player.nteams == 3: player.myteamvote = 9 player.team2vote = 8 player.team3vote = 3 player.myteamtocouncil = 2 player.team2oncouncil = 1 player.team3oncouncil = 0 elif player.nteams == 4: player.myteamvote = 8 player.team2vote = 7 player.team3vote = 3 player.team4vote = 2 player.myteamtocouncil = 2 player.team2oncouncil = 1 player.team3oncouncil = 0 player.team4oncouncil = 0 elif player.nteams == 5: player.myteamvote = 7 player.team2vote = 6 player.team3vote = 3 player.team4vote = 2 player.team5vote = 2 player.myteamtocouncil = 2 player.team2oncouncil = 1 player.team3oncouncil = 0 player.team4oncouncil = 0 player.team5oncouncil = 0 elif player.system == "RCV": if player.nteams == 3: player.decisionruleinfo = 'distribute $2 to each player who ranked ' \ 'the winning team first and $1 to each player ' \ 'who ranked the winning team second.' player.decisionruleinfo1 = 'Therefore, you are receiving $1 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'The team you ranked first placed second.' \ 'You ranked the winning team second.' \ 'The Council is allocating $2 to each ' \ 'player ranking the winning team first and' \ '$1 to each player ranking the winning team second.' myteamRCVshare = 2.1 myteamvote = 5 team2RCVshare = 1.55 team2vote = 12 team3RCVshare = 2.35 team3vote = 3 player.myteamtocouncil = 0 player.team2oncouncil = 3 player.team3oncouncil = 0 elif player.nteams == 4: player.decisionruleinfo = 'distribute $2 to each player who ranked ' \ 'the winning team first, $1.33 to each player ' \ 'who ranked the winning team second, ' \ 'and $0.67 to each player who ranked the ' \ 'winning team third.' player.decisionruleinfo1 = 'Therefore, you are receiving $1.33 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'The team you ranked first placed third.' \ 'You ranked the winning team second.' \ 'The Council is allocating $2 to each ' \ 'player ranking the winning team first,' \ '$1.33 to each player ranking the winning team second,' \ 'and $0.67 to each player ranking the winning team third.' myteamRCVshare = 2.75 myteamvote = 3 team2RCVshare = 1.8 team2vote = 10 team3RCVshare = 2.25 team3vote = 5 team4RCVshare = 3.2 team4vote = 2 player.myteamtocouncil = 0 player.team2oncouncil = 3 player.team3oncouncil = 0 player.team4oncouncil = 0 elif player.nteams == 5: player.decisionruleinfo = 'distribute $2 to each player who ranked ' \ 'the winning team first, $1.50 to each player ' \ 'who ranked the winning team second, ' \ '$1 to each player who ranked the ' \ 'winning team third, and $0.50 to each' \ 'player who ranked the winning team fourth.' player.decisionruleinfo1 = 'Therefore, you are receiving $1 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'The team you ranked first placed third.' \ 'You ranked the winning team third.' \ 'The Council is allocating $2 to each ' \ 'player ranking the winning team first,' \ '$1.50 to each player ranking the winning team second,' \ '$1 to each player ranking the winning team third, and' \ '$0.50 to each player ranking the winning team fourth.' myteamRCVshare = 2.75 myteamvote = 3 team2RCVshare = 3.55 team2vote = 2 team3RCVshare = 1.95 team3vote = 10 team4RCVshare = 2.5 team4vote = 4 team5RCVshare = 4.25 team5vote = 1 player.myteamtocouncil = 0 player.team2oncouncil = 0 player.team3oncouncil = 3 player.team4oncouncil = 0 player.team5oncouncil = 0 elif player.voteresult == "BW": player.districtoutcome = 'won' if player.system == 'MJ': player.decisionruleinfo = 'distribute $2 to each player who voted ' \ 'for the team that won a majority in the ' \ 'Council.' player.decisionruleinfo1 = 'Therefore, you are receiving $2 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'Your team won a majority in the ' \ 'Council. The Council is allocating $2 ' \ 'to each supporter of the winning team.' player.myteamtocouncil = 3 if player.nteams == 3: player.myteamvote = 12 player.team2vote = 3 player.team3vote = 5 player.team2oncouncil = 0 player.team3oncouncil = 0 elif player.nteams == 4: player.myteamvote = 10 player.team2vote = 2 player.team3vote = 5 player.team4vote = 3 player.team2oncouncil = 0 player.team3oncouncil = 0 player.team4oncouncil = 0 elif player.nteams == 5: player.myteamvote = 9 player.team2vote = 1 player.team3vote = 4 player.team4vote = 3 player.team5vote = 3 player.team2oncouncil = 0 player.team3oncouncil = 0 player.team4oncouncil = 0 player.team5oncouncil = 0 elif player.system == 'PR': player.decisionruleinfo = 'distribute $2 to each player who voted ' \ 'for the team that won a majority in the ' \ 'Council and distribute $1 to each player ' \ 'who voted for the minority in the Council.' player.decisionruleinfo1 = 'Therefore, you are receiving $2 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'Your team won a majority in the ' \ 'Council. The Council is allocating $2 ' \ 'to each supporter of the majority team and' \ '$1 to each supporter of the minority team.' if player.nteams == 3: player.myteamvote = 12 player.team2vote = 3 player.team3vote = 5 player.myteamtocouncil = 2 player.team2oncouncil = 0 player.team3oncouncil = 1 elif player.nteams == 4: player.myteamvote = 10 player.team2vote = 2 player.team3vote = 5 player.team4vote = 3 player.myteamtocouncil = 2 player.team2oncouncil = 0 player.team3oncouncil = 1 player.team4oncouncil = 0 elif player.nteams == 5: player.myteamvote = 9 player.team2vote = 1 player.team3vote = 4 player.team4vote = 3 player.team5vote = 3 player.myteamtocouncil = 2 player.team2oncouncil = 0 player.team3oncouncil = 1 player.team4oncouncil = 0 player.team5oncouncil = 0 elif player.system == "RCV": if player.nteams == 3: player.decisionruleinfo = 'distribute $2 to each player who ranked ' \ 'the winning team first and $1 to each player ' \ 'who ranked the winning team second.' player.decisionruleinfo1 = 'Therefore, you are receiving $2 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'The team you ranked first placed first.' \ 'You ranked the winning team first.' \ 'The Council is allocating $2 to each ' \ 'player ranking the winning team first and' \ '$1 to each player ranking the winning team second.' myteamRCVshare = 1.55 myteamvote = 12 team2RCVshare = 2.1 team2vote = 5 team3RCVshare = 2.35 team3vote = 3 player.myteamtocouncil = 3 player.team2oncouncil = 0 player.team3oncouncil = 0 elif player.nteams == 4: player.decisionruleinfo = 'distribute $2 to each player who ranked ' \ 'the winning team first, $1.33 to each player ' \ 'who ranked the winning team second, ' \ 'and $0.67 to each player who ranked the ' \ 'winning team third.' player.decisionruleinfo1 = 'Therefore, you are receiving $2 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'The team you ranked first placed first.' \ 'You ranked the winning team first.' \ 'The Council is allocating $2 to each ' \ 'player ranking the winning team first,' \ '$1.33 to each player ranking the winning team second,' \ 'and $0.67 to each player ranking the winning team third.' myteamRCVshare = 1.8 myteamvote = 10 team2RCVshare = 2.75 team2vote = 3 team3RCVshare = 2.25 team3vote = 5 team4RCVshare = 3.2 team4vote = 2 player.myteamtocouncil = 3 player.team2oncouncil = 0 player.team3oncouncil = 0 player.team4oncouncil = 0 elif player.nteams == 5: player.decisionruleinfo = 'distribute $2 to each player who ranked ' \ 'the winning team first, $1.50 to each player ' \ 'who ranked the winning team second, ' \ '$1 to each player who ranked the ' \ 'winning team third, and $0.50 to each' \ 'player who ranked the winning team fourth.' player.decisionruleinfo1 = 'Therefore, you are receiving $2 as a ' \ 'payout from the election.' player.decisionruleinfo2 = 'The team you ranked first placed first.' \ 'You ranked the winning team first.' \ 'The Council is allocating $2 to each ' \ 'player ranking the winning team first,' \ '$1.50 to each player ranking the winning team second,' \ '$1 to each player ranking the winning team third, and' \ '$0.50 to each player ranking the winning team fourth.' myteamRCVshare = 1.95 myteamvote = 10 team2RCVshare = 3.55 team2vote = 2 team3RCVshare = 2.75 team3vote = 3 team4RCVshare = 2.5 team4vote = 4 team5RCVshare = 4.25 team5vote = 1 player.myteamtocouncil = 3 player.team2oncouncil = 0 player.team3oncouncil = 0 player.team4oncouncil = 0 player.team5oncouncil = 0 # if player.councilresult == 40: # player.myteamoncouncil = 3 # player.otherteamoncouncil = 6 # if player.voteresult == 40: # if player.system == 'majoritarian': # player.myteamvotetotal = 12 # player.otherteamvotetotal = 18 # player.myteamwonother = 3 # if player.system == 'proportional': # player.myteamvotetotal = 12 # player.otherteamvotetotal = 18 # player.myteamwonother = 2 # if player.voteresult == 60: # if player.system == 'majoritarian': # player.myteamvotetotal = 12 # player.otherteamvotetotal = 18 # player.myteamwonother = 0 # if player.system == 'proportional': # player.myteamvotetotal = 10 # player.otherteamvotetotal = 20 # player.myteamwonother = 1 # if player.councilresult == 60: # player.myteamoncouncil = 6 # player.otherteamoncouncil = 3 # player.myteamvotetotal = 18 # player.otherteamvotetotal = 12 # if player.voteresult == 40: # if player.system == "majoritarian": # player.myteamwonother = 6 # if player.system == 'proportional': # player.myteamwonother = 5 # if player.voteresult == 60: # if player.system == "majoritarian": # player.myteamwonother = 3 # if player.system == "proportional": # player.myteamwonother = 4 # if player.decisionrule == 'all-equal': # player.decisionruleinfo = 'divide $30 equally among all 30 players.' # player.decisionruleinfo1 = 'Therefore, you are receiving $1.00 as a ' \ # 'payout from the election.' # player.decisionruleinfo2 = ' ' # if player.decisionrule == 'winner-take-all': # if player.councilresult == 40: # player.decisionruleinfo = 'distribute $30 only among players who voted ' \ # 'for the team that won a majority in the ' \ # 'Council.' # player.decisionruleinfo1 = 'Therefore, you are receiving $0.00 as a ' \ # 'payout from the election.' # player.decisionruleinfo2 = 'Your team did not win a majority in the ' \ # 'Council. The Council is allocating all $30 ' \ # 'to the other team and $0 to your team.' # if player.councilresult == 60: # player.decisionruleinfo = 'distribute $30 only among players who voted ' \ # 'for the team that won a majority in the ' \ # 'Council.' # player.decisionruleinfo1 = 'Therefore, you are receiving $1.67 as a ' \ # 'payout from the election.' # player.decisionruleinfo2 = 'Your team won a majority in the ' \ # 'Council. The Council is allocating all $30 ' \ # 'to your team and $0 to the other team.' # if player.decisionrule == 'proportional': # if player.councilresult == 40: # player.decisionruleinfo = 'divide $30 based on the number of seats in the ' \ # 'Council won by each Team A and Team B.' # player.decisionruleinfo1 = 'Therefore, you are receiving $0.83 as a payout ' \ # 'from the election.' # player.decisionruleinfo2 = 'The Council is allocating $20 to the other team ' \ # 'and $10 to your team. $10 are divided ' \ # 'among 12 people, including you, who voted for ' \ # 'your team.' # if player.councilresult == 60: # player.decisionruleinfo = 'divide $30 based on the number of seats in the ' \ # 'Council won by each Team A and Team B.' # player.decisionruleinfo1 = 'Therefore, you are receiving $1.11 as a payout ' \ # 'from the election.' # player.decisionruleinfo2 = 'The Council is allocating $20 to your team ' \ # 'and $10 to the other team. $20 are divided ' \ # 'among 18 people, including you, who voted for ' \ # 'your team.' # player.player2team = random.choice([player.otherteam1, player.otherteam2]) # player.player3team = random.choice([player.otherteam1, player.otherteam2]) # while (player.player2team == player.player3team): # player.player3team = random.choice([player.otherteam1, player.otherteam2]) from .pages import initial_page_sequence aaa = [i.__name__.split('_') for i in initial_page_sequence] page_blocks = [list(group) for key, group in itertools.groupby(aaa, key=lambda x: x[0])] for player in self.get_players(): pb = page_blocks.copy() random.shuffle(pb) level1 = list(itertools.chain.from_iterable(pb)) level2 = ['_'.join(i) for i in level1] player.participant.vars['trial_sequence'] = json.dumps(level2) print('trial sequence is', player.participant.vars['trial_sequence']) class Group(BaseGroup): pass class Player(BasePlayer): digits = models.StringField() chars = models.StringField() username = models.CharField() age = models.IntegerField(min=18, max=100) gender = models.StringField(choices=['Male', 'Female'], widget=widgets.RadioSelect) race = models.StringField(verbose_name='Which category best describes your race or ' 'ethnicity?', widget=widgets.RadioSelect) party1 = models.StringField(verbose_name='Generally speaking, do you think of yourself as ' 'a...', choices=['Strong Republican', 'Not strong Republican', 'Lean Republican', 'Independent', 'Lean Demorat', 'Not strong Democrat', 'Strong Democrat'], widget=widgets.RadioSelect) education = models.StringField(verbose_name='What is the highest level of school you have ' 'completed?', choices=['No formal education', '1st, 2nd, 3rd, or 4th grade', '5th or 6th grade', '7th or 8th grade', '9th grade', '10th grade', '11th grade', '12th grade, no diploma', 'High school diploma or the equivalent (GED)', 'Some college, no degree', 'Associate degree', 'Bachelor\'s degree', 'Master\'s degree', 'Professional or Doctorate degree' ], widget=widgets.RadioSelect) income = models.StringField(verbose_name='Thinking back over the last year, what was your ' 'family’s annual income?', choices=['Less than $10,000', '$10,000-$19,999', '$20,000-$29,999', '$30,000–$39,999', '$40,000–$49,999', '$50,000–$59,999', '$60,000–$69,999', '$70,000–$79,999', '$80,000–$89,999', '$90,000–$99,999','$100,000–$124,999', '$125,000–$149,999', '$150,000–$174,999', '$175,000–$199,999', '$200,000–$249,999', '$250,000+', 'Prefer not to say'], widget=widgets.RadioSelect) nteams = models.IntegerField() payout = models.FloatField() team = models.StringField() districtoutcome = models.StringField() player2team = models.StringField() player3team = models.StringField() otherteam1 = models.StringField() otherteam2 = models.StringField() otherteam3 = models.StringField() otherteam4 = models.StringField() composition = models.IntegerField() decisionrule = models.StringField() system = models.StringField() systeminfo = models.StringField() systeminfo2 = models.LongStringField() decisionruleinfo = models.LongStringField() decisionruleinfo1 = models.LongStringField() decisionruleinfo2 = models.LongStringField() vote = models.StringField( choices=['Team A', 'Team B', 'Team C'], widget = widgets.RadioSelectHorizontal) vote_4 = models.StringField( choices=['Team A', 'Team B', 'Team C', 'Team D'], widget = widgets.RadioSelectHorizontal) vote_5 = models.StringField( choices=['Team A', 'Team B', 'Team C', 'Team D', 'Team E'], widget = widgets.RadioSelectHorizontal) if nteams == 3: rcv_vote_1 = models.StringField( choices =['Team A', 'Team B', 'Team C'], widget = widgets.RadioSelectHorizontal) rcv_vote_2 = models.StringField( choices =['Team A', 'Team B', 'Team C'], widget = widgets.RadioSelectHorizontal) rcv_vote_3 = models.StringField( choices =['Team A', 'Team B', 'Team C'], widget = widgets.RadioSelectHorizontal) def error_message(self, values): if rcv_vote1 == rcv_vote_2: return 'Each team should only be assigned one rank.' elif rcv_vote1 == rcv_vote_3: return 'Each team should only be assigned one rank.' elif rcv_vote_2 == rcv_vote_3: return 'Each team should only be assigned one rank.' elif nteams == 4: rcv_vote_1 = models.StringField( choices =['Team A', 'Team B', 'Team C', 'Team D'], widget = widgets.RadioSelectHorizontal) rcv_vote_2 = models.StringField( choices =['Team A', 'Team B', 'Team C', 'Team D'], widget = widgets.RadioSelectHorizontal) rcv_vote_3 = models.StringField( choices =['Team A', 'Team B', 'Team C', 'Team D'], widget = widgets.RadioSelectHorizontal) rcv_vote_4 = models.StringField( choices =['Team A', 'Team B', 'Team C', 'Team D'], widget = widgets.RadioSelectHorizontal) def error_message(self, values): if rcv_vote_1 == rcv_vote_2: return 'Each team should only be assigned one rank.' elif rcv_vote_1 == rcv_vote_3: return 'Each team should only be assigned one rank.' elif rcv_vote_1 == rcv_vote_4: return 'Each team should only be assigned one rank.' elif rcv_vote_2 == rcv_vote_3: return 'Each team should only be assigned one rank.' elif rcv_vote_2 == rcv_vote_4: return 'Each team should only be assigned one rank.' elif rcv_vote_3 == rcv_vote_4: return 'Each team should only be assigned one rank.' elif nteams == 5: rcv_vote_1 = models.StringField( choices =['Team A', 'Team B', 'Team C', 'Team D', 'Team E'], widget = widgets.RadioSelectHorizontal) rcv_vote_2 = models.StringField( choices =['Team A', 'Team B', 'Team C', 'Team D', 'Team E'], widget = widgets.RadioSelectHorizontal) rcv_vote_3 = models.StringField( choices =['Team A', 'Team B', 'Team C', 'Team D', 'Team E'], widget = widgets.RadioSelectHorizontal) rcv_vote_4 = models.StringField( choices =['Team A', 'Team B', 'Team C', 'Team D', 'Team E'], widget = widgets.RadioSelectHorizontal) rcv_vote_5 = models.StringField( choices =['Team A', 'Team B', 'Team C', 'Team D', 'Team E'], widget = widgets.RadioSelectHorizontal) def error_message(self, values): if rcv_vote_1 == rcv_vote_2: return 'Each team should only be assigned one rank.' elif rcv_vote_1 == rcv_vote_3: return 'Each team should only be assigned one rank.' elif rcv_vote_1 == rcv_vote_4: return 'Each team should only be assigned one rank.' elif rcv_vote_1 == rcv_vote_5: return 'Each team should only be assigned one rank.' elif rcv_vote_2 == rcv_vote_3: return 'Each team should only be assigned one rank.' elif rcv_vote_2 == rcv_vote_4: return 'Each team should only be assigned one rank.' elif rcv_vote_2 == rcv_vote_5: return 'Each team should only be assigned one rank.' elif rcv_vote_3 == rcv_vote_4: return 'Each team should only be assigned one rank.' elif rcv_vote_3 == rcv_vote_5: return 'Each team should only be assigned one rank.' elif rcv_vote_4 == rcv_vote_5: return 'Each team should only be assigned one rank.' voteresult = models.StringField() myteamvote = models.IntegerField() team2vote = models.IntegerField() team3vote = models.IntegerField() team4vote = models.IntegerField() team5vote = models.IntegerField() myteamRCVshare = models.FloatField() team2RCVshare = models.FloatField() team3RCVshare = models.FloatField() team4RCVshare = models.FloatField() team5RCVshare = models.FloatField() myteamtocouncil = models.IntegerField() myteamoncouncil = models.IntegerField() team2oncouncil = models.IntegerField() team3oncouncil = models.IntegerField() team4oncouncil = models.IntegerField() team5oncouncil = models.IntegerField() myteamvotetotal = models.IntegerField() otherteamvotetotal = models.IntegerField() myteamwonother = models.IntegerField() otherteamtocouncil = models.IntegerField() teamreps = models.PositiveIntegerField() teamreturn = models.PositiveIntegerField() councilresult = models.IntegerField() fair = models.StringField(label="How fair or unfair do you think the results of the " "election were?", choices=['Very fair', 'Somewhat fair', 'Neither fair nor unfair', 'Somewhat unfair', 'Very unfair']) happy = models.StringField(label="How do you feel about the election results?", choices=['Very happy', 'Somewhat happy', 'Neither happy nor unhappy', 'Somewhat unhappy', 'Very unhappy']) give = models.IntegerField(min=0, max=Constants.endowment, label="How many tokens would you like to give to the other player?") keep = models.IntegerField(min=0, max=Constants.endowment, label="How many tokens would you like to keep for yourself?") give2 = models.IntegerField(min=0, max=Constants.endowment, label="How many tokens would you like to give to the other player?") keep2 = models.IntegerField(min=0, max=Constants.endowment, label="How many tokens would you like to keep for yourself?") feeling = models.CharField( widget = widgets.Textarea ) c1 = models.StringField() c2 = models.StringField() c3 = models.StringField() c4 = models.StringField() c5 = models.StringField() c6 = models.StringField() c7 = models.StringField() c8 = models.StringField() c9 = models.StringField() c10 = models.StringField() c11 = models.StringField() c12 = models.StringField() c13 = models.StringField() c14 = models.StringField() c15 = models.StringField() player_id = models.StringField() correct_clicked_equal = models.StringField() correct_clicked_winner1 = models.StringField() correct_clicked_winner2 = models.StringField() correct_clicked_prop1 = models.StringField() correct_clicked_prop2 = models.StringField() correct_clicked_system1 = models.StringField() correct_clicked_system2 = models.StringField() correct_clicked_system3 = models.StringField() correct_clicked_system4 = models.StringField() faketeam = models.StringField() fakeotherteam = models.StringField() faketeam1 = models.StringField() fakeotherteam1 = models.StringField() faketeam2 = models.StringField() fakeotherteam2 = models.StringField()