-
+
{% with division=statistic.addition.division %}
{% with n_total=contest.info.problems.n_statistics|get_item:division|default:contest.n_statistics %}
{% if n_total and statistic.place_as_int %}
@@ -48,33 +48,20 @@
- {% with value=resource|get_new_rating_value:statistic.addition %}
- {% if value is not None %}
-
- {% coder_color_circle resource value %}
- {{ value }}
-
+ {% with rating_value=resource|get_new_rating_value:statistic.addition %}
+ {% if rating_value is not None %}
+
+ {% coder_color_circle resource rating_value %}
+ {{ rating_value }}
+
{% else %}
·
{% endif %}
- {% endwith %}
-
-
- {% with value=statistic.addition.rating_change %}
- {% with intvalue=value|toint %}
- {% if intvalue or 'rating_change' in statistic.addition %}
-
- {% if intvalue %}
- {{ intvalue|abs }}
- {% else %}
- {{ value }}
- {% endif %}
-
- {% else %}
- ·
+
+ {% if 'rating_change' in statistic.addition %}
+ {% rating_change_template statistic.addition.rating_change %}
{% endif %}
{% endwith %}
- {% endwith %}
{% if coder.has_global_rating %}
@@ -83,22 +70,9 @@
{% else %}
·
{% endif %}
-
-
+
{% if statistic.global_rating_change is not None %}
- {% with value=statistic.global_rating_change %}
- {% with intvalue=value|toint %}
-
- {% if intvalue %}
- {{ intvalue|abs }}
- {% else %}
- {{ value }}
- {% endif %}
-
- {% endwith %}
- {% endwith %}
- {% else %}
- ·
+ {% rating_change_template statistic.global_rating_change %}
{% endif %}
{% endif %}
@@ -118,8 +92,9 @@
{% endfor %}
{% endwith %}
{% endif %}
-
+
+
{% if contest.invisible %} {% endif %}
{{ contest.title }}
{% if statistic.addition.hack %}
@@ -129,26 +104,26 @@
{% endwith %}
{% endif %}
-
- {% if 'problems' in statistic.addition %}
- {% if contest.info.problems %}
- {% for problem in contest|get_division_problems:statistic.addition %}
- {% with key=problem|get_problem_short %}
- {% with stat=statistic.addition.problems|get_item:key %}
- {% include 'problem_stat.html' with short=problem|get_problem_header name=problem|get_problem_name stat=stat problem_url=problem.url full_score=problem.full_score %}
- {% endwith %}
- {% endwith %}
- {% endfor %}
- {% else %}
- {% for k, v in statistic.addition.problems.items|sort %}
- {% include 'problem_stat.html' with short=k name=k stat=v problem_url=None full_score=None %}
- {% endfor %}
- {% endif %}
- {% endif %}
-
{% if contest.has_submissions %}
- {% icon_to "submissions" %}
+ {% icon_to "submissions" %}
{% endif %}
+
+ {% with problems=statistic.addition.problems %}
+ {% if contest.info.problems %}
+ {% for problem in contest|get_division_problems:statistic.addition %}
+ {% with key=problem|get_problem_short %}
+ {% with stat=problems|get_item:key %}
+ {% include 'problem_stat.html' with short=problem|get_problem_header name=problem|get_problem_name stat=stat problem_url=problem.url full_score=problem.full_score %}
+ {% endwith %}
+ {% endwith %}
+ {% endfor %}
+ {% elif problems %}
+ {% for k, v in problems.items|sort %}
+ {% include 'problem_stat.html' with short=k name=k stat=v problem_url=None full_score=None %}
+ {% endfor %}
+ {% endif %}
+ {% endwith %}
+
{% if perms.ranking.change_statistics %}
{% endif %}
diff --git a/src/templates/standings.html b/src/templates/standings.html
index c2dd1da1..9873335b 100644
--- a/src/templates/standings.html
+++ b/src/templates/standings.html
@@ -99,6 +99,9 @@
{{ contest.title }}
+
+ {% with shown_kind=contest.shown_kind %}{% if shown_kind %}{% label_tag shown_kind %}{% endif %}{% endwith %}
+
{% if favorite_contests %}{% activity_action "fav" contest %}{% endif %}
diff --git a/src/templates/standings_filters.html b/src/templates/standings_filters.html
index 4fbe33e5..2e59b9bf 100644
--- a/src/templates/standings_filters.html
+++ b/src/templates/standings_filters.html
@@ -205,20 +205,25 @@
{% if timeline != 'show' %}
shuffle_statistics_rows()
{% endif %}
+
show_timeline()
- {% if timeline == 'play' or 'play' in request.GET %}
- {% if timeline == 'play' or not timeline %}
- $('#fast-backward-timeline').click()
- {% else %}
- set_timeline({{ timeline|asfloat }})
+
+ {% if request.GET.unfreezing|is_yes %}
+ $('#unfreezing-timeline').click()
{% endif %}
- $('#play-timeline').click()
- {% elif timeline == 'unfreezing' %}
- $('#unfreezing-timeline').click()
+
+ {% if timeline == 'play' or 'play' in request.GET %}
+ {% if timeline == 'play' or not timeline %}
+ $('#fast-backward-timeline').click()
+ {% else %}
+ set_timeline({{ timeline|asfloat }})
+ {% endif %}
+ $('#play-timeline').click()
{% elif timeline|asfloat is not None %}
- CURRENT_PERCENT = null
- set_timeline({{ timeline|asfloat }})
+ CURRENT_PERCENT = null
+ set_timeline({{ timeline|asfloat }})
{% endif %}
+
visible_standings()
})
{% endif %}
diff --git a/src/templates/standings_list.html b/src/templates/standings_list.html
index 477d7f5b..c658af82 100644
--- a/src/templates/standings_list.html
+++ b/src/templates/standings_list.html
@@ -27,7 +27,8 @@
{% icon_to 'n_participants' %}
{% icon_to 'n_problems' %}
Event
- End Time
+ Rank
+ End Time
{% for more_field in params.more_fields %}
{{ more_field|title_field }}
{% endfor %}
diff --git a/src/templates/standings_list_filters.html b/src/templates/standings_list_filters.html
index dc078f76..f3d0450c 100644
--- a/src/templates/standings_list_filters.html
+++ b/src/templates/standings_list_filters.html
@@ -48,6 +48,13 @@
{% icon_to 'submissions' %}
+ {% if request.GET.with_problems|is_yes %}
+
+ {% endif %}
+
+ {% icon_to 'problems' %}
+
+
{% include 'more_fields_filter.html' %}
{% if params.with_medal_scores %}
diff --git a/src/templates/standings_list_paging.html b/src/templates/standings_list_paging.html
index 5a0fe64b..b4d20ed8 100644
--- a/src/templates/standings_list_paging.html
+++ b/src/templates/standings_list_paging.html
@@ -48,6 +48,8 @@
{% icon_to 'submissions' %}
{% endif %}
+ {% with shown_kind=contest.shown_kind %}{% if shown_kind %}{% label_tag shown_kind status %}{% endif %}{% endwith %}
+
{% if favorite_contests %}{% activity_action "fav" contest %}{% endif %}
{% if contests_groups %}
@@ -58,32 +60,10 @@
{% endwith %}
{% endif %}
- {% for stat in contest.stats %}
-
- {% if stat.place %}
- {% with division=stat.addition|get_item:"division" %}
- Rank {{ stat.place }}{% if contest.n_statistics %} of {{ contest.info.problems.n_statistics|get_item:division|default:contest.n_statistics }}{% endif %}
- {% endwith %}
- {% endif %}
-
- {% with value=stat.addition.rating_change %}
- {% with intvalue=value|toint %}
-
- {% if intvalue %}
- {{ intvalue|abs }}
- {% else %}
- {{ value }}
- {% endif %}
-
- {% endwith %}
- {% endwith %}
-
- {% endfor %}
-
{% include "contest_inline_buttons.html" with contest=contest with_stage=True %}
- {% if 'with_problems' in request.GET %}
-
+ {% if request.GET.with_problems|is_yes %}
+
{% for division, problems in contest.division_problems %}
{% if division %}
@@ -102,18 +82,39 @@
{% trim_to problem|get_problem_short 4 raw_text=True %}
{% if problem.url %}{% endif %}
-
- {% include 'standings_problem_progress.html' with problem=problem contest=contest %}
-
+ {% if problem.n_total %}
+ {% include 'standings_problem_progress.html' with problem=problem contest=contest %}
+ {% endif %}
{% endfor %}
{% endfor %}
-
+
+ {% endif %}
+
+
+ {% for stat in contest.stats %}
+ {% if stat.place %}
+ {% with division=stat.addition|get_item:"division" %}
+ {{ stat.place }}{% if contest.n_statistics %} of {{ contest.info.problems.n_statistics|get_item:division|default:contest.n_statistics }}{% endif %}
+ {% endwith %}
{% endif %}
+
+ {% with value=stat.addition.rating_change %}
+ {% with intvalue=value|toint %}
+
+ {% if intvalue %}
+ {{ intvalue|abs }}
+ {% else %}
+ {{ value }}
+ {% endif %}
+
+ {% endwith %}
+ {% endwith %}
+ {% endfor %}
-
+
{{ contest.end_time|timezone:timezone|naturalday }}
{% for more_field in params.more_fields %}
diff --git a/src/templates/standings_problem_progress.html b/src/templates/standings_problem_progress.html
index 4f1deaeb..33e2a43b 100644
--- a/src/templates/standings_problem_progress.html
+++ b/src/templates/standings_problem_progress.html
@@ -1,12 +1,12 @@
-{% with n_attempts_=problem.n_attempts|default:0 n_statistics_=contest.n_statistics|default:0 %}
-{% with n_accepted=problem.n_accepted|default:0 n_partial=problem.n_partial|default:0 n_hidden=problem.n_hidden|default:0 n_attempts=problem.n_teams|default:n_attempts_ n_statistics=problem.n_total|default:n_statistics_ %}
+{% with n_attempts_=problem.n_attempts|default:0 n_statistics_=contest.n_statistics|default:0 n_accepted_submissions=problem|get_item:"n_accepted_submissions" n_total_submissions=problem|get_item:"n_total_submissions" %}
+{% with n_accepted=problem.n_accepted|default:n_accepted_submissions|default:0 n_partial=problem.n_partial|default:0 n_hidden=problem.n_hidden|default:0 n_attempts=problem.n_teams|default:n_attempts_ n_statistics=problem.n_total|default:n_total_submissions|default:n_statistics_ %}
{% if n_statistics %}
Number of partial: {{ n_partial }} ({{ n_partial|multiply:100|divide:n_statistics|floatformat:"2" }})%){% endif %}
{% if n_hidden %} Number of hidden: {{ n_hidden }} ({{ n_hidden|multiply:100|divide:n_statistics|floatformat:"2" }})%){% endif %}
- {% if n_accepted != n_attempts %} Number of attempts: {{ n_attempts }} ({{ n_attempts|multiply:100|divide:n_statistics|floatformat:"2" }}%){% endif %}
- Total: {{ n_statistics }}
+ {% if n_accepted != n_attempts and n_attempts %} Number of attempts: {{ n_attempts }} ({{ n_attempts|multiply:100|divide:n_statistics|floatformat:"2" }}%){% endif %}
+ Total{% if not problem.n_total and n_total_submissions %} submissions{% endif %}: {{ n_statistics }}
{% if problem.first_ac %} First accepted: {{ problem.first_ac.time }}{% endif %}
" data-toggle="tooltip" data-html="true" data-placement="bottom">
diff --git a/src/true_coders/views.py b/src/true_coders/views.py
index 543811d8..44142bc6 100644
--- a/src/true_coders/views.py
+++ b/src/true_coders/views.py
@@ -161,10 +161,13 @@ def get_profile_context(request, statistics, writers, resources):
).order_by().distinct('contest__resource__host')
kinds_resources = collections.defaultdict(dict)
+ major_kind = None
for stat in rated_stats.union(external_ratings):
resource = stat.contest.resource
kind = stat.contest.kind
- kind = None if resource.is_major_kind(kind) else kind
+ kind = major_kind if resource.is_major_kind(kind) else kind
+ if not kinds_resources[resource.pk]:
+ kinds_resources[resource.pk][major_kind] = None
kinds_resources[resource.pk][kind] = {
'host': resource.host,
'pk': resource.pk,
@@ -173,6 +176,12 @@ def get_profile_context(request, statistics, writers, resources):
}
history_resources = list()
for resource in resources.filter(has_rating_history=True):
+ if (
+ resource.pk in kinds_resources and
+ major_kind in kinds_resources[resource.pk] and
+ not kinds_resources[resource.pk][major_kind]
+ ):
+ kinds_resources[resource.pk].pop(major_kind)
history_resources.extend(kinds_resources[resource.pk].values())
resources = list(resources)
diff --git a/src/utils/proxy_list.py b/src/utils/proxy_list.py
index 454c29ed..d95ec74d 100644
--- a/src/utils/proxy_list.py
+++ b/src/utils/proxy_list.py
@@ -29,6 +29,36 @@ class ProxyList:
def is_proxy(proxy):
return re.match(r'^\d+\.\d+\.\d+\.\d+:\d+$', proxy)
+ @staticmethod
+ def _get_proxy_from_html():
+ urls = [
+ 'https://free-proxy-list.net',
+ 'https://sslproxies.org',
+ ]
+ for url in urls:
+ source = url.split('//')[1].split('/')[0]
+ response = requests.get(url)
+ table = ParsedTable(response.content)
+ table = [{k.lower(): v.value for k, v in row.items()} for row in table]
+ for row in table:
+ if row['https'].lower() in {'true', '1', 't', 'y', 'yes'}:
+ yield Proxy(proxy=f'{row["ip address"]}:{row["port"]}', source=source)
+
+ @staticmethod
+ def _get_proxy_from_json():
+ urls = [
+ ('https://proxylist.geonode.com/api/proxy-list?protocols=http%2Chttps&limit=500&page=1&sort_by=lastChecked&sort_type=desc&speed=medium', 'data'), # noqa
+ ('https://api.proxyscrape.com/v3/free-proxy-list/get?request=displayproxies&protocol=http&proxy_format=ipport&format=json&timeout=500', 'proxies'), # noqa
+ ]
+ for url, key in urls:
+ source = url.split('//')[1].split('/')[0]
+ response = requests.get(url)
+ table = response.json()
+ table = table[key]
+
+ for row in table:
+ yield Proxy(proxy=f'{row["ip"]}:{row["port"]}', source=source)
+
@staticmethod
def get():
ret = []
@@ -41,18 +71,8 @@ def get():
if ProxyList.is_proxy(proxy):
ret.append(Proxy(proxy=proxy, source='hidemyna.me'))
- urls = [
- 'https://free-proxy-list.net',
- 'https://sslproxies.org',
- ]
- for url in urls:
- source = url.split('//')[1].split('/')[0]
- page = requests.get(url)
- table = ParsedTable(page.content)
- for row in table:
- row = {k.lower(): v.value for k, v in row.items()}
- if row['https'].lower() in {'true', '1', 't', 'y', 'yes'}:
- ret.append(Proxy(proxy=f'{row["ip address"]}:{row["port"]}', source=source))
+ # ret.extend(ProxyList._get_proxy_from_html())
+ ret.extend(ProxyList._get_proxy_from_json())
random.shuffle(ret)
diff --git a/src/utils/requester/__init__.py b/src/utils/requester/__init__.py
index eafca910..808a808e 100644
--- a/src/utils/requester/__init__.py
+++ b/src/utils/requester/__init__.py
@@ -465,8 +465,8 @@ class requester():
limit_file_cache = 200
counter_file_cache = 0
verify_word = None
- n_attempts = 1
- attempt_delay = 2
+ n_attempts = int(environ.get('REQUESTER_N_ATTEMPTS', 1))
+ attempt_delay = int(environ.get('REQUESTER_ATTEMPT_DELAY', 2))
additional_lock = threading.Lock()
def print(self, *objs, force=False):