diff --git a/app.py b/app.py index 863e14b..4976719 100644 --- a/app.py +++ b/app.py @@ -62,7 +62,7 @@ async def list(request: Request, tag: str): "tags": tags, "scales": scales, "tag": tag - }) + }) @app.get("/scales/{scale_id}", response_class=HTMLResponse) async def scale(request: Request, scale_id: str): @@ -85,12 +85,12 @@ async def result(request: Request, scale_id: str): if scale: # 这里可以添加保存数据到数据库等逻辑 responses = {} - ranges = {} + options = {} for subscale, qids in scale['subscales'].items(): responses[subscale] = 0 - min_val = min(scale['range'].keys()) - max_val = max(scale['range'].keys()) - ranges[subscale] = [min_val*len(qids),max_val*len(qids)] + min_val = min(scale['options'].keys()) + max_val = max(scale['options'].keys()) + options[subscale] = [min_val*len(qids),max_val*len(qids)] for qid in qids: if qid<0: responses[subscale] += min_val + max_val - int(form_data[str(-qid)]) @@ -99,7 +99,7 @@ async def result(request: Request, scale_id: str): return templates.TemplateResponse("result.html", { "request": request, "responses": responses, - "ranges": ranges, + "options": options, "scale": scale, "tags":tags }) diff --git a/scales/CBF-PI-B.yml b/scales/CBF-PI-B.yml index 2240b61..5368856 100644 --- a/scales/CBF-PI-B.yml +++ b/scales/CBF-PI-B.yml @@ -18,14 +18,14 @@ subscales: 宜人性: [3,-8,-13,-18,23,28,33,38] 神经质: [1,6,11,16,21,26,31,-36] abstract: 中国大五人格问卷(CBF-PI)是由王孟成和戴晓阳等编制的,中国拥有其知识产权的人格问卷(相比NEO-PI)。 -range: +options: 1: 完全不符合 2: 大部分不符合 3: 有点不符合 4: 有点符合 5: 大部分符合 6: 完全符合。 -questions: +items: 1: 我常感到害怕 2: 一旦确定了目标,我会坚持努力地实现它 3: 我觉得大部分人基本上是心怀善意的 diff --git a/scales/Symptom Checklist-90 (SCL90).yml b/scales/Symptom Checklist-90 (SCL90).yml index 6adc8ee..75d332b 100644 --- a/scales/Symptom Checklist-90 (SCL90).yml +++ b/scales/Symptom Checklist-90 (SCL90).yml @@ -26,13 +26,13 @@ subscales: Paranoid ideation: [8, 18, 43, 68, 76, 83] Psychoticism: [7, 16, 35, 62, 77, 84, 85, 87, 88, 90] Additional items: [19, 44, 59, 60, 64, 89] -range: +options: 0: NOT AT ALL 1: A LITTLE BIT 2: MODERATELY 3: QUITE A BIT 4: EXTREMELY -questions: +items: 1: Headaches 2: Nervousness or shakiness inside 3: Unwanted thoughts, words, or ideas that won’t leave your mind diff --git a/scales/中庸实践思维量表.yml b/scales/中庸实践思维量表.yml index 2b3b81c..4062d15 100644 --- a/scales/中庸实践思维量表.yml +++ b/scales/中庸实践思维量表.yml @@ -16,12 +16,12 @@ subscales: 内外和谐: [-2,-4,-7,-9,-11,-14] 阴阳转换: [1,5,8,10,12] 总分: [1,-2,-3,-4,5,-6,-7,8,-9,10,-11,12,-13,-14,-15,-16,-17,-18] -range: +options: 0: 非常不符合 1: 基本不符合 2: 基本符合 3: 非常符合 -questions: +items: 1: 我认为世界上任何事情的发展,都有其历史根源和背景 2: 做事情既要考虑他人,又要兼顾自己,这对我来说太难了 3: 只有成功的事情,对我才有好处 diff --git a/static/styles.css b/static/styles.css index 6c3af55..efd858a 100644 --- a/static/styles.css +++ b/static/styles.css @@ -136,7 +136,7 @@ main { input[type="radio"]:checked+label { border: 3px solid #909090; - border-radius: 20px; + border-radius: 40px; } } diff --git a/templates/result.html b/templates/result.html index 6c6b9d5..4cc5423 100644 --- a/templates/result.html +++ b/templates/result.html @@ -8,7 +8,7 @@

{{ scale.title }}

diff --git a/templates/scale.html b/templates/scale.html index 0ea4df2..17faa57 100644 --- a/templates/scale.html +++ b/templates/scale.html @@ -10,10 +10,10 @@ {{ scale.instructions|safe }}
- {% for id, question in scale.questions.items() %} + {% for id, question in scale['items'].items() %}
- {% for option, lable in scale.range.items() %} + {% for option, lable in scale.options.items() %} {% endfor %}