Add old volunteer link to UI

This commit is contained in:
cuom1999 2022-07-29 15:53:35 +07:00
parent 89b74e8ef8
commit c9f8fbe098
5 changed files with 397 additions and 145 deletions

View file

@ -1,34 +1,67 @@
from operator import attrgetter
from django.contrib import admin
from django.utils.html import format_html
from django.urls import reverse
from django.utils.translation import gettext, gettext_lazy as _, ungettext
from django.forms import ModelForm
from judge.models import VolunteerProblemVote
from judge.widgets import AdminSelect2MultipleWidget
class VolunteerProblemVoteForm(ModelForm):
class Meta:
widgets = {
"types": AdminSelect2MultipleWidget,
}
class VolunteerProblemVoteAdmin(admin.ModelAdmin):
form = VolunteerProblemVoteForm
fields = (
"voter",
"problem",
"time",
"thinking_points",
"knowledge_points",
"feedback",
)
readonly_fields = ("time", "problem", "voter")
list_display = (
"voter",
"problem_link",
"time",
"thinking_points",
"knowledge_points",
"types",
"feedback",
)
readonly_fields = ("time", "problem_link", "voter")
list_display = (
"voter",
"problem_link",
"thinking_points",
"knowledge_points",
"show_types",
"feedback",
)
search_fields = (
"voter__user__username",
"problem__code",
"problem__name",
)
date_hierarchy = "time"
def problem_link(self, obj):
if self.request.user.is_superuser:
url = reverse("admin:judge_problem_change", args=(obj.problem.id,))
return format_html(f"<a href='{url}'>{obj.problem.code}</a>")
else:
url = reverse("problem_detail", args=(obj.problem.code,))
return format_html(f"<a href='{url}'>{obj.problem}</a>")
problem_link.short_description = _("Problem")
problem_link.admin_order_field = "problem__code"
def show_types(self, obj):
return ", ".join(map(attrgetter("name"), obj.types.all()))
show_types.short_description = _("Types")
def get_queryset(self, request):
self.request = request
if request.user.is_superuser:
return super().get_queryset(request)
queryset = VolunteerProblemVote.objects.prefetch_related("voter")
return queryset.filter(voter=request.profile).distinct()

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: lqdoj2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-07-18 12:59+0700\n"
"POT-Creation-Date: 2022-07-29 15:51+0700\n"
"PO-Revision-Date: 2021-07-20 03:44\n"
"Last-Translator: Icyene\n"
"Language-Team: Vietnamese\n"
@ -141,7 +141,7 @@ msgstr "Trang liên kết"
msgid "Included contests"
msgstr ""
#: judge/admin/contest.py:74 judge/admin/volunteer.py:33
#: judge/admin/contest.py:74 judge/admin/volunteer.py:54
#: templates/contest/clarification.html:42 templates/contest/contest.html:83
#: templates/contest/moss.html:43 templates/internal/base.html:29
#: templates/internal/base.html:37 templates/problem/list.html:15
@ -264,7 +264,7 @@ msgstr "Mạng Xã Hội"
msgid "Taxonomy"
msgstr ""
#: judge/admin/problem.py:205 judge/admin/problem.py:394
#: judge/admin/problem.py:205 judge/admin/problem.py:401
#: templates/contest/contest.html:84 templates/problem/data.html:475
#: templates/problem/list.html:20 templates/problem/list.html:44
#: templates/user/base-users-table.html:10 templates/user/user-about.html:36
@ -309,28 +309,28 @@ msgstr[0] "%d bài tập đã được đánh dấu riêng tư."
msgid "Mark problems as private"
msgstr "Đánh dấu các bài tập là riêng tư"
#: judge/admin/problem.py:388 judge/admin/submission.py:316
#: judge/admin/problem.py:395 judge/admin/submission.py:316
#: templates/problem/list.html:16 templates/problem/list.html:33
msgid "Problem code"
msgstr "Mã bài"
#: judge/admin/problem.py:400 judge/admin/submission.py:322
#: judge/admin/problem.py:407 judge/admin/submission.py:322
msgid "Problem name"
msgstr "Tên bài"
#: judge/admin/problem.py:406
#: judge/admin/problem.py:413
#, fuzzy
#| msgid "contest rating"
msgid "Voter rating"
msgstr "rating kỳ thi"
#: judge/admin/problem.py:412
#: judge/admin/problem.py:419
#, fuzzy
#| msgid "Total points"
msgid "Voter point"
msgstr "Tổng điểm"
#: judge/admin/problem.py:418
#: judge/admin/problem.py:425
msgid "Vote"
msgstr ""
@ -471,6 +471,11 @@ msgstr "Các bài tập trong nhóm này"
msgid "These problems are included in this type of problems"
msgstr "Các bài tập dạng này"
#: judge/admin/volunteer.py:60 templates/internal/base.html:78
#: templates/problem/list.html:18 templates/problem/list.html:40
msgid "Types"
msgstr "Dạng"
#: judge/apps.py:8
msgid "Online Judge"
msgstr ""
@ -3438,7 +3443,7 @@ msgstr "Xin chào, <b>%(username)s</b>."
#: templates/contest/list.html:130 templates/contest/ranking-table.html:49
#: templates/internal/base.html:59
#: templates/organization/org-left-sidebar.html:12
#: templates/problem/left-sidebar.html:5 templates/problem/list-base.html:257
#: templates/problem/left-sidebar.html:5 templates/problem/list-base.html:261
#: templates/problem/problem-list-tabs.html:6
#: templates/submission/info-base.html:12 templates/submission/list.html:386
#: templates/submission/submission-list-tabs.html:15
@ -3488,7 +3493,7 @@ msgstr ""
#: templates/comments/list.html:83 templates/contest/contest-tabs.html:23
#: templates/contest/tag-title.html:9 templates/flatpages/admin_link.html:3
#: templates/license.html:10 templates/problem/editorial.html:14
#: templates/problem/feed.html:58
#: templates/problem/feed.html:65
msgid "Edit"
msgstr "Chỉnh sửa"
@ -3758,7 +3763,7 @@ msgid "Next"
msgstr "Tiếp"
#: templates/contest/contest-list-tabs.html:21 templates/contest/list.html:128
#: templates/problem/left-sidebar.html:4 templates/problem/list-base.html:256
#: templates/problem/left-sidebar.html:4 templates/problem/list-base.html:260
#: templates/problem/problem-list-tabs.html:5
msgid "List"
msgstr "Danh sách"
@ -4148,12 +4153,7 @@ msgstr ""
msgid "Thinking"
msgstr "Bảng xếp hạng"
#: templates/internal/base.html:78 templates/problem/list.html:18
#: templates/problem/list.html:40
msgid "Types"
msgstr "Dạng"
#: templates/internal/base.html:82 templates/problem/feed.html:104
#: templates/internal/base.html:82 templates/problem/feed.html:111
#, fuzzy
#| msgid "Feed"
msgid "Feedback"
@ -4486,35 +4486,43 @@ msgstr "MỚI NHẤT"
msgid "VOLUNTEER"
msgstr "TÌNH NGUYỆN"
#: templates/problem/feed.html:56
#: templates/problem/feed.html:22
msgid "View your votes"
msgstr "Xem các đơn đã điền của bạn"
#: templates/problem/feed.html:60 templates/submission/status.html:60
msgid "View source"
msgstr "Xem mã nguồn"
#: templates/problem/feed.html:63
msgid "Volunteer form"
msgstr "Phiếu tình nguyện"
#: templates/problem/feed.html:60
#: templates/problem/feed.html:67
msgid "Submit"
msgstr "Gửi"
#: templates/problem/feed.html:67
#: templates/problem/feed.html:74
msgid "Value"
msgstr "Giá trị"
#: templates/problem/feed.html:74
#: templates/problem/feed.html:81
msgid "Knowledge point"
msgstr "Độ khó kiến thức"
#: templates/problem/feed.html:82
#: templates/problem/feed.html:89
msgid "Thinking point"
msgstr "Độ khó nghĩ"
#: templates/problem/feed.html:90 templates/problem/search-form.html:84
#: templates/problem/feed.html:97 templates/problem/search-form.html:84
msgid "Problem types"
msgstr "Dạng bài"
#: templates/problem/feed.html:107
#: templates/problem/feed.html:114
msgid "Any additional note here"
msgstr "Lưu ý thêm cho admin"
#: templates/problem/left-sidebar.html:3 templates/problem/list-base.html:255
#: templates/problem/left-sidebar.html:3 templates/problem/list-base.html:259
msgid "Feed"
msgstr "Gợi ý"
@ -4522,15 +4530,15 @@ msgstr "Gợi ý"
msgid "Filter by type..."
msgstr "Lọc theo dạng..."
#: templates/problem/list-base.html:161 templates/problem/list-base.html:187
#: templates/problem/list-base.html:165 templates/problem/list-base.html:191
msgid "Add types..."
msgstr "Thêm dạng"
#: templates/problem/list-base.html:203
#: templates/problem/list-base.html:207
msgid "Fail to vote!"
msgstr "Hệ thống lỗi!"
#: templates/problem/list-base.html:206
#: templates/problem/list-base.html:210
msgid "Successful vote! Thank you!"
msgstr "Đã gửi thành công! Cảm ơn bạn!"
@ -5255,10 +5263,6 @@ msgstr "AC pretest không đồng nghĩa AC cả bài nhé :))"
msgid "Submission aborted!"
msgstr "Đã hủy chấm bài nộp!"
#: templates/submission/status.html:60
msgid "View source"
msgstr "Xem mã nguồn"
#: templates/submission/status.html:89
msgid "Abort"
msgstr "Hủy chấm"

