up detection min

This commit is contained in:
Tykayn 2024-01-21 00:21:38 +01:00 committed by tykayn
parent 95be931ec8
commit 47273beee5
3 changed files with 66 additions and 33 deletions

View File

@ -1,7 +1,7 @@
<style> <style>
</style> </style>
<main class="main"> <main class="main container-flex">
<div class="content columns"> <div class="content columns">
<div class="left-side column is-4"> <div class="left-side column is-4">
<img <img
@ -9,20 +9,26 @@
alt="logo osm"> alt="logo osm">
<strong> <strong>
Sujets: Sujets
</strong> </strong>
<ul> <ul>
<li class="subject is-clickable is-hoverable hover:has-background-blue" <li class="subject is-clickable is-hoverable hover:has-background-blue"
(click)="setSubject(i)" (click)="setSubject(i)"
*ngFor="let s of subjects; index as i" *ngFor="let s of subjects; index as i"
[ngClass]="{ active: (currentSubjectId +1) == (i+1) }"> [ngClass]="{ active: (currentSubjectId === i) }">
<strong>{{ i + 1 }}) {{ s.title }}</strong> <strong> {{s.id}}) {{ s.title }}</strong>
<p class="is-small"> <p class="is-small">
{{ s.duration }} min, par {{ s.author }}. Reste: {{ resteTopicMinutes(s) }}. {{ s.duration }} min, par {{ s.author }}. Reste: {{ resteTopicMinutes(s) }}.
Passé: {{ round(s.spentSeconds) }}. Passé: {{ round(s.spentSeconds) }}.
</p> </p>
<p *ngIf="s.finished">🎉</p> <p *ngIf="s.finished">🎉</p>
<p class="is-info" *ngIf="isNowTimeBetweenTwoDates(subjects[currentSubjectId].startDate, subjects[currentSubjectId].startDate)">
sujet actuel dans les temps impartis
</p>
<p class="is-warning time-over" *ngIf="isNowTimeBetweenTwoDates(subjects[currentSubjectId].endDate , subjects[currentSubjectId].startDate)">
temps écoulé, sujet suivant.
</p>
</li> </li>
</ul> </ul>
@ -88,6 +94,34 @@
<p> <p>
{{ (hints) }} {{ (hints) }}
</p> </p>
<hr>
<div class="bottom">
<div class="stats">
<h2>
statistiques:
</h2>
{{statsExplication}}
</div>
<hr>
<div class="compte-rendu-infos">
<label for="scribe">scribe</label>
<input type="text" id="scribe" [(ngModel)]="scribe">
<br>
<label for="presents">{{countLinesInPresent()}}présents</label>
<textarea name="presents" id="note" cols="30" rows="10" id="presents" [(ngModel)]="presents"></textarea>
<br>
<label for="début">Début</label>
<input name="presents" id="début" [(ngModel)]="startTime"/>
<br>
<label for="fin">Fin</label>
<input name="presents" id="fin" [(ngModel)]="endTime"/>
</div>
</div>
</div> </div>
<div class="right-side column is-8"> <div class="right-side column is-8">
<div class="pill-group" <div class="pill-group"
@ -117,7 +151,7 @@
<button class="btn is-success" (click)="finishTopic(currentSubjectId)"> <button class="btn is-success" (click)="finishTopic(currentSubjectId)">
fini fini
</button> </button>
<button class="btn btn-primary" (click)="updateProgressEveryPeriod()"> <button class="btn btn-primary" (click)="updateTopicChangeDate()">
up temps up temps
</button> </button>
<br> <br>
@ -150,26 +184,6 @@
<!-- <p>avancement: {{ getPercentProgressTimeForTopic(subjects[currentSubjectId]) }} %</p>--> <!-- <p>avancement: {{ getPercentProgressTimeForTopic(subjects[currentSubjectId]) }} %</p>-->
</div> </div>
<div class="stats">
<h2>
statistiques:
</h2>
{{statsExplication}}
</div>
<hr>
<div class="compte-rendu-infos">
<label for="scribe">scribe</label>
<input type="text" id="scribe" [(ngModel)]="scribe">
<br>
<label for="presents">{{countLinesInPresent()}}présents</label>
<textarea name="presents" id="note" cols="30" rows="10" id="presents" [(ngModel)]="presents"></textarea>
<br>
<label for="début">Début</label>
<input name="presents" id="début" [(ngModel)]="startTime"/>
<br>
<label for="fin">Fin</label>
<input name="presents" id="fin" [(ngModel)]="endTime"/>
</div>
</div> </div>

