Commit d4ee9968 authored by Florent Chehab's avatar Florent Chehab
Browse files

Cleaning needed

parent 621a299b
......@@ -556,6 +556,15 @@
"Markdown(\"_(\"+MAIN_SEMESTER+\")_\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"HTML(\"\"\"<div class=\"alert alert-success\">Vous pouvez cliquez sur les graphes pour avoir le détail</div>\"\"\")"
]
},
{
"cell_type": "code",
"execution_count": null,
......@@ -604,7 +613,26 @@
" )\n",
")\n",
"\n",
"iplot(go.Figure(data=traces, layout=layout))"
"iplot(go.Figure(data=traces, layout=layout))\n",
"\n",
"\n",
"def link_graph(id):\n",
" html = '<div id='+id+\"\"\"\n",
" \"></div>\n",
" <script>\n",
" $(window).load(function(){\n",
" var graph_id = $('#\"\"\"+id+\"\"\"').closest(\".output\").find(\".js-plotly-plot\")[0].id;\n",
" var graph = document.getElementById(graph_id);\n",
" graph.on(\"plotly_click\", function(data){\n",
" $(\"#UV-select\").val(data.points[0].x).change();\n",
" });\n",
" });\n",
"\n",
" </script>\n",
" \"\"\"\n",
" return html\n",
"\n",
"HTML(link_graph('graph-mm'))"
]
},
{
......@@ -637,7 +665,9 @@
")\n",
"\n",
"fig = go.Figure(data=graph_data, layout=layout)\n",
"iplot(fig)"
"iplot(fig)\n",
"\n",
"HTML(link_graph('graph-report-status'))"
]
},
{
......@@ -693,7 +723,9 @@
")\n",
"\n",
"fig = go.Figure(data=traces, layout=layout)\n",
"iplot(fig)"
"iplot(fig, show_link=False)\n",
"\n",
"HTML(link_graph('graph-comp-prev'))"
]
},
{
......@@ -735,7 +767,7 @@
"metadata": {},
"outputs": [],
"source": [
"script = open('./src/display_uv.html').read()\n",
"script = open('./src/display_uv.html').read() + open('./src/go_to_uv.html').read() \n",
"HTML(script)"
]
},
......
......@@ -3,7 +3,7 @@
border-collapse: collapse;
border-spacing: 0;
width: 100%;
text-align: left;
text-align: left !important;
}
.tg td {
......@@ -44,11 +44,11 @@
<script>
var table_header = function (content) {
return `
<table class="tg">
<table id="table-details-uv" class="tg">
<tr>
<th class="tg-gcw3" style="width:10%;">Semestre</th>
<th class="tg-gcw3" style="width:50%;">Données</th>
<th class="tg-gcw3">Commentaires</th>
<th class="tg-gcw3" style="width:10%;"><strong>Semestre</strong></th>
<th class="tg-gcw3" style="width:50%;"><strong>Données</strong></th>
<th class="tg-gcw3"><strong>Commentaires</strong></th>
</tr>
${content}
</table>
......@@ -58,7 +58,7 @@
var table_row = function (semester, resp) {
return `
<tr>
<td class="tg-gcw3" rowspan="2">${semester}${resp}</td>
<td class="tg-gcw3" rowspan="2"><strong>${semester}</strong>${resp}</td>
<td class="tg-gcw3" rowspan="2"><div id="details-${semester}"></div><div id="graph-${semester}"></div></td>
<td class="tg-gcw3"><div id="com-resp-${semester}"></div></td>
</tr>
......@@ -80,16 +80,16 @@
var ratio = function (what) {
return (100 * what / (uv.nb_etu_registered - uv.nb_etu_abs)).toFixed(2);
}
return `<center><i>
return `<div class="alert alert-info"><center><i>
${uv.nb_etu_registered} inscrits, ${uv.nb_etu_abs} absent(s), ${uv.nb_etu_passed} étudiants reçus à l'uv (Réussite : ${ratio(uv.nb_etu_passed)}%) - ${uv.nb_evals} évaluations (${ratio(uv.nb_evals)}%)
</i></center>
</i></center></div>
`;
}
var comment_html = function (date, comment, background_color) {
var comment_html = function (date, comment, alert_type) {
return `
<div style="background-color:${background_color};">${date}</div>
<div>${comment}</div>
<div class="alert alert-${alert_type}">${date}</div>
<div class="alert alert-info">${comment}</div>
`
}
</script>
......@@ -230,9 +230,9 @@
var teacher_comment = evals_data[semester][uv]['teacher_comment'];
var conseil_comment = evals_data[semester][uv]['conseil_comment'];
var conseil_color = '#ffa40580', teacher_color = '#ffa40580';
var conseil_alert = 'warning', teacher_alert = 'warning';
if (teacher_date === null) {
teacher_color = '#ff050580';
teacher_alert = 'danger';
teacher_date = "<i>Les évaluations ne semblent par avoir été vues par le ou la responsable de l'enseignement ce semestre.</i>";
teacher_comment = '';
} else {
......@@ -240,7 +240,7 @@
}
if (conseil_date === null) {
conseil_color = '#ff050580';
conseil_alert = 'danger';
conseil_date = "<i>Les évaluations ne semblent par avoir été vues par le conseil de perfectionnement ce semestre.</i>";
conseil_comment = '';
} else {
......@@ -248,10 +248,10 @@
}
if (teacher_comment > '') {
teacher_color = '#05ff2b80';
teacher_alert = 'success';
}
if (conseil_comment > '') {
conseil_color = '#05ff2b80';
conseil_alert = 'success';
}
if (teacher_comment === '' || teacher_comment === null) {
......@@ -264,12 +264,15 @@
teacher_comment = teacher_comment.replace(/¿/g, "'");
conseil_comment = conseil_comment.replace(/¿/g, "'");
document.getElementById('com-resp-' + semester).innerHTML = comment_html(teacher_date, teacher_comment, teacher_color);
document.getElementById('com-conseil-' + semester).innerHTML = comment_html(conseil_date, conseil_comment, conseil_color);
document.getElementById('com-resp-' + semester).innerHTML = comment_html(teacher_date, teacher_comment, teacher_alert);
document.getElementById('com-conseil-' + semester).innerHTML = comment_html(conseil_date, conseil_comment, conseil_alert);
}
}
}
// update link
document.getElementById('uv-details-name').innerHTML = uv;
}
var all_uvs = new Set();
......@@ -289,19 +292,12 @@
select_uv.appendChild(opt);
}
var init_select = function () {
if (typeof Plotly === undefined) {
return setTimeout(function () { init_select(); }, 1000);
} else {
console.log("defined");
return setTimeout(function () {
document.getElementById('UV-select').value = all_uvs[0];
update_display(all_uvs[0]);
}, 1000);
var interval = setInterval(function () {
if (typeof Plotly == 'undefined') return;
clearInterval(interval);
}
}
init_select();
document.getElementById('UV-select').value = all_uvs[0];
update_display(all_uvs[0]);
}, 200);
</script>
\ No newline at end of file
<style>
a.got-to-uv {
display: inline;
padding-left: 20px;
padding-right: 20px;
padding-top: 10px;
padding-bottom: 10px;
position: fixed;
z-index: 999;
right: 20px;
bottom: 20px;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
background: aliceblue;
border-radius: 30px;
color: darkblue !important;
font-size: 19px;
}
</style>
<script>
if (document.getElementById('uv-details-name') === null) {
$('body').prepend("<a href='#'' class='got-to-uv'><center>Voir en détail l'UV<br><span id='uv-details-name' style='font-weight:bold;'></span></center></a>");
}
$('a.got-to-uv').fadeIn('slow');
$('a.got-to-uv').click(function () {
document.getElementById('UV-select').scrollIntoView();
return false;
});
</script>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment