Skip to content

Commit

Permalink
Fix/81 (#85)
Browse files Browse the repository at this point in the history
* fix: bind `checked` instead of true/false-value, and show hidden status in problem list

* fix: change v2.noj.tw to noj.tw in sentry tracing origins
  • Loading branch information
uier authored Mar 17, 2023
1 parent 65d2d1b commit 1e6200f
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/auto/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ declare module '@vue/runtime-core' {
IUilSun: typeof import('~icons/uil/sun')['default']
IUilTimes: typeof import('~icons/uil/times')['default']
IUilTimesCircle: typeof import('~icons/uil/times-circle')['default']
IUilTrashAlt: typeof import('~icons/uil/trash-alt')['default']
IUilUser: typeof import('~icons/uil/user')['default']
JudgeStatus: typeof import('./../components/JudgeStatus.vue')['default']
LanguageMultiSelect: typeof import('./../components/Problem/Forms/LanguageMultiSelect.vue')['default']
Expand Down
3 changes: 1 addition & 2 deletions src/components/Problem/ProblemForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ watch(
<input
type="checkbox"
class="toggle toggle-success"
:true-value="1"
:false-value="0"
:value="problem.status"
:checked="problem.status === 1"
@change="update('status', (problem.status ^ 1) as 0 | 1)"
/>
</label>
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
"name": "Name",
"tags": "Tags",
"quota": "Quota",
"new": "New"
"new": "New",
"status": "Hidden"
},
"submissions": {
"text": "Submissions",
Expand Down
5 changes: 3 additions & 2 deletions src/i18n/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
"name": "題名",
"tags": "標籤",
"quota": "額度",
"new": "新增"
"new": "新增",
"status": "隱藏"
},
"submissions": {
"text": "繳交狀態",
Expand Down Expand Up @@ -378,4 +379,4 @@
"ERR002": "登入失敗:帳號尚未開通,請至 https://v1.noj.tw 驗證信箱以開通帳號。",
"UNKNOWN": "未知的錯誤,請洽助教或管理者協助處理,或請稍後再試一次。"
}
}
}
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Sentry.init({
integrations: [
new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
tracingOrigins: ["localhost", "v2.noj.tw", /^\//],
tracingOrigins: ["localhost", "noj.tw", /^\//],
}),
],
// Set tracesSampleRate to 1.0 to capture 100%
Expand Down
16 changes: 11 additions & 5 deletions src/pages/course/[name]/problems.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { useAxios } from "@vueuse/integrations/useAxios";
import { useRoute, useRouter } from "vue-router";
import { computed, ref, watch, watchEffect } from "vue";
import { fetcher } from "@/models/api";
import { useSession } from "@/stores/session";
import { UserRole, useSession } from "@/stores/session";
import { useTitle } from "@vueuse/core";
const session = useSession();
const rolesCanReadProblemStatus = [UserRole.Admin, UserRole.Teacher];
const route = useRoute();
const router = useRouter();
Expand Down Expand Up @@ -58,17 +59,19 @@ const maxPage = computed(() => {
<tr>
<th>{{ $t("course.problems.id") }}</th>
<th>{{ $t("course.problems.name") }}</th>
<th v-if="rolesCanReadProblemStatus.includes(session.role)">
{{ $t("course.problems.status") }}
</th>
<th>{{ $t("course.problems.tags") }}</th>
<th>{{ $t("course.problems.quota") }}</th>
<th></th>
</tr>
</thead>
<tbody>
<tr
v-for="{ problemId, problemName, tags, quota, submitCount } in (problems || []).slice(
(page - 1) * 10,
page * 10,
)"
v-for="{ problemId, problemName, tags, quota, submitCount, status } in (
problems || []
).slice((page - 1) * 10, page * 10)"
:key="problemId"
class="hover"
>
Expand All @@ -80,6 +83,9 @@ const maxPage = computed(() => {
<td>
{{ problemName }}
</td>
<td v-if="rolesCanReadProblemStatus.includes(session.role)">
<span class="badge ml-1">{{ status === 0 ? "VISIBLE" : "HIDDEN" }}</span>
</td>
<td>
<span class="badge badge-info mr-1" v-for="tag in tags" :key="tag">{{ tag }}</span>
</td>
Expand Down
4 changes: 2 additions & 2 deletions src/types/problem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ declare enum ProblemType {
}

declare enum ProblemStatus {
Online = 1,
Offline = 2,
Hidden = 1,
Visible = 0,
}

interface ProblemTestCase {
Expand Down

0 comments on commit 1e6200f

Please sign in to comment.