ramove rank
Some checks failed
Deploy / deploy (build, debian, 22) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822) (push) Has been cancelled

This commit is contained in:
2026-03-29 10:07:27 -06:00
parent 951e53c1dd
commit ecce21aaaf
6 changed files with 0 additions and 153 deletions

View File

@@ -181,7 +181,6 @@ export const Submission = {
score_min?: number
score_max_exclusive?: number
score_lt_threshold?: number
nominated?: boolean
ordering?: string
grouped?: boolean
}) {
@@ -223,11 +222,6 @@ export const Submission = {
return res.data as { cleared: number }
},
async nominate(id: string) {
const res = await http.put(`/submission/${id}/nominate`)
return res.data as { nominated: boolean }
},
async getStats(taskId: number, classname?: string): Promise<TaskStatsOut> {
const params: Record<string, string | number> = {}
if (classname) params.classname = classname

View File

@@ -279,72 +279,6 @@
</div>
</div>
<!-- 人气提交 Top 5 -->
<div style="margin-bottom: 12px">
<div
style="
font-weight: 600;
font-size: 13px;
margin-bottom: 8px;
color: #333;
"
>
人气提交 Top 5
<span style="font-size: 11px; color: #aaa; font-weight: 400"
>按打分人数</span
>
</div>
<div style="display: flex; flex-direction: column; gap: 5px">
<div
v-for="(sub, i) in stats.top_submissions"
:key="sub.submission_id"
:style="{
display: 'flex',
alignItems: 'center',
gap: '10px',
padding: '6px 10px',
background: rankBg(i),
borderRadius: '6px',
cursor: 'pointer',
}"
@click="viewSubmission(sub.submission_id)"
>
<div
:style="{
width: '20px',
height: '20px',
background: rankColor(i),
borderRadius: '50%',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: '#fff',
fontWeight: '700',
fontSize: '11px',
flexShrink: 0,
}"
>
{{ i + 1 }}
</div>
<div style="flex: 1">
<div style="font-weight: 500; font-size: 13px">
{{ displayName(sub.username, sub.classname) }}
</div>
<div style="color: #aaa; font-size: 11px">
{{ sub.score.toFixed(1) }} ·
{{ sub.rating_count }} 人打分
</div>
</div>
<div style="color: #2080f0; font-size: 12px">查看 </div>
</div>
<span
v-if="!stats.top_submissions.length"
style="color: #aaa; font-size: 12px"
>暂无打分记录</span
>
</div>
</div>
<!-- 标记统计 -->
<div>
<div
@@ -436,20 +370,6 @@ function viewSubmission(id: string) {
window.open(href, "_blank")
}
function rankColor(i: number) {
return (
(["#f0a020", "#909090", "#cd7f32", "#8899aa", "#7a8fa0"] as const)[i] ??
"#aaa"
)
}
function rankBg(i: number) {
return (
(["#fffbef", "#f8f8f8", "#fdf5ee", "#f2f5f8", "#eef2f5"] as const)[i] ??
"#f8f8f8"
)
}
function bucketPct(value: number) {
const total = stats.value?.submitted_count ?? 0
if (!total) return "0%"
@@ -467,7 +387,6 @@ const metrics = computed(() => {
color: "#2080f0",
},
{ label: "未打分", value: stats.value.unrated_count, color: "#d03050" },
{ label: "参与排名", value: stats.value.nominated_count, color: "#f0a020" },
]
})

View File

@@ -77,15 +77,6 @@ const menu = computed(() => [
width: 20,
}),
},
{
label: "排名榜",
key: "ranking",
icon: () =>
h(Icon, {
icon: "streamline-emojis:sunglasses",
width: 20,
}),
},
{
label: "退出账号",
key: "logout",
@@ -117,9 +108,6 @@ function clickMenu(name: string) {
query: { username: user.username },
})
break
case "ranking":
router.push({ name: "ranking" })
break
case "logout":
handleLogout()
break

View File

@@ -37,7 +37,6 @@ const emit = defineEmits<{
select: [id: string]
delete: [row: SubmissionOut, parentId: string]
"show-chain": [conversationId: string]
nominate: [row: SubmissionOut]
}>()
const isChallenge = computed(() => props.row.task_type === TASK_TYPE.Challenge)
@@ -77,30 +76,6 @@ const subColumns = computed((): DataTableColumn<SubmissionOut>[] => [
)
},
},
{
title: "排名",
key: "nominated",
width: 60,
render: (r: SubmissionOut) => {
if (r.username !== user.username) {
return r.nominated
? h("span", { style: { color: "#f0a020" } }, "🏅")
: null
}
return h(
NButton,
{
text: true,
title: r.nominated ? "已参与排名点击可重新提名" : "参与排名",
onClick: (e: Event) => {
e.stopPropagation()
emit("nominate", r)
},
},
() => (r.nominated ? "🏅" : ""),
)
},
},
...(isChallenge.value
? [
{

View File

@@ -195,7 +195,6 @@ const columns: DataTableColumn<SubmissionOut>[] = [
onSelect: (id) => getSubmissionByID(id),
onDelete: (r, parentId) => handleDelete(r, parentId),
"onShow-chain": (id) => showChain(id),
onNominate: (r) => handleNominateChild(r, row.id),
}),
},
{
@@ -313,23 +312,6 @@ async function getSubmissionByID(id: string) {
submission.value = await Submission.get(id)
}
async function handleNominateChild(row: SubmissionOut, parentId: string) {
await Submission.nominate(row.id)
const items = expandedData.get(parentId)
if (items) {
expandedData.set(
parentId,
items.map((d) => ({ ...d, nominated: d.id === row.id })),
)
}
data.value = data.value.map((d) => {
if (d.username === user.username && d.task_id === row.task_id) {
d.nominated = d.id === row.id
}
return d
})
}
function afterScore() {
data.value = data.value.map((d) => {
if (d.id === submission.value.id) d.my_score = submission.value.my_score

View File

@@ -78,7 +78,6 @@ export interface SubmissionOut {
my_score: number
conversation_id?: string
flag?: FlagType
nominated: boolean
submit_count: number
created: Date
modified: Date
@@ -107,14 +106,6 @@ export interface UserTag {
classname: string
}
export interface TopSubmission {
submission_id: string
username: string
classname: string
score: number
rating_count: number
}
export interface SubmissionCountBucket {
count_1: number
count_2: number
@@ -142,12 +133,10 @@ export interface TaskStatsOut {
unsubmitted_count: number
average_score: number | null
unrated_count: number
nominated_count: number
unsubmitted_users: UserTag[]
unrated_users: UserTag[]
submission_count_distribution: SubmissionCountBucket
score_distribution: ScoreBucket
top_submissions: TopSubmission[]
flag_stats: FlagStats
classes: string[]
}