diff --git a/static/css/adc2019.css b/static/css/adc2019.css index 078db367f6e6f66f1088f723a76208eea38f28e4..db78001dfae6f1b421f40b15bba1646748c34eaa 100644 --- a/static/css/adc2019.css +++ b/static/css/adc2019.css @@ -37,11 +37,22 @@ body{ #problem-list-container tr.problem-row.q-selected{ background-color: rgba(200, 100, 100, .3); + border: 2px solid #888; } #problem-list-container tr.problem-row:hover{ 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{ height: calc(100vh - 20px); overflow-y: scroll; diff --git a/templates/part_problem_status.html b/templates/part_problem_status.html index 8aa0c245c4a179a283f493a342969e38163dd7b5..89ebf3e1a16b27a26d50672de1bd4c3b05efcd40 100644 --- a/templates/part_problem_status.html +++ b/templates/part_problem_status.html @@ -25,9 +25,7 @@ {% 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 '' %} - {#% else %#} - {#% endif %#} {{v.timestamp_str}} {{v.worker}} diff --git a/templates/part_problems.html b/templates/part_problems.html index 3de937c8420a1905546f5a21818498727ea3613e..c44b4c1ea6f427e52d78857fd507f5a1535acb7f 100644 --- a/templates/part_problems.html +++ b/templates/part_problems.html @@ -12,10 +12,18 @@ {% for k, v in problems.items() %} - + {% 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 %} + {{v.name}} - {{v.size_str}}
+ {{v.size_str}} [{{'{:,.1f}%'.format(v.filling_rate * 100)}}]
{{v.block_num}} / {{v.line_numbers | length - 1}} / {{v.block_groups | length}} diff --git a/utils/data.py b/utils/data.py index 1ffec028b171009130b14d14dd4eda80f416a114..177f51777bd302c1d5d6813acb93e4086fe8f2cd 100644 --- a/utils/data.py +++ b/utils/data.py @@ -15,8 +15,8 @@ class Problem(object): self.size = (0, 0) self.block_num = 0 self.blocks = dict() + self.tile_num = 0 self.problem = '' - # self.status = 'Ready' self.solutions = dict() self.solution_path = solution_path self.best_solution = None @@ -29,6 +29,17 @@ class Problem(object): @property def size_str(self): 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 def problem_text(self): @@ -91,6 +102,8 @@ class Problem(object): block_num = 0 blocks = dict() + tile_num = 0 + def intplus(v): if v.isdecimal(): return int(v) @@ -133,6 +146,7 @@ class Problem(object): if not _line_num in line_number_list: line_number_list.append(_line_num) # _line_num = line_number_list.index(_line_num) + tile_num += 1 # Make connection list if not bi in block_to_line: @@ -152,6 +166,7 @@ class Problem(object): self.size = board_size self.block_num = block_num self.blocks = blocks + self.tile_num = tile_num self.name = name self.problem = q_text self.line_numbers = line_number_list