Feat: move dashboard to its own directory

This commit is contained in:
Bertrand Benjamin 2021-01-14 20:09:25 +01:00
parent 894ebc4ec8
commit 21397272c9
3 changed files with 22 additions and 9 deletions

View File

View File

@ -15,7 +15,7 @@ import numpy as np
from .. import flat_df_students, pp_q_scores
from ..config import NO_ST_COLUMNS
from .getconfig import config, CONFIGPATH
from ..scripts.getconfig import config, CONFIGPATH
COLORS = {
".": "black",
@ -180,6 +180,7 @@ def update_final_scores_descr(data):
)
def update_final_scores_hist(data):
assessment_scores = pd.DataFrame.from_records(data)
ranges = np.linspace(
0, assessment_scores.Bareme.max(), int(assessment_scores.Bareme.max() * 2 + 1)
)
@ -200,8 +201,15 @@ def update_final_scores_hist(data):
hovertemplate="",
marker_color="#4E89DE",
)
# fig = go.Figure(
# data=go.Histogram(
# x=assessment_scores["Note"],
# xbins={"start": 0, "end": assessment_scores["Bareme"].max(), "size": 0.25},
# ),
# )
return [fig]
@app.callback(
[
dash.dependencies.Output("fig_competences", "figure"),
@ -232,20 +240,23 @@ def update_competence_fig(data):
fig = go.Figure()
bars = [
{"score": -1, "name":"Pas de réponse", "color": COLORS["."]},
{"score": 0, "name":"Faut", "color": COLORS[0]},
{"score": 1, "name":"Peu juste", "color": COLORS[1]},
{"score": 2, "name":"Presque juste", "color": COLORS[2]},
{"score": 3, "name":"Juste", "color": COLORS[3]},
{"score": -1, "name": "Pas de réponse", "color": COLORS["."]},
{"score": 0, "name": "Faut", "color": COLORS[0]},
{"score": 1, "name": "Peu juste", "color": COLORS[1]},
{"score": 2, "name": "Presque juste", "color": COLORS[2]},
{"score": 3, "name": "Juste", "color": COLORS[3]},
]
for b in bars:
try:
fig.add_bar(x=index, y=pt[b["score"]], name=b["name"], marker_color=b["color"])
fig.add_bar(
x=index, y=pt[b["score"]], name=b["name"], marker_color=b["color"]
)
except KeyError:
pass
fig.update_layout(barmode="relative")
return [fig]
@app.callback(
[dash.dependencies.Output("lastsave", "children")],
[

View File

@ -13,7 +13,7 @@ from .getconfig import config, CONFIGPATH
from .prompts import prompt_exam, prompt_exercise, prompt_validate
from ..config import NO_ST_COLUMNS
from .exam import Exam
from .exam_dash import app as exam_app
from ..dashboard.exam import app as exam_app
@click.group()
@ -85,10 +85,12 @@ def new_exam():
base_df.to_csv(exam.path(".csv"), index=False)
print(f"Le fichier note a été enregistré à {exam.path('.csv')}")
@cli.command()
def exam_analysis():
exam_app.run_server(debug=True)
@cli.command()
@click.argument("csv_file")
def report(csv_file):