You need to sign in or sign up before continuing.
Commit 491bda31 authored by Kento HASEGAWA's avatar Kento HASEGAWA

Add filling rates and highlights to the problem list

parent 8d492bac
...@@ -37,11 +37,22 @@ body{ ...@@ -37,11 +37,22 @@ body{
#problem-list-container tr.problem-row.q-selected{ #problem-list-container tr.problem-row.q-selected{
background-color: rgba(200, 100, 100, .3); background-color: rgba(200, 100, 100, .3);
border: 2px solid #888;
} }
#problem-list-container tr.problem-row:hover{ #problem-list-container tr.problem-row:hover{
background-color: rgba(200, 100, 100, .15); background-color: rgba(200, 100, 100, .15);
} }
#problem-list-container tr.problem-row.solution-tried{
background-color: rgba(200, 200, 100, 0.3);
}
#problem-list-container tr.problem-row.solution-solved{
background-color: rgba(100, 200, 200, 0.3);
}
#problem-list-container tr.problem-row.solution-saved{
background-color: rgba(100, 200, 100, 0.3);
}
#client-control-pane{ #client-control-pane{
height: calc(100vh - 20px); height: calc(100vh - 20px);
overflow-y: scroll; overflow-y: scroll;
......
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
{% set tr_class = '' %} {% set tr_class = '' %}
{% set tr_class = tr_class + ' submit-solution' if k == problem.best_solution else '' %} {% 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 '' %} {% set tr_class = tr_class + ' valid-solution' if v.is_valid_solution() else '' %}
{#% else %#}
<tr class="solution-detail-row {{tr_class}}" data-solution-id="{{k}}" data-problem="{{problem.name}}"> <tr class="solution-detail-row {{tr_class}}" data-solution-id="{{k}}" data-problem="{{problem.name}}">
{#% endif %#}
<td>{{v.timestamp_str}}</td> <td>{{v.timestamp_str}}</td>
<td>{{v.worker}}</td> <td>{{v.worker}}</td>
<td> <td>
......
...@@ -12,10 +12,18 @@ ...@@ -12,10 +12,18 @@
</thead> </thead>
<tbody> <tbody>
{% for k, v in problems.items() %} {% for k, v in problems.items() %}
<tr class="problem-row" data-problem="{{v.name}}"> {% set tr_class = '' %}
{% if v.status == 'Saved' %}
{% set tr_class = 'solution-saved' %}
{% elif v.status.startswith('Solved') %}
{% set tr_class = 'solution-solved' %}
{% elif v.status.startswith('Tried') %}
{% set tr_class = 'solution-tried' %}
{% endif %}
<tr class="problem-row {{tr_class}}" data-problem="{{v.name}}">
<td class="large-cell">{{v.name}}</td> <td class="large-cell">{{v.name}}</td>
<td class="small-cell"> <td class="small-cell">
{{v.size_str}}<br /> {{v.size_str}} [{{'{:,.1f}%'.format(v.filling_rate * 100)}}]<br />
{{v.block_num}} / {{v.block_num}} /
{{v.line_numbers | length - 1}} / {{v.line_numbers | length - 1}} /
{{v.block_groups | length}} {{v.block_groups | length}}
......
...@@ -15,8 +15,8 @@ class Problem(object): ...@@ -15,8 +15,8 @@ class Problem(object):
self.size = (0, 0) self.size = (0, 0)
self.block_num = 0 self.block_num = 0
self.blocks = dict() self.blocks = dict()
self.tile_num = 0
self.problem = '' self.problem = ''
# self.status = 'Ready'
self.solutions = dict() self.solutions = dict()
self.solution_path = solution_path self.solution_path = solution_path
self.best_solution = None self.best_solution = None
...@@ -29,6 +29,17 @@ class Problem(object): ...@@ -29,6 +29,17 @@ class Problem(object):
@property @property
def size_str(self): def size_str(self):
return f'{self.size[0]}X{self.size[1]}' return f'{self.size[0]}X{self.size[1]}'
@property
def board_area(self):
return self.size[0] * self.size[1]
@property
def filling_rate(self):
if self.board_area == 0:
return 0
else:
return self.tile_num / self.board_area
@property @property
def problem_text(self): def problem_text(self):
...@@ -91,6 +102,8 @@ class Problem(object): ...@@ -91,6 +102,8 @@ class Problem(object):
block_num = 0 block_num = 0
blocks = dict() blocks = dict()
tile_num = 0
def intplus(v): def intplus(v):
if v.isdecimal(): if v.isdecimal():
return int(v) return int(v)
...@@ -133,6 +146,7 @@ class Problem(object): ...@@ -133,6 +146,7 @@ class Problem(object):
if not _line_num in line_number_list: if not _line_num in line_number_list:
line_number_list.append(_line_num) line_number_list.append(_line_num)
# _line_num = line_number_list.index(_line_num) # _line_num = line_number_list.index(_line_num)
tile_num += 1
# Make connection list # Make connection list
if not bi in block_to_line: if not bi in block_to_line:
...@@ -152,6 +166,7 @@ class Problem(object): ...@@ -152,6 +166,7 @@ class Problem(object):
self.size = board_size self.size = board_size
self.block_num = block_num self.block_num = block_num
self.blocks = blocks self.blocks = blocks
self.tile_num = tile_num
self.name = name self.name = name
self.problem = q_text self.problem = q_text
self.line_numbers = line_number_list self.line_numbers = line_number_list
......
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