bitnp / contest-bitnp Goto Github PK
View Code? Open in Web Editor NEW国防知识竞赛
Home Page: https://contest.bitnp.net
国防知识竞赛
Home Page: https://contest.bitnp.net
https://everything411.top/ → https://webvpn.bit.edu.cn/https/77726476706e69737468656265737421f5e1448e3e246059700fddfdc91b373ac0/
Uncaught SyntaxError: import declarations may only appear at top level of a module
vpn_eval((function(){
import{d as e}from"./_rollupPluginBabelHelpers-b026cde4.js";…
}
).toString().slice(12, -2),"");
.
≠ /
<script id="data:update-url" type="application/json">"/contest/update/"</script>
vpn_eval
大致如下。
function vpn_eval(t: string) {
try {
return eval['call'](vpnGlobal, Ae(t))
} catch (t) {
…
}
}
Ae
基本是恒等映射。
自动把DraftResponse
转换为Response
。
现在只有收到quiz:contest_submit
时才会转换。
这些是类似 crontab 的方案。它们原本场景中,数据天生需要定时更新,例如天气。
如果同学放着不管了,暂时不清理也无妨,一切结束后整理即可。
响应quiz:index
时清理。
界面需要加个已经进行了多少次考试,还有多少次机会的提示
在 URL 和登录之间循环重定向。
@login_required
# 不符合则转登录
@student_only
# 不符合则转 not_student.html(“只有学生能访问这里……”)
@user_passes_test(is_student_taking_contest)
# user_passes_test 似乎本来是限制用户类型,所以会转登录……
@require_POST
def contest_submit(request: AuthenticatedHttpRequest) -> HttpResponse:
...
quiz:contest_submit
同理。
自己做个user_passes_test
。
这会怎么样?
可能不允许再答题,这时'a#url-quiz-contest'
不存在
Uncaught TypeError: anchor is null
base.html
用户答题答案不应每次都更新入数据库,而应该增加一层缓存,选取合适节点统一提交数据库,从而提升性能,防止被高峰挤爆。
考虑使用进程内缓存或者redis。
题目
电脑设备中间可以加个背景框,题和题间加个分割线,另外加个题号。
进度条
PHP 旧项目:
$school = phpCAS::getAttribute('eduPersonOrgDN');
$cname = phpCAS::getAttribute('cn');
$stuNum = phpCAS::getAttribute('uid');
$SQL = "INSERT INTO users(casid, name, stuNum, school, status, problems, keyans) VALUES('$CASid', '$cname', '$stuNum
', '$school', 2, '$problems', '$keyans')";
本地保存姓名、学号映射表,初次登录时查表。
在答题页,提示超时后关闭弹窗,单击表单里的“提交”,会 403 Forbidden。正常应该能提交。
不过无法复现。
Version pinning
Whatever method you use, it is highly recommended to explicitly control the version of Poetry used, so that you are able
to upgrade after performing your own validation. Each install method has a different syntax for setting the version that
is used in the following examples.Using pipx
Just as
pipx
is a powerful tool for development use, it is equally useful in a CI environment
and should be one of your top choices for use of Poetry in CI.pipx install poetry==1.2.0
#34 介绍了缓存方法。
如题,只有表头有些迷惑。
删除国防教育协会
大家都不清楚这个社团现在在哪儿。
9月1日0:00–2日24:00
20题,每题5分,300秒,2次
按照doc/deploy.md
操作,migrate 会失败。
File "…\contest-bitnp\contest\contest\urls.py", line 28, in <module>
path("__reload__/", include("django_browser_reload.urls")),
File "…\contest-bitnp\.venv\lib\site-packages\django\urls\conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
File "…\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_browser_reload'
不知 CI 能过。这大约因为缓存了 dev 的包,注意poetry install
时提示 No dependencies to install or update。
方便人工检查题目。
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
from quiz.models import Question
if TYPE_CHECKING:
from typing import Generator
PREFIX = {
True: "【应选】",
False: "",
}
def lines() -> Generator[str, None, None]:
for q in Question.objects.all():
yield f"# {q.content}\n\n"
yield "\n\n".join(PREFIX[c.correct] + c.content for c in q.choice_set.all())
yield "\n\n"
if __name__ == "__main__":
Path("problems.txt").write_text("".join(lines()), encoding="utf-8")
可复制到just shell
运行。另外 django-extensions · PyPI 似乎能runscript
。
用没权限的账号访问/admin/
,后端报错django.core.exceptions.PermissionDenied: You do not have staff privileges.
,此时前端会用base.html
,而缺乏constants
。
也许 python 部分不强制要求有constants
即可。(Django 模板部分似乎会整体解析 variables,a
不存在时a.b
能转换为string_if_invalid
。)
constants: ConstantsNamespace | None = context.get("constants")
在 CAS 登录后,出现 ProxyError 什么的,有时是重定向次数过多。
Admin view 也有类似情况。
如题。Response
没有Answer
时会如此。
这还会导致进不了管理员界面。(不过删数据就好了)
$ poetry run python -m pip install polars
$ just shell
In [1]: from quiz.models import Student
In [2]: import polars as pl
In [3]: pl.DataFrame({ "score": s.final_score(), "name": s.name, "id": s.user.id } for s in Student.objects.all())
Out[3]:
shape: (14, 3)
┌───────────┬──────────┬─────┐
│ score ┆ name ┆ id │
│ --- ┆ --- ┆ --- │
│ f64 ┆ str ┆ i64 │
╞═══════════╪══════════╪═════╡
│ 100.0 ┆ 侯□□ ┆ 2 │
│ 0.0 ┆ A Worker ┆ 3 │
│ 66.666667 ┆ a ┆ 10 │
│ 0.0 ┆ b ┆ 11 │
│ … ┆ … ┆ … │
│ 10.0 ┆ new ┆ 19 │
│ 10.0 ┆ . ┆ 20 │
│ 0.0 ┆ - ┆ 21 │
│ 20.0 ┆ , ┆ 22 │
└───────────┴──────────┴─────┘
m个选择
n个判断
选择题每个x分
判断题每个y分
另外加个说明,建议不要多开页面。
Index 需要的contest/quiz/static/img/home.jpg
目前没有。
建议尺寸 1824 × 1080。
有时间可以做一个简单的回顾功能,把历史答题记录稍微显示一下。
要显示具体对错,还是仅仅展示答题记录?后者。
现在显示的是学号。
应该改这里就行。
(这次结束了再改吧)
手机上似乎根本没有边距。
覆盖暂存记录应以客户端发送时间为准,现在是以来服务端收到时间为准。
Relates-to: #104
安装后可以在 GitHub 上运行 pre-commit。这样就不会有 #52 那样的格式问题了。
安装方法:仓库所有者到 https://pre-commit.ci 按提示登录、管理即可。
价格:
pre-commit.ci will always be free for open source repositories.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.