Skip to content

Commit

Permalink
Merge pull request #103 from chibiegg/feat/pre
Browse files Browse the repository at this point in the history
本戦に関する修正
  • Loading branch information
chibiegg authored Sep 25, 2019
2 parents 6fe0aef + 0b2129c commit 11867e2
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 53 deletions.
7 changes: 2 additions & 5 deletions isucon/portal/contest/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from isucon.portal.authentication.models import Team, User
from isucon.portal.contest.models import Server

alibaba_account_validator = RegexValidator(r'^\d{16}$', "Invalid Account ID Format")

def global_ip_validator(value):
try:
address = ipaddress.ip_address(value)
Expand All @@ -31,15 +29,14 @@ def private_ip_validator(value):
class TeamForm(forms.ModelForm):
class Meta:
model = Team
fields = ("name", "participate_at", "alibaba_account", )
fields = ("name", "participate_at", )

participate_at = forms.DateField(
label="参加日選択",
input_formats=["%Y-%m-%d"],
widget=forms.Select(choices=Team.PARTICIPATE_AT_CHOICES),
required=True,
)
alibaba_account = forms.CharField(required=False, validators=[alibaba_account_validator], )

def __init__(self, *args, **kwargs):
self.is_registration_available = is_registration_available()
Expand Down Expand Up @@ -112,7 +109,7 @@ def __init__(self, *args, **kwargs):

def clean(self):
cleaned_data = super().clean()

if Server.objects.filter(team=self.team).count() >= 3:
raise forms.ValidationError("すでに3台登録されています")

