forked from ScoDoc/ScoDoc
Assiduites : ajout préférence : durée créneau
This commit is contained in:
parent
31c6875fdf
commit
42f5b32624
@ -610,6 +610,17 @@ class BasePreferences(object):
|
|||||||
"category": "assi",
|
"category": "assi",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"periode_defaut",
|
||||||
|
{
|
||||||
|
"initvalue": 2.0,
|
||||||
|
"size": 10,
|
||||||
|
"title": "Durée par défaut d'un créneau",
|
||||||
|
"type": "float",
|
||||||
|
"category": "assi",
|
||||||
|
"only_global": True,
|
||||||
|
},
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"etat_defaut",
|
"etat_defaut",
|
||||||
{
|
{
|
||||||
|
@ -1263,7 +1263,9 @@ function actualizeEtud(etudid) {
|
|||||||
*/
|
*/
|
||||||
function generateAllEtudRow() {
|
function generateAllEtudRow() {
|
||||||
if (isSingleEtud()) {
|
if (isSingleEtud()) {
|
||||||
actualizeEtud(etudid);
|
try {
|
||||||
|
actualizeEtud(etudid);
|
||||||
|
} catch (ignored) {}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,10 @@
|
|||||||
|
|
||||||
const timelineContainer = document.querySelector(".timeline-container");
|
const timelineContainer = document.querySelector(".timeline-container");
|
||||||
const periodTimeLine = document.querySelector(".period");
|
const periodTimeLine = document.querySelector(".period");
|
||||||
const t_start = {{ t_start }}
|
const t_start = {{ t_start }};
|
||||||
const t_end = {{ t_end }}
|
const t_end = {{ t_end }};
|
||||||
|
|
||||||
|
const period_default = {{ periode_defaut }};
|
||||||
|
|
||||||
function createTicks() {
|
function createTicks() {
|
||||||
let i = t_start
|
let i = t_start
|
||||||
@ -157,7 +159,7 @@
|
|||||||
const computedValues = [Math.max(startValue, t_start), Math.min(t_end, endValue)]
|
const computedValues = [Math.max(startValue, t_start), Math.min(t_end, endValue)]
|
||||||
|
|
||||||
if (computedValues[0] > t_end || computedValues[1] < t_start) {
|
if (computedValues[0] > t_end || computedValues[1] < t_start) {
|
||||||
return [8, 10]
|
return [t_start, min(t_end, t_start + period_default)]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (computedValues[1] - computedValues[0] <= 0.25 && computedValues[1] < t_end - 0.25) {
|
if (computedValues[1] - computedValues[0] <= 0.25 && computedValues[1] < t_end - 0.25) {
|
||||||
@ -168,6 +170,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setPeriodValues(deb, fin) {
|
function setPeriodValues(deb, fin) {
|
||||||
|
deb = snapToQuarter(deb)
|
||||||
|
fin = snapToQuarter(fin)
|
||||||
let leftPercentage = (deb - t_start) / (t_end - t_start) * 100
|
let leftPercentage = (deb - t_start) / (t_end - t_start) * 100
|
||||||
let widthPercentage = (fin - deb) / (t_end - t_start) * 100
|
let widthPercentage = (fin - deb) / (t_end - t_start) * 100
|
||||||
periodTimeLine.style.left = `${leftPercentage}%`
|
periodTimeLine.style.left = `${leftPercentage}%`
|
||||||
@ -199,7 +203,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
createTicks();
|
createTicks();
|
||||||
setPeriodValues(8, 9)
|
setPeriodValues(t_start, t_start + period_default)
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
@ -444,9 +444,12 @@ def _module_selector(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _timeline() -> HTMLElement:
|
def _timeline(formsemestre_id=None) -> HTMLElement:
|
||||||
return render_template(
|
return render_template(
|
||||||
"assiduites/timeline.j2",
|
"assiduites/timeline.j2",
|
||||||
t_start=get_time("assi_morning_time", "08:00:00"),
|
t_start=get_time("assi_morning_time", "08:00:00"),
|
||||||
t_end=get_time("assi_afternoon_time", "18:00:00"),
|
t_end=get_time("assi_afternoon_time", "18:00:00"),
|
||||||
|
periode_defaut=sco_preferences.get_preference(
|
||||||
|
"periode_defaut", formsemestre_id
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user