Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions libraries/repositories/runs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# -*- coding: utf-8; -*-

import registry as r
import json
import logging

logger = logging.getLogger('run.data')

fh = logging.FileHandler('run_logs.log')
fh.setLevel(logging.INFO)

FORMAT = "%(message)s"
logging.basicConfig(format=FORMAT, level=logging.INFO)

logger.addHandler(fh)

class Runs(object):
@staticmethod
Expand Down Expand Up @@ -137,6 +149,12 @@ def record_run(level,
}
r.get_registry()['MY_SQL'].insert(query, data)

json_data = {}

json_data[robot_id] = data

logger.info(json.dumps(json_data))

@staticmethod
def get_runs_robot_level(robot_id, level):
query = """SELECT * FROM runs where (robot_id = %(robot_id)s) AND (level = level);"""
Expand Down
19 changes: 10 additions & 9 deletions scoringsystem/blueprints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
)
main = Blueprint('main', __name__)


@main.before_request
def require_login():
if not AuthenticationUtilities.user_is_logged_in(session):
return redirect(url_for('auth.signin'))
#@main.before_request
#def require_login():
# if not AuthenticationUtilities.user_is_logged_in(session):
# return redirect(url_for('auth.signin'))


@main.route('/', methods=['GET', 'POST'])
Expand Down Expand Up @@ -421,9 +420,10 @@ def validate_actual_time_compare(time_j1, time_j2):
time_j1 = time_j1.strip()
time_j2 = time_j2.strip()

if time_j1.isdigit() and time_j2.isdigit():
try:
return float(time_j1) == float(time_j2)
return False
except ValueError:
return False

# valide actual time
def validate_actual_time(time_s, level, failed):
Expand All @@ -443,7 +443,6 @@ def validate_actual_time(time_s, level, failed):
picked_baby_3 = 400 # failed but picked up baby (level 3)

# check if input string is a number


# convet to a float
try:
Expand Down Expand Up @@ -483,7 +482,9 @@ def validate_actual_time(time_s, level, failed):
# validate number of rooms
def validate_num_rooms(num_s, level):

num_s = num_s.strip()
if num_s:
num_s = num_s.strip()

# minimum and maximum allowed values
min_123 = 0
max_123 = 4
Expand Down
2 changes: 1 addition & 1 deletion templates/robot_run_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h4>Previous Runs</h4>
{% for run in robot_runs %}
<tr>
<td>{{ loop.index }}</td>
<td>{{ "Falied" if run.get('failed_trial') == 1 else "Succeeded" }}</td>
<td>{{ "Failed" if run.get('failed_trial') == 1 else "Succeeded" }}</td>
<td>{{ run.get('level') }}</td>
<td>{{ run.get('actual_time') if run.get('failed_trial') == 0 or run in [400,450,500] else 600}}</td>
<td class="fixed-columns">{{ applied_factors[loop.index - 1].get('applied_oms') }}</td>
Expand Down