def run(): load_registry() r.get_registry()['MY_SQL'].query( 'DROP TABLE runs;' ) r.get_registry()['MY_SQL'].query( 'DROP TABLE robots;' )
def run(): load_registry() r.get_registry()['MY_SQL'].query('DROP TABLE user;') r.get_registry()['MY_SQL'].query('DROP TABLE admin;') r.get_registry()['MY_SQL'].query('DROP TABLE emergency;') r.get_registry()['MY_SQL'].query('DROP TABLE report;') r.get_registry()['MY_SQL'].query('DROP TABLE message_admin;') r.get_registry()['MY_SQL'].query('DROP TABLE message_user;') r.get_registry()['MY_SQL'].query('DROP TABLE image;')
def run(): db = MySQLdb.connect(host=settings.mysql_host, port=settings.mysql_port, user=settings.mysql_user, passwd=settings.mysql_password) db.query('CREATE DATABASE IF NOT EXISTS scoring_system;') load_registry() r.get_registry()['MY_SQL'].query( 'ALTER DATABASE scoring_system CHARACTER SET ' 'utf8 COLLATE utf8_general_ci;') r.get_registry()['ROBOTS'].create_table() r.get_registry()['RUNS'].create_table()
def run(): # grant all privileges on *.* to trivia_challenge@localhost identified by '9a7123w4982ew3490x23pl34bz' with grant option; # NOQA load_registry() r.get_registry()['MY_SQL'].query('CREATE DATABASE challenge;') r.get_registry()['MY_SQL'].query("""CREATE TABLE questions( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255), prompt VARCHAR(255), passing_score INT, correct_names LONGTEXT, finalized INT DEFAULT 1, active INT DEFAULT 1, total INT DEFAULT 0 )""")
def run(): load_registry() division_map = { 'high school': 'high_school', 'junior': 'junior', 'senior': 'senior', 'walking': 'walking' } unique_map = {'unique': True, 'custom kit': False, 'i am not sure': False} versa_valve_map = {'yes': True, 'no': False} fields_index = { 'division': 0, 'name': 1, 'unique': 3, 'versa_valve': 6, 'school': 2 } with open('robot_list_2017.csv', 'rb') as csvfile: spamreader = csv.reader(csvfile) i = 0 id_counter = {'high_school': 1, 'senior': 1, 'walking': 1, 'junior': 1} for row in spamreader: # skip first three lines if i <= 2: i += 1 continue i += 1 d = {} if row[fields_index['unique']].strip().lower() == ( 'i am not sure, please contact me to discuss'): continue for field, index in fields_index.iteritems(): if field == 'division': d[field] = division_map[row[index].strip().lower()] elif field == 'unique': d[field] = unique_map[row[index].strip().lower()] else: d[field] = row[index] d['id'] = get_id(id_counter, d) r.get_registry()['ROBOTS'].record_robot(division=d['division'], id=d['id'], volume=0, school=d['school'], name=d['name'], is_unique=d['unique'], used_versa_valve=False, level=1, is_disqualified=False, passed_inspection=False)
def run(): db = MySQLdb.connect( host=settings.mysql_host, port=settings.mysql_port, user=settings.mysql_user, passwd=settings.mysql_password) db.query('CREATE DATABASE IF NOT EXISTS scoring_system;') load_registry() r.get_registry()['MY_SQL'].query( 'ALTER DATABASE scoring_system CHARACTER SET ' 'utf8 COLLATE utf8_general_ci;' ) r.get_registry()['ROBOTS'].create_table() r.get_registry()['RUNS'].create_table()
def run(): # grant all privileges on *.* to trivia_challenge@localhost identified by '9a7123w4982ew3490x23pl34bz' with grant option; # NOQA load_registry() r.get_registry()['MY_SQL'].query('CREATE DATABASE challenge;') r.get_registry()['MY_SQL'].query( """CREATE TABLE questions( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255), prompt VARCHAR(255), passing_score INT, correct_names LONGTEXT, finalized INT DEFAULT 1, active INT DEFAULT 1, total INT DEFAULT 0 )""" )
def run(): # get database connection db = MySQLdb.connect(host=settings.mysql_host, port=settings.mysql_port, user=settings.mysql_user, passwd=settings.mysql_password) # create database db.query('CREATE DATABASE IF NOT EXISTS trin_report;') load_registry() # set character set of database r.get_registry()['MY_SQL'].query( 'ALTER DATABASE trin_report CHARACTER SET ' 'utf8 COLLATE utf8_general_ci;') # create all database tables r.get_registry()['USER'].create_table() r.get_registry()['EMERGENCY'].create_table() r.get_registry()['ADMIN'].create_table() r.get_registry()['REPORT'].create_table() r.get_registry()['MESSAGE_ADMIN'].create_table() r.get_registry()['MESSAGE_USER'].create_table() r.get_registry()['IMAGE'].create_table()
def run(): load_registry() robots = [ { "division": "junior", "id": "test-1", "volume": 365, "school": "Test", "name": "Jazz", "is_unique": True, "used_versa_valve": False, "level": 1, "is_disqualified": False, "passed_inspection": False, }, { "division": "high_school", "id": "test-2", "volume": 345, "school": "Test", "name": "Hanley", "is_unique": True, "used_versa_valve": False, "level": 1, "is_disqualified": False, "passed_inspection": False, }, { "division": "senior", "id": "test-3", "volume": 345, "school": "Test", "name": "Spazz", "is_unique": True, "used_versa_valve": False, "level": 1, "is_disqualified": False, "passed_inspection": False, }, ] for data in robots: r.get_registry()["ROBOTS"].record_robot( division=data["division"], id=data["id"], volume=data["volume"], school=data["school"], name=data["name"], is_unique=data["is_unique"], used_versa_valve=data["used_versa_valve"], level=data["level"], is_disqualified=data["is_disqualified"], passed_inspection=data["passed_inspection"], ) # Values of param for record_run is robot_div, level, # failed_trial, actual_time, reached_time_limit, # non_air, furniture, arbitrary_start, return_trip, # candle_location_mode, stopped_within_circle, # signled_detection, num_rooms_detected, kicked_dog, # touched_candle, cont_wall_contact, ramp_hallway, # alt_target, all_candles, used_versa_valve, score, robot_id # Just using dictionary for clarification jazz_runs = [ { "level": 1, "failed_trial": False, "actual_time": 155.742, "reached_time_limit": False, "non_air": False, "furniture": False, "arbitrary_start": False, "return_trip": False, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 2, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 0, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, { "level": 1, "failed_trial": False, "actual_time": 132.614, "reached_time_limit": False, "non_air": False, "furniture": False, "arbitrary_start": False, "return_trip": False, "candle_location_mode": True, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 4, "kicked_dog": True, "touched_candle": False, "cont_wall_contact": 16, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, { "level": 1, "failed_trial": True, "actual_time": 340, # Some random number over 3 "reached_time_limit": True, "non_air": False, "furniture": False, "arbitrary_start": False, "return_trip": False, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 1, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 0, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, { "level": 2, "failed_trial": False, "actual_time": 150.304, "reached_time_limit": False, "non_air": False, "furniture": True, "arbitrary_start": False, "return_trip": False, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 4, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 3, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, { "level": 3, "failed_trial": True, "actual_time": 190, "reached_time_limit": True, "non_air": False, "furniture": True, "arbitrary_start": False, "return_trip": False, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 2, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 3, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, ] hanley_runs = [ { "level": 1, "failed_trial": False, "actual_time": 285.742, "reached_time_limit": False, "non_air": False, "furniture": False, "arbitrary_start": False, "return_trip": False, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 2, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 0, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, { "level": 1, "failed_trial": False, "actual_time": 39.234, "reached_time_limit": False, "non_air": False, "furniture": False, "arbitrary_start": False, "return_trip": False, "candle_location_mode": True, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 3, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 8, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, { "level": 2, "failed_trial": False, "actual_time": 150.304, "reached_time_limit": False, "non_air": False, "furniture": True, "arbitrary_start": False, "return_trip": False, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 4, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 3, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, { "level": 3, "failed_trial": True, "actual_time": 450, "reached_time_limit": False, "non_air": False, "furniture": False, "arbitrary_start": False, "return_trip": False, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 0, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 0, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, { "level": 3, "failed_trial": False, "actual_time": 58.222, "reached_time_limit": False, "non_air": False, "furniture": False, "arbitrary_start": False, "return_trip": False, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 2, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 0, "ramp_hallway": False, "alt_target": False, "all_candles": True, "used_versa_valve": False, }, ] spazz_runs = [ { "level": 1, "failed_trial": True, "actual_time": 285.742, "reached_time_limit": False, "non_air": False, "furniture": False, "arbitrary_start": False, "return_trip": False, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 2, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 3, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, { "level": 1, "failed_trial": False, "actual_time": 85.641, "reached_time_limit": False, "non_air": False, "furniture": False, "arbitrary_start": False, "return_trip": False, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 2, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 0, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, { "level": 1, "failed_trial": True, "actual_time": 285.742, "reached_time_limit": False, "non_air": False, "furniture": False, "arbitrary_start": False, "return_trip": False, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 2, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 0, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, { "level": 2, "failed_trial": False, "actual_time": 187.638, "reached_time_limit": False, "non_air": True, "furniture": True, "arbitrary_start": True, "return_trip": True, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 4, "kicked_dog": True, "touched_candle": True, "cont_wall_contact": 0, "ramp_hallway": False, "alt_target": False, "all_candles": False, "used_versa_valve": False, }, { "level": 3, "failed_trial": False, "actual_time": 117, "reached_time_limit": False, "non_air": False, "furniture": True, "arbitrary_start": False, "return_trip": False, "candle_location_mode": False, "stopped_within_circle": False, "signaled_detection": False, "num_rooms_detected": 2, "kicked_dog": False, "touched_candle": False, "cont_wall_contact": 0, "ramp_hallway": True, "alt_target": True, "all_candles": True, "used_versa_valve": False, }, ] for run in jazz_runs: jazz_robot = robots[0] robot_div = jazz_robot["division"] robot_id = jazz_robot["id"] score_components = ( robot_div, run["level"], run["failed_trial"], run["actual_time"], run["non_air"], run["furniture"], run["arbitrary_start"], run["return_trip"], run["candle_location_mode"], run["stopped_within_circle"], run["signaled_detection"], run["num_rooms_detected"], run["kicked_dog"], run["touched_candle"], run["cont_wall_contact"], run["ramp_hallway"], run["alt_target"], run["all_candles"], ) r.get_registry()["RUNS"].record_run( run["level"], run["failed_trial"], run["actual_time"], run["non_air"], run["furniture"], run["arbitrary_start"], run["return_trip"], run["candle_location_mode"], run["stopped_within_circle"], run["signaled_detection"], run["num_rooms_detected"], run["kicked_dog"], run["touched_candle"], run["cont_wall_contact"], run["ramp_hallway"], run["alt_target"], run["all_candles"], run["used_versa_valve"], Runs.calculate_run_score(*score_components), robot_id, ) for run in hanley_runs: hanley_robot = robots[1] robot_div = hanley_robot["division"] robot_id = hanley_robot["id"] score_components = ( robot_div, run["level"], run["failed_trial"], run["actual_time"], run["non_air"], run["furniture"], run["arbitrary_start"], run["return_trip"], run["candle_location_mode"], run["stopped_within_circle"], run["signaled_detection"], run["num_rooms_detected"], run["kicked_dog"], run["touched_candle"], run["cont_wall_contact"], run["ramp_hallway"], run["alt_target"], run["all_candles"], ) print "score components:" print (score_components) r.get_registry()["RUNS"].record_run( run["level"], run["failed_trial"], run["actual_time"], run["non_air"], run["furniture"], run["arbitrary_start"], run["return_trip"], run["candle_location_mode"], run["stopped_within_circle"], run["signaled_detection"], run["num_rooms_detected"], run["kicked_dog"], run["touched_candle"], run["cont_wall_contact"], run["ramp_hallway"], run["alt_target"], run["all_candles"], run["used_versa_valve"], Runs.calculate_run_score(*score_components), robot_id, ) for run in spazz_runs: spazz_robot = robots[2] robot_div = spazz_robot["division"] robot_id = spazz_robot["id"] score_components = ( robot_div, run["level"], run["failed_trial"], run["actual_time"], run["non_air"], run["furniture"], run["arbitrary_start"], run["return_trip"], run["candle_location_mode"], run["stopped_within_circle"], run["signaled_detection"], run["num_rooms_detected"], run["kicked_dog"], run["touched_candle"], run["cont_wall_contact"], run["ramp_hallway"], run["alt_target"], run["all_candles"], ) r.get_registry()["RUNS"].record_run( run["level"], run["failed_trial"], run["actual_time"], run["non_air"], run["furniture"], run["arbitrary_start"], run["return_trip"], run["candle_location_mode"], run["stopped_within_circle"], run["signaled_detection"], run["num_rooms_detected"], run["kicked_dog"], run["touched_candle"], run["cont_wall_contact"], run["ramp_hallway"], run["alt_target"], run["all_candles"], run["used_versa_valve"], Runs.calculate_run_score(*score_components), robot_id, )
'stopped_within_30': False, 'furniture': False }, { 'robot_id': 's_34', 'name': "", 'wall_contact_cms': '0', 'level': 2L, 'arbitrary_start': False, 'touched_candle': '1', 'no_candle_circle': True, 'return_trip': False, 'baby_relocated': False, 'seconds_to_put_out_candle_1': '600', 'seconds_to_put_out_candle_2': '600', 'all_candles': False, 'versa_valve_used': False, 'kicked_dog': False, 'non_air': True, 'run_disqualified': True, 'ramp_used': False, 'candle_detected': False, 'number_of_rooms_searched': '4', 'stopped_within_30': False, 'furniture': False }] if __name__ == '__main__': load_registry() for run in runs: add_run(run['robot_id'], run)
def run(): load_registry() division_map = { 'fire fighting high school division': 'high_school', 'fire fighting junior division': 'junior', 'fire fighting senior division': 'senior', 'fire fighting walking division': 'walking' } unique_map = { 'unique': True, 'customized': False, 'i am not sure': False } versa_valve_map = { 'yes': True, 'no': False } fields_index = { 'division': 3, 'name': 4, 'unique': 5, 'versa_valve': 6, 'school': 7 } with open('robot_list.csv', 'rb') as csvfile: spamreader = csv.reader(csvfile) i = 0 id_counter = { 'high_school': 1, 'senior': 1, 'walking': 1, 'junior': 1 } for row in spamreader: if i == 0: i += 1 continue i += 1 d = {} if row[fields_index['unique']].strip().lower() == ( 'i am not sure, please contact me to discuss'): continue for field, index in fields_index.iteritems(): if field == 'division': d[field] = division_map[row[index].strip().lower()] elif field == 'unique': d[field] = unique_map[row[index].strip().lower()] elif field == 'versa_valve': d[field] = versa_valve_map[row[index].strip().lower()] else: d[field] = row[index] d['id'] = get_id(id_counter, d) r.get_registry()['ROBOTS'].record_robot( division=d['division'], id=d['id'], volume=0, school=d['school'], name=d['name'], is_unique=d['unique'], used_versa_valve=d['versa_valve'], level=1, is_disqualified=False, passed_inspection=False )
def run(): load_registry() robots = [{ 'division': 'junior', 'id': 'test-1', 'volume': 365, 'school': 'Test', 'name': 'Jazz', 'is_unique': True, 'used_versa_valve': False, 'level': 1, 'is_disqualified': False, 'passed_inspection': False }, { 'division': 'high_school', 'id': 'test-2', 'volume': 345, 'school': 'Test', 'name': 'Hanley', 'is_unique': True, 'used_versa_valve': False, 'level': 1, 'is_disqualified': False, 'passed_inspection': False }, { 'division': 'senior', 'id': 'test-3', 'volume': 345, 'school': 'Test', 'name': 'Spazz', 'is_unique': True, 'used_versa_valve': False, 'level': 1, 'is_disqualified': False, 'passed_inspection': False }] for data in robots: r.get_registry()['ROBOTS'].record_robot( division=data['division'], id=data['id'], volume=data['volume'], school=data['school'], name=data['name'], is_unique=data['is_unique'], used_versa_valve=data['used_versa_valve'], level=data['level'], is_disqualified=data['is_disqualified'], passed_inspection=data['passed_inspection']) #Values of param for record_run is robot_div, level, # failed_trial, actual_time, reached_time_limit, # non_air, furniture, arbitrary_start, return_trip, # candle_location_mode, stopped_within_circle, # signled_detection, num_rooms_detected, kicked_dog, # touched_candle, cont_wall_contact, ramp_hallway, # alt_target, all_candles, used_versa_valve, score, robot_id #Just using dictionary for clarification jazz_runs = [ { 'level': 1, 'failed_trial': False, 'actual_time': 155.742, 'reached_time_limit': False, 'non_air': False, 'furniture': False, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 2, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 0, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False }, { 'level': 1, 'failed_trial': False, 'actual_time': 132.614, 'reached_time_limit': False, 'non_air': False, 'furniture': False, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': True, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 4, 'kicked_dog': True, 'touched_candle': False, 'cont_wall_contact': 16, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False }, { 'level': 1, 'failed_trial': True, 'actual_time': 340, #Some random number over 3 'reached_time_limit': True, 'non_air': False, 'furniture': False, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 1, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 0, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False }, { 'level': 2, 'failed_trial': False, 'actual_time': 150.304, 'reached_time_limit': False, 'non_air': False, 'furniture': True, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 4, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 3, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False }, { 'level': 3, 'failed_trial': True, 'actual_time': 190, 'reached_time_limit': True, 'non_air': False, 'furniture': True, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 2, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 3, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False } ] hanley_runs = [{ 'level': 1, 'failed_trial': False, 'actual_time': 285.742, 'reached_time_limit': False, 'non_air': False, 'furniture': False, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 2, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 0, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False }, { 'level': 1, 'failed_trial': False, 'actual_time': 39.234, 'reached_time_limit': False, 'non_air': False, 'furniture': False, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': True, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 3, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 8, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False }, { 'level': 2, 'failed_trial': False, 'actual_time': 150.304, 'reached_time_limit': False, 'non_air': False, 'furniture': True, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 4, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 3, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False }, { 'level': 3, 'failed_trial': True, 'actual_time': 450, 'reached_time_limit': False, 'non_air': False, 'furniture': False, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 0, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 0, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False }, { 'level': 3, 'failed_trial': False, 'actual_time': 58.222, 'reached_time_limit': False, 'non_air': False, 'furniture': False, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 2, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 0, 'ramp_hallway': False, 'alt_target': False, 'all_candles': True, 'used_versa_valve': False }] spazz_runs = [{ 'level': 1, 'failed_trial': True, 'actual_time': 285.742, 'reached_time_limit': False, 'non_air': False, 'furniture': False, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 2, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 3, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False }, { 'level': 1, 'failed_trial': False, 'actual_time': 85.641, 'reached_time_limit': False, 'non_air': False, 'furniture': False, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 2, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 0, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False }, { 'level': 1, 'failed_trial': True, 'actual_time': 285.742, 'reached_time_limit': False, 'non_air': False, 'furniture': False, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 2, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 0, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False }, { 'level': 2, 'failed_trial': False, 'actual_time': 187.638, 'reached_time_limit': False, 'non_air': True, 'furniture': True, 'arbitrary_start': True, 'return_trip': True, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 4, 'kicked_dog': True, 'touched_candle': True, 'cont_wall_contact': 0, 'ramp_hallway': False, 'alt_target': False, 'all_candles': False, 'used_versa_valve': False }, { 'level': 3, 'failed_trial': False, 'actual_time': 117, 'reached_time_limit': False, 'non_air': False, 'furniture': True, 'arbitrary_start': False, 'return_trip': False, 'candle_location_mode': False, 'stopped_within_circle': False, 'signaled_detection': False, 'num_rooms_detected': 2, 'kicked_dog': False, 'touched_candle': False, 'cont_wall_contact': 0, 'ramp_hallway': True, 'alt_target': True, 'all_candles': True, 'used_versa_valve': False }] for run in jazz_runs: jazz_robot = robots[0] robot_div = jazz_robot['division'] robot_id = jazz_robot['id'] score_components = (robot_div, run['level'], run['failed_trial'], run['actual_time'], run['non_air'], run['furniture'], run['arbitrary_start'], run['return_trip'], run['candle_location_mode'], run['stopped_within_circle'], run['signaled_detection'], run['num_rooms_detected'], run['kicked_dog'], run['touched_candle'], run['cont_wall_contact'], run['ramp_hallway'], run['alt_target'], run['all_candles']) r.get_registry()['RUNS'].record_run( run['level'], run['failed_trial'], run['actual_time'], run['non_air'], run['furniture'], run['arbitrary_start'], run['return_trip'], run['candle_location_mode'], run['stopped_within_circle'], run['signaled_detection'], run['num_rooms_detected'], run['kicked_dog'], run['touched_candle'], run['cont_wall_contact'], run['ramp_hallway'], run['alt_target'], run['all_candles'], run['used_versa_valve'], Runs.calculate_run_score(*score_components), robot_id) for run in hanley_runs: hanley_robot = robots[1] robot_div = hanley_robot['division'] robot_id = hanley_robot['id'] score_components = (robot_div, run['level'], run['failed_trial'], run['actual_time'], run['non_air'], run['furniture'], run['arbitrary_start'], run['return_trip'], run['candle_location_mode'], run['stopped_within_circle'], run['signaled_detection'], run['num_rooms_detected'], run['kicked_dog'], run['touched_candle'], run['cont_wall_contact'], run['ramp_hallway'], run['alt_target'], run['all_candles']) print "score components:" print(score_components) r.get_registry()['RUNS'].record_run( run['level'], run['failed_trial'], run['actual_time'], run['non_air'], run['furniture'], run['arbitrary_start'], run['return_trip'], run['candle_location_mode'], run['stopped_within_circle'], run['signaled_detection'], run['num_rooms_detected'], run['kicked_dog'], run['touched_candle'], run['cont_wall_contact'], run['ramp_hallway'], run['alt_target'], run['all_candles'], run['used_versa_valve'], Runs.calculate_run_score(*score_components), robot_id) for run in spazz_runs: spazz_robot = robots[2] robot_div = spazz_robot['division'] robot_id = spazz_robot['id'] score_components = (robot_div, run['level'], run['failed_trial'], run['actual_time'], run['non_air'], run['furniture'], run['arbitrary_start'], run['return_trip'], run['candle_location_mode'], run['stopped_within_circle'], run['signaled_detection'], run['num_rooms_detected'], run['kicked_dog'], run['touched_candle'], run['cont_wall_contact'], run['ramp_hallway'], run['alt_target'], run['all_candles']) r.get_registry()['RUNS'].record_run( run['level'], run['failed_trial'], run['actual_time'], run['non_air'], run['furniture'], run['arbitrary_start'], run['return_trip'], run['candle_location_mode'], run['stopped_within_circle'], run['signaled_detection'], run['num_rooms_detected'], run['kicked_dog'], run['touched_candle'], run['cont_wall_contact'], run['ramp_hallway'], run['alt_target'], run['all_candles'], run['used_versa_valve'], Runs.calculate_run_score(*score_components), robot_id)
# -*- coding: utf-8 -*- import os import logging from datetime import datetime import hashlib from initialize_registry import load_registry from flask import Flask, request from werkzeug.wsgi import SharedDataMiddleware from libraries.sentry_client import SentryClient load_registry() app = Flask('robotics_scoring_system') app.debug = True app.secret_key = '9dBrJXZMW8E44yfODtLuxp5f0Yz2cFfPfUe2Cs2n' APP_NAME = 'robotics_scoring_system' app.config.update( APP_SESSION_NAME='robotics_scoring_system', SENTRY_DSN= 'https://*****:*****@app.getsentry.com/60618' ) SentryClient.init_flask(app) if app.config.get('ENV') == 'development': cacheStatic = False else: cacheStatic = True app.wsgi_app = SharedDataMiddleware(