Expand Down
8 changes: 4 additions & 4 deletions isucon/portal/contest/result/templates/result/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<th>Rank</th>
<th>Id</th>
<th>Name</th>
<th>Latest Total transaction [ISUCOIN]</th>
<th>Best Total transaction [ISUCOIN]</th>
<th>Latest Score</th>
<th>Best Score</th>
<th>FinishTime</th>
</tr>
</thead>
Expand All @@ -43,8 +43,8 @@
<td class="has-text-right">{{ forloop.counter }}</td>
<td class="has-text-right">{{ score.team.id }}</td>
<td>{{ score.team }}</td>
<td class="has-text-right">{{ score.latest_score|intcomma }} イスコイン</td>
<td class="has-text-right">{{ score.best_score|intcomma }} イスコイン</td>
<td class="has-text-right">{{ score.latest_score|intcomma }}</td>
<td class="has-text-right">{{ score.best_score|intcomma }}</td>
<td>{{ score.latest_scored_at|date:"H:i:s" }}</td>
</tr>
{% endfor %}
Expand Down
8 changes: 4 additions & 4 deletions isucon/portal/contest/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
<th>Rank</th>
<th>Id</th>
<th>Name</th>
<th>Latest Total transaction [ISUCOIN]</th>
<th>Best Total transaction [ISUCOIN]</th>
<th>Latest Score</th>
<th>Best Score</th>
<th>FinishTime</th>
</tr>
</thead>
Expand All @@ -54,8 +54,8 @@
<td class="has-text-right">{{ forloop.counter }}</td>
<td class="has-text-right">{{ score.team.id }}</td>
<td>{{ score.team }}</td>
<td class="has-text-right">{{ score.latest_score|intcomma }} イスコイン</td>
<td class="has-text-right">{{ score.best_score|intcomma }} イスコイン</td>
<td class="has-text-right">{{ score.latest_score|intcomma }}</td>
<td class="has-text-right">{{ score.best_score|intcomma }}</td>
<td>{{ score.latest_scored_at|date:"H:i:s" }}</td>
</tr>
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions isucon/portal/contest/templates/includes/job_detail_part.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
<td>{{ job.target_ip }}</td>
</tr>
<tr>
<th width="10%">Total transaction [ISUCOIN]</th>
<th width="10%">Total Score</th>
<td>
{% if job.is_finished %}
{{ job.score|intcomma }} イスコイン
{{ job.score|intcomma }}
{% endif %}
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions isucon/portal/contest/templates/jobs.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<th>Lang</th>
{% endif %}
<th>JobId</th>
<th>Total transaction [ISUCOIN]</th>
<th>Total Score</th>
<th>Status</th>
<th>Result</th>
<th>UpdatedAt</th>
Expand All @@ -53,7 +53,7 @@
<td class="has-text-right">{{ job.id }}</td>
<td class="has-text-right">
{% if job.is_finished %}
{{ job.score|intcomma }} イスコイン
{{ job.score|intcomma }}
{% endif %}
</td>
<td>
Expand Down
14 changes: 7 additions & 7 deletions isucon/portal/contest/templates/scores.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
<th>Rank</th>
<th>Id</th>
<th>Name</th>
<th>Latest Total transaction [ISUCOIN]</th>
<th>Latest Total Score</th>
<th>Time</th>
<th>Best Total transaction [ISUCOIN]</th>
<th>Best Total Score</th>
<th>Time</th>
</tr>
</thead>
Expand All @@ -49,9 +49,9 @@
<td class="has-text-right">{{ forloop.counter }}</td>
<td class="has-text-right">{{ score.team.id }}</td>
<td>{{ score.team }}</td>
<td class="has-text-right">{{ score.latest_score|intcomma }} イスコイン</td>
<td class="has-text-right">{{ score.latest_score|intcomma }}</td>
<td>{{ score.latest_scored_at|date:"H:i:s" }}</td>
<td class="has-text-right">{{ score.best_score|intcomma }} イスコイン</td>
<td class="has-text-right">{{ score.best_score|intcomma }}</td>
<td>{{ score.best_scored_at|date:"H:i:s" }}</td>
</tr>
{% endfor %}
Expand All @@ -60,9 +60,9 @@
<td class="has-text-right">-</td>
<td class="has-text-right">{{ score.team.id }}</td>
<td>{{ score.team }}</td>
<td class="has-text-right">{{ score.latest_score|intcomma }} イスコイン</td>
<td class="has-text-right">{{ score.latest_score|intcomma }}</td>
<td>{{ score.latest_scored_at|date:"H:i:s" }}</td>
<td class="has-text-right">{{ score.best_score|intcomma }} イスコイン</td>
<td class="has-text-right">{{ score.best_score|intcomma }}</td>
<td>{{ score.best_scored_at|date:"H:i:s" }}</td>
</tr>
{% endfor %}
Expand All @@ -87,4 +87,4 @@
}
</script>
{% endif %}
{% endblock script %}
{% endblock script %}
20 changes: 0 additions & 20 deletions isucon/portal/contest/templates/team_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,6 @@ <h1 class="title">Information</h1>
</div>
{% endif %}

{% if is_registration_available and not is_now_on_contest %}
{{ form.alibaba_account.as_hidden }}
{% else %}
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Alibaba Cloud Account ID</label>
</div>
<div class="field-body">
<div class="field">
<p class="control">
{{ form.alibaba_account|add_class:"input" }}
</p>
{% if form.alibaba_account.errors %}
<p class="help is-danger">{{ form.alibaba_account.errors.0 }}</p>
{% endif %}
</div>

</div>
</div>
{% endif %}

<button type="submit" class="button is-primary">保存</button>

Expand Down
9 changes: 0 additions & 9 deletions isucon/portal/templates/include/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,6 @@
</article>
{% endfor %}


{% if user.team and not user.team.alibaba_account and not is_registration_available %}
<article class="message is-warning">
<div class="message-body">
Alibaba CloudのAccount IDが設定されていません。<a href="{% url "team_settings" %}">Team Settings</a>から設定してください。
</div>
</article>
{% endif %}

{% if user.team and is_now_on_contest and servers.count == 0 %}
<article class="message is-warning">
<div class="message-body">
Expand Down

0 comments on commit 11867e2

Please sign in to comment.