Commit 491bda31 authored by Kento HASEGAWA's avatar Kento HASEGAWA
Browse files

Add filling rates and highlights to the problem list

parent 8d492bac
Loading
Loading
Loading
Loading
+11 −0
Changes for static/css/adc2019.css: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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;
+0 −2
Changes for templates/part_problem_status.html: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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 %#}
            <tr class="solution-detail-row {{tr_class}}" data-solution-id="{{k}}" data-problem="{{problem.name}}">
            {#% endif %#}
                <td>{{v.timestamp_str}}</td>
                <td>{{v.worker}}</td>
                <td>
+10 −2
Changes for templates/part_problems.html: 10 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -12,10 +12,18 @@
    </thead>
    <tbody>
        {% 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="small-cell">
                {{v.size_str}}<br />
                {{v.size_str}} [{{'{:,.1f}%'.format(v.filling_rate * 100)}}]<br />
                {{v.block_num}} /
                {{v.line_numbers | length - 1}} /
                {{v.block_groups | length}}
+16 −1
Changes for utils/data.py: 16 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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
@@ -30,6 +30,17 @@ class Problem(object):
    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