View File

@ -155,10 +155,10 @@ main {
fill: var(--gray-900); fill: var(--gray-900);
} }
//
//.left-side{ .left-side{
// width: 50%; width: 50%;
//} }
.subject { .subject {
display: block; display: block;
padding: 1rem; padding: 1rem;
@ -169,6 +169,7 @@ main {
width: 20em; width: 20em;
word-break: break-all; word-break: break-all;
word-wrap: break-word; word-wrap: break-word;
padding-left: 2rem;
} }
} }
@ -210,6 +211,10 @@ pre {
} }
} }
.content-current-subject{
padding-left: 10rem;
box-sizing:border-box;
}
@media screen and (max-width: 650px) { @media screen and (max-width: 650px) {
.content { .content {
flex-direction: column; flex-direction: column;

View File

@ -38,8 +38,8 @@ export class AppComponent implements OnInit, OnDestroy {
presents: string = '- tykayn'; presents: string = '- tykayn';
pasteLand: string = "* Présentation du suivi sur Nextcloud - 5min (tykayn)\n" + pasteLand: string = "* Présentation du suivi sur Nextcloud - 5min (tykayn)\n" +
"* Réduction de bus factor - 5min (tykayn)\n" + "* Réduction de bus factor - 10min (tykayn)\n" +
"* Réunion avec Wikimedia France - 5min (tykayn)\n" + "* Réunion avec Wikimedia France - 25min (tykayn)\n" +
""; "";
statsExplication: string = '' statsExplication: string = ''
@ -145,6 +145,10 @@ export class AppComponent implements OnInit, OnDestroy {
this.startDate = this.makeDateFromHourToday(this.startTime); this.startDate = this.makeDateFromHourToday(this.startTime);
this.endDate = this.makeDateFromHourToday(this.endTime); this.endDate = this.makeDateFromHourToday(this.endTime);
// let self = this;
// this.interval = setInterval(() => {
// self.updateTopicChangeDate()
// }, 5000)
} }
@ -160,7 +164,7 @@ export class AppComponent implements OnInit, OnDestroy {
} }
findMinutesDurationInDescription(topic: string): number { findMinutesDurationInDescription(topic: string): number {
let durationRegex = /-\s(\d+)min/g; let durationRegex = /-\s(\d+)\s?min/g;
let matches = durationRegex.exec(topic); let matches = durationRegex.exec(topic);
if (matches) { if (matches) {
return parseInt(matches[1]); return parseInt(matches[1]);
@ -207,7 +211,7 @@ export class AppComponent implements OnInit, OnDestroy {
} }
resteTopicMinutes(topic: Topic) { resteTopicMinutes(topic: Topic) {
return this.round(topic.spentSeconds / topic.duration * 60) + ' min' return this.round(topic.spentSeconds / topic.duration * 60)
} }
@ -271,6 +275,7 @@ export class AppComponent implements OnInit, OnDestroy {
} }
compteRendu: string = '' compteRendu: string = ''
now:Date = new Date();
formatDateYMD(date: Date) { formatDateYMD(date: Date) {
const year = date.getFullYear(); const year = date.getFullYear();
@ -365,4 +370,13 @@ export class AppComponent implements OnInit, OnDestroy {
} }
return Math.floor((date2.getTime() - date1.getTime()) / 1000); return Math.floor((date2.getTime() - date1.getTime()) / 1000);
} }
isNowTimeBetweenTwoDates(date1: Date, date2: Date) {
let min = Math.min(date1.getTime(),date2.getTime());
let max = Math.max(date1.getTime(),date2.getTime());
let now = new Date().getTime();
console.log('min', min, now , max)
return min < now && max > now;
}
} }