Commit 69c61700 authored by Kento HASEGAWA's avatar Kento HASEGAWA

Improve refresh method of the problem status view

parent 0f95798b
......@@ -44,11 +44,17 @@ def webui_part_solver_status():
else:
return abort(404)
@webui.route('/part/request/<problem_name>')
def webui_part_request_status(problem_name=None):
# @webui.route('/part/request/<problem_name>')
@webui.route('/part/problem_status/<problem_name>')
def webui_part_problem_status_list(problem_name=None):
if (adc2019system.role is not None) and (adc2019system.role.type == 'host'):
problem = adc2019system.role.get_problem(problem_name)
solutions = reversed(sorted(problem.get_solutions().items(), key=lambda x:x[1].timestamp))
request_status = adc2019system.role.get_request_by_problem(problem_name)
return render_template('part_request_status.html', status=request_status)
if problem is None:
return abort(404)
else:
return render_template('part_problem_status_list.html', problem=problem, solutions=solutions, status=request_status)
else:
return abort(404)
......@@ -61,31 +67,13 @@ def webui_part_problem_status(name=None):
if (adc2019system.role is not None) and (adc2019system.role.type == 'host'):
problem = adc2019system.role.get_problem(name)
workers = adc2019system.role.get_workers()
# solutions = reversed(sorted(problem.get_solutions().items(), key=lambda x:x[1].timestamp))
if problem is None:
return abort(404)
else:
# return render_template('part_problem_status.html', problem=problem, workers=workers, solutions=solutions)
return render_template('part_problem_status.html', problem=problem, workers=workers)
else:
return abort(404)
@webui.route('/part/problem_solution/<name>')
def webui_part_solution_status(name=None):
if name is None:
return abort(404)
if (adc2019system.role is not None) and (adc2019system.role.type == 'host'):
problem = adc2019system.role.get_problem(name)
solutions = reversed(sorted(problem.get_solutions().items(), key=lambda x:x[1].timestamp))
if problem is None:
return abort(404)
else:
return render_template('part_solution_status.html', problem=problem, solutions=solutions)
else:
return abort(404)
@webui.route('/api/<path:cmd>', methods=['GET', 'POST'])
def webui_api(cmd=None):
......
......@@ -404,7 +404,8 @@ class Request(object):
def set_running(self):
self.is_processed = True
self.start_time = time.time()
if self.start_time is None:
self.start_time = time.time()
def store_response(self, data):
# worker = data['worker']
......
......@@ -168,22 +168,23 @@ class StatusView {
update_status_view(){
var _this = this;
$.ajax({
type: 'GET',
dataType: 'html',
url: '/part/request/' + _this.problem_key
}).done((d) => {
_this.container.find('#request-table-container').empty();
_this.container.find('#request-table-container').html(d);
var solvers = new Array();
_this.container.find('#solver-list-table-wrapper .chk-solver:checked').each((i, el) => {
var _val = $(el).val();
solvers.push(_val);
});
console.log(solvers);
$.ajax({
type: 'GET',
dataType: 'html',
url: '/part/problem_solution/' + _this.problem_key
url: '/part/problem_status/' + _this.problem_key
}).done((d) => {
_this.container.find('#solution-table-container').empty();
_this.container.find('#solution-table-container').html(d);
_this.container.find('#problem-status-list-container').empty();
_this.container.find('#problem-status-list-container').html(d);
_this.container.find('.solution-detail-row.valid-solution td').click((e) => {
var solution_id = $(e.target).parent("tr").data("solution-id");
......
......@@ -47,18 +47,7 @@
</div>
</div>
<div id="request-list-container">
<h4>リクエスト一覧</h4>
<div id="request-table-container">
</div>
</div>
<div id='solution-list-container'>
<h4>処理結果一覧</h4>
<div id="solution-table-container">
</div>
<div id="problem-status-list-container">
</div>
</div>
<div id="request-list-container">
<h4>リクエスト一覧</h4>
<div id="request-table-container">
<table class="table table-bordered table-sm">
<tbody>
{% for r in status %}
<tr>
<td>{{r['worker']}}</td>
<td>{{r['status']}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div id='solution-list-container'>
<h4>処理結果一覧</h4>
<div id="solution-table-container">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Timestamp</th>
<th>Client</th>
<th>Score</th>
</tr>
</thead>
<tbody>
{% for k, v in solutions %}
{% set tr_class = '' %}
{% set tr_class = tr_class + ' submit-solution' if k == problem.best_solution else '' %}
{% set tr_class = tr_class + ' valid-solution' if v.is_valid_solution() else '' %}
<tr class="solution-detail-row {{tr_class}}" data-solution-id="{{k}}" data-problem="{{problem.name}}">
<td>{{v.timestamp_str}}</td>
<td>{{v.worker}}</td>
<td>
{% if v.is_valid_solution() %}
{{v.score}} ({{v.size_str}})
{% else %}
{{v.status}}
{% endif %}
{{v.nlcheck}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div>
<table class="table table-bordered table-sm">
<tbody>
{% for r in status %}
<tr>
<td>{{r['worker']}}</td>
<td>{{r['status']}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment