Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
4 changed files with 26 additions and 6 deletions
Showing only changes of commit 4d5c1a84c3 - Show all commits

View File

@ -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",
{

View File

@ -1263,7 +1263,9 @@ function actualizeEtud(etudid) {
*/
function generateAllEtudRow() {
if (isSingleEtud()) {
try {
actualizeEtud(etudid);
} catch (ignored) {}
return;
}

View File

@ -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>

View File

@ -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
),
)