forked from ScoDoc/ScoDoc
Assiduites : ajout préférence : durée créneau
This commit is contained in:
parent
30781ba9aa
commit
4d5c1a84c3
@ -620,6 +620,17 @@ class BasePreferences(object):
|
||||
"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",
|
||||
{
|
||||
|
@ -1263,7 +1263,9 @@ function actualizeEtud(etudid) {
|
||||
*/
|
||||
function generateAllEtudRow() {
|
||||
if (isSingleEtud()) {
|
||||
actualizeEtud(etudid);
|
||||
try {
|
||||
actualizeEtud(etudid);
|
||||
} catch (ignored) {}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,10 @@
|
||||
|
||||
const timelineContainer = document.querySelector(".timeline-container");
|
||||
const periodTimeLine = document.querySelector(".period");
|
||||
const t_start = {{ t_start }}
|
||||
const t_end = {{ t_end }}
|
||||
const t_start = {{ t_start }};
|
||||
const t_end = {{ t_end }};
|
||||
|
||||
const period_default = {{ periode_defaut }};
|
||||
|
||||
function createTicks() {
|
||||
let i = t_start
|
||||
@ -157,7 +159,7 @@
|
||||
const computedValues = [Math.max(startValue, t_start), Math.min(t_end, endValue)]
|
||||
|
||||
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) {
|
||||
@ -168,6 +170,8 @@
|
||||
}
|
||||
|
||||
function setPeriodValues(deb, fin) {
|
||||
deb = snapToQuarter(deb)
|
||||
fin = snapToQuarter(fin)
|
||||
let leftPercentage = (deb - t_start) / (t_end - t_start) * 100
|
||||
let widthPercentage = (fin - deb) / (t_end - t_start) * 100
|
||||
periodTimeLine.style.left = `${leftPercentage}%`
|
||||
@ -199,7 +203,7 @@
|
||||
}
|
||||
|
||||
createTicks();
|
||||
setPeriodValues(8, 9)
|
||||
setPeriodValues(t_start, t_start + period_default)
|
||||
|
||||
</script>
|
||||
<style>
|
||||
|
@ -444,9 +444,12 @@ def _module_selector(
|
||||
)
|
||||
|
||||
|
||||
def _timeline() -> HTMLElement:
|
||||
def _timeline(formsemestre_id=None) -> HTMLElement:
|
||||
return render_template(
|
||||
"assiduites/timeline.j2",
|
||||
t_start=get_time("assi_morning_time", "08: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