1 parent
23844ae301
commit
d25b5dbe6d
268 files changed
+3684
-8861
No files matched your search
@@ -35,10 +35,7 @@ export function sampleUser(
|
||||
* 用 startsWith + slice 而不是 replace:replace 会删掉字符串中间的匹配,
|
||||
* 前缀对不上时从中间截出乱码。前缀不匹配就原样返回。
|
||||
*/
|
||||
export function stripClassPrefix(
|
||||
username: string,
|
||||
className: string | null | undefined,
|
||||
) {
|
||||
export function stripClassPrefix(username: string, className: string | null | undefined) {
|
||||
if (!className) return username
|
||||
const prefix = `ks${className}`
|
||||
return username.startsWith(prefix) ? username.slice(prefix.length) : username
|
||||
@@ -67,9 +64,7 @@ export function classPrefixCondition(input: string) {
|
||||
* 和列没收窄之前的行为完全一致 —— 所以这里只做类型上的交接,**不加校验**:
|
||||
* 在这儿拦一道会把「筛出空列表」变成「筛条件被忽略、返回全部」,那是另一种行为。
|
||||
*/
|
||||
export function asFilterValue<T extends string | number>(
|
||||
value: string | number,
|
||||
): T {
|
||||
export function asFilterValue<T extends string | number>(value: string | number): T {
|
||||
return value as T
|
||||
}
|
||||
|
||||
@@ -133,10 +128,7 @@ export function rounded(value: number, digits = 2) {
|
||||
* 等待评分 / 正在评分也算成失败,连点三次提交就能让按钮亮起来,而 hint 端点排掉了
|
||||
* 这两个状态,于是按钮亮着、点下去回 `hint-locked`。
|
||||
*/
|
||||
export async function countFailedSubmissions(
|
||||
userId: number,
|
||||
problemId: number,
|
||||
) {
|
||||
export async function countFailedSubmissions(userId: number, problemId: number) {
|
||||
const [failed] = await db
|
||||
.select({ value: count() })
|
||||
.from(schema.submission)
|
||||
|
||||
Reference in new issue
Block a user