View file

@ -39,305 +39,515 @@ msgstr "Đăng ký tên"
msgid "Report"
msgstr "Báo cáo"
msgid "Bài cơ bản (Basic Problems)"
msgid "2sat"
msgstr ""
msgid "Bài toán số dư (Modulo)"
msgid "adhoc"
msgstr ""
msgid "Bài toán truy vấn (Query)"
msgid "aho-corasick"
msgstr ""
msgid "Bài đặc biệt (ad hoc)"
msgid "articulation-point"
msgstr ""
msgid "Bảng thưa (SparseTable)"
msgid "backtrack"
msgstr ""
msgid "Bao hàm loại trừ (Inclusion-Exclusion)"
msgid "bellman-ford"
msgstr ""
msgid "Bao lồi (Convex Hull)"
msgid "bfs-01"
msgstr ""
msgid "Cài đặt (Implementation)"
msgid "biconnected-component"
msgstr ""
msgid "Cặp ghép (Matching)"
msgid "binary-search"
msgstr ""
msgid "Cấu hình tập hợp"
msgid "binary-search-parallel"
msgstr ""
msgid "Cây (đồ thị)"
msgid "bit"
msgstr ""
msgid "Cây chỉ số nhị phân (Binary Indexed Tree)"
msgid "bit2d"
msgstr ""
msgid "Cây hậu tố (Suffix tree)"
msgid "bitset"
msgstr ""
msgid "Cây khung nhỏ nhất"
msgid "bitwise"
msgstr ""
msgid "Cây phân đoạn (Segment Tree)"
msgid "block-cut-tree"
msgstr ""
msgid "Cây tiền tố (Trie)"
msgid "boruvka"
msgstr ""
msgid "Cày trâu / Duyệt (Brute-force)"
msgid "branch&bound"
msgstr ""
msgid "Centroid Decomposition"
msgid "bridge"
msgstr ""
msgid "Chặt nhị phân (Binary search)"
msgid "brute force"
msgstr ""
msgid "Chặt tam phân (Ternary search)"
msgid "cactus-graph"
msgstr ""
msgid "Chia căn (Sqrt decomposition)"
msgid "casework"
msgstr ""
msgid "Chia để trị"
msgid "centroid"
msgstr ""
msgid "Chu trình Euler (Euler Cycle)"
msgid "chinese-remainder"
msgstr ""
msgid "Chưa phân loại (Uncategorized)"
msgid "combinatorics"
msgstr ""
msgid "CTDL Tiêu chuẩn (C++ STL)"
msgid "constructive"
msgstr ""
msgid "CTDL Đặc biệt (Data Structures)"
msgid "convex-hull"
msgstr ""
msgid "Danh sách liên kết (Linked list)"
msgid "counting"
msgstr ""
msgid "Dãy con chung dài nhất (LCS)"
msgid "cycle"
msgstr ""
msgid "Dãy con tăng dài nhất (LIS)"
msgid "data structures"
msgstr ""
msgid "Dãy lặp"
msgid "deep-optimization"
msgstr ""
msgid "DFS,BFS (đồ thị)"
msgid "dfs/bfs"
msgstr ""
msgid "Disjoint-set (DSU)"
msgid "dijkstra"
msgstr ""
msgid "Duyệt phân tập (Meet-in-the-middle)"
msgid "divide and conquer"
msgstr ""
msgid "Euclid mở rộng"
msgid "dp-alien"
msgstr ""
msgid "Euler tour trên cây"
msgid "dp-bitmask"
msgstr ""
msgid "Hai con trỏ (Two-pointers)"
msgid "dp-cc"
msgstr ""
msgid "Hàm băm (Hash)"
msgid "dp-convexhull"
msgstr ""
msgid "Hàm Mobius"
msgid "dp-count"
msgstr ""
msgid "Hình học"
msgid "dp-dag"
msgstr ""
msgid "Hoán vị"
msgid "dp-digit"
msgstr ""
msgid "Khớp, cầu (đồ thị)"
msgid "dp-dnc"
msgstr ""
msgid "Khử gauss (Gauss Elimination)"
msgid "dp-general"
msgstr ""
msgid "Lập trình cơ bản"
msgid "dp-knuth"
msgstr ""
msgid "LCA (Lowest common ancestor)"
msgid "dp-matrix"
msgstr ""
msgid "LT đồ thị (LQĐ)"
msgid "dp-openclose"
msgstr ""
msgid "Luồng (Flow)"
msgid "dp-permutation"
msgstr ""
msgid "Luồng cận dưới"
msgid "dp-slope"
msgstr ""
msgid "Luồng mincost"
msgid "dp-sos"
msgstr ""
msgid "Lý thuyết trò chơi (Game Theory)"
msgid "dp-swap-label"
msgstr ""
msgid "Lý Thuyết Đồ Thị (Graph Theory)"
msgid "dp-tree"
msgstr ""
msgid "Manacher"
msgid "dsu"
msgstr ""
msgid "Mảng"
msgid "dsu-roll-back"
msgstr ""
msgid "Mảng hậu tố (Suffix Array)"
msgid "dynamic programming"
msgstr ""
msgid "Mảng tổng dồn (Prefix sum)"
msgid "euler-path"
msgstr ""
msgid "Ngăn xếp, hàng đợi (Stack, Queue)"
msgid "euler-theorem"
msgstr ""
msgid "Ngẫu nhiên (Random)"
msgid "euler-tour"
msgstr ""
msgid "Nhân ma trận"
msgid "extgcd"
msgstr ""
msgid "Nhân đa thức (FFT)"
msgid "fft/ntt"
msgstr ""
msgid "Nhánh cận"
msgid "flow-demands"
msgstr ""
msgid "Palindrome tree"
msgid "flow-general"
msgstr ""
msgid "Phân tích thừa số nguyên tố (Prime Factorization)"
msgid "flow-mincost"
msgstr ""
msgid "Phi hàm Euler (Euler's totient function)"
msgid "flows"
msgstr ""
msgid "Quay lui"
msgid "floyd"
msgstr ""
msgid "Quy hoạch động"
msgid "function-graph"
msgstr ""
msgid "Quy hoạch động bitmask"
msgid "game theory"
msgstr ""
msgid "Quy hoạch động chữ số"
msgid "game-ad-hoc"
msgstr ""
msgid "Quy hoạch động thứ tự từ điển"
msgid "game-minimax"
msgstr ""
msgid "Quy hoạch động trạng thái"
msgid "game-nim"
msgstr ""
msgid "Quy hoạch động trên cây"
msgid "game-sprague-grundy"
msgstr ""
msgid "Quy hoạch động đảo nhãn"
msgid "gauss-elim"
msgstr ""
msgid "Quy hoạch động đếm"
msgid "genetic"
msgstr ""
msgid "Rời rạc hóa (Compression)"
msgid "geometry"
msgstr ""
msgid "Sàng (Sieve)"
msgid "geometry-general"
msgstr ""
msgid "Sắp xếp (Sorting)"
msgid "gomory-hu-tree"
msgstr ""
msgid "Sắp xếp tô pô (Topo Sort)"
msgid "graph theory"
msgstr ""
msgid "Scratch"
msgid "greedy"
msgstr ""
msgid "Số học (Number Theory)"
msgid "greedy-exchange"
msgstr ""
msgid "Số nguyên tố"
msgid "greedy-general"
msgstr ""
msgid "Sweep Line"
msgid "greedy-moore"
msgstr ""
msgid "Tách chuỗi cây (HLD)"
msgid "hashing"
msgstr ""
msgid "Tham Lam (Greedy)"
msgid "heuristic"
msgstr ""
msgid "Tháng tư là lời nói dối của em"
msgid "heuristics"
msgstr ""
msgid "Thành phần liên thông"
msgid "hld"
msgstr ""
msgid "Thao Tác Bit (bitwise)"
msgid "HSG"
msgstr ""
msgid "Thuật toán KMP"
msgid "ICPC"
msgstr ""
msgid "Thuật toán Mo"
msgid "inclusion-exclusion"
msgstr ""
msgid "Tổ hợp"
msgid "interactive"
msgstr ""
msgid "Toán (Math)"
msgid "inversive-geometry"
msgstr ""
msgid "Tối ưu hóa (Deep-optimize)"
msgid "kd-tree"
msgstr ""
msgid "Tương tác (Interactive)"
msgid "kirchoff"
msgstr ""
msgid "t_Bài tập (thầy Đông)"
msgid "kmp"
msgstr ""
msgid "Xác suất (Probability)"
msgid "kruskal"
msgstr ""
msgid "Xâu con (Substring)"
msgid "lagrange-inter"
msgstr ""
msgid "Xâu đối xứng (Palindrome)"
msgid "language"
msgstr ""
msgid "Xây dựng, tìm khuôn (Constructive)"
msgid "lca"
msgstr ""
msgid "Xử lí sai số (Precision-fix)"
msgid "lichao-tree"
msgstr ""
msgid "Xử lí số lớn (Bignum)"
msgid "local-search"
msgstr ""
msgid "Xử lí xâu (String)"
msgid "manacher"
msgstr ""
msgid "Z Function"
msgid "matching-bipartie"
msgstr ""
msgid "Đếm Phân Phối"
msgid "matching-general"
msgstr ""
msgid "Đường đi ngắn nhất (đồ thị)"
msgid "matching-hall"
msgstr ""
msgid "matching-hungarian"
msgstr ""
msgid "matching-konig"
msgstr ""
msgid "math"
msgstr ""
msgid "math-general"
msgstr ""
msgid "max-clique"
msgstr ""
msgid "meet-in-the-middle"
msgstr ""
msgid "mo-general"
msgstr ""
msgid "mo-tree"
msgstr ""
msgid "mo-update"
msgstr ""
msgid "mobius"
msgstr ""
msgid "modular"
msgstr ""
msgid "modular-inverse"
msgstr ""
msgid "monotonic-queue"
msgstr ""
msgid "multiplicative"
msgstr ""
msgid "NEW"
msgstr ""
msgid "number theory"
msgstr ""
msgid "offline"
msgstr ""
msgid "order-statistic"
msgstr ""
msgid "output-only"
msgstr ""
msgid "palin-tree"
msgstr ""
msgid "picks-theorem"
msgstr ""
msgid "planar-graph"
msgstr ""
msgid "polygon-triangulation"
msgstr ""
msgid "precision-issue"
msgstr ""
msgid "prefix-sum"
msgstr ""
msgid "primality-test"
msgstr ""
msgid "probability"
msgstr ""
msgid "randomized"
msgstr ""
msgid "rmq"
msgstr ""
msgid "rmq-2d"
msgstr ""
msgid "rmq2d"
msgstr ""
msgid "scc"
msgstr ""
msgid "scheduling"
msgstr ""
msgid "search"
msgstr ""
msgid "segtree-2d"
msgstr ""
msgid "segtree-beats"
msgstr ""
msgid "segtree-dynamic"
msgstr ""
msgid "segtree-general"
msgstr ""
msgid "segtree-persistent"
msgstr ""
msgid "segtree-walk"
msgstr ""
msgid "sequence"
msgstr ""
msgid "sieve"
msgstr ""
msgid "sieve-segment"
msgstr ""
msgid "small-to-large"
msgstr ""
msgid "sortings"
msgstr ""
msgid "spanning-tree"
msgstr ""
msgid "sparse-table"
msgstr ""
msgid "spfa"
msgstr ""
msgid "sqrt"
msgstr ""
msgid "sqrt-babygiant"
msgstr ""
msgid "sqrt-buckets"
msgstr ""
msgid "sqrt-buffer"
msgstr ""
msgid "sqrt-time"
msgstr ""
msgid "static-data"
msgstr ""
msgid "stl"
msgstr ""
msgid "string"
msgstr ""
msgid "suffix-array"
msgstr ""
msgid "sweep-line"
msgstr ""
msgid "tenary-search"
msgstr ""
msgid "topo-sort"
msgstr ""
msgid "tortoise-hare"
msgstr ""
msgid "treap/splay"
msgstr ""
msgid "tree-isomorphism"
msgstr ""
msgid "trie"
msgstr ""
msgid "TSP"
msgstr ""
msgid "TST"
msgstr ""
msgid "two-pointers"
msgstr ""
msgid "VOI"
msgstr ""
msgid "voronoi"
msgstr ""
msgid "z-function"
msgstr ""

View file

@ -17,6 +17,11 @@
</a>
{% endif %}
</div>
{% if request.user.has_perm('judge.suggest_problem_changes') and feed_type == 'volunteer' %}
<ul style="margin-bottom: 1em; margin-left: auto">
<li><a href="{{url('admin:judge_volunteerproblemvote_changelist')}}">{{_('View your votes')}}</a></li>
</ul>
{% endif %}
{% for problem in problems %}
<div class="blog-box">
<h3 class="problem-feed-name">