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>
<main class="main">
<main class="main container-flex">
<div class="content columns">
<div class="left-side column is-4">
<img
@ -9,20 +9,26 @@
alt="logo osm">
<strong>
Sujets:
Sujets
</strong>
<ul>
<li class="subject is-clickable is-hoverable hover:has-background-blue"
(click)="setSubject(i)"
*ngFor="let s of subjects; index as i"
[ngClass]="{ active: (currentSubjectId +1) == (i+1) }">
<strong>{{ i + 1 }}) {{ s.title }}</strong>
[ngClass]="{ active: (currentSubjectId === i) }">
<strong> {{s.id}}) {{ s.title }}</strong>
<p class="is-small">
{{ s.duration }} min, par {{ s.author }}. Reste: {{ resteTopicMinutes(s) }}.
Passé: {{ round(s.spentSeconds) }}.
</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>
</ul>
@ -88,6 +94,34 @@
<p>
{{ (hints) }}
</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 class="right-side column is-8">
<div class="pill-group"
@ -117,7 +151,7 @@
<button class="btn is-success" (click)="finishTopic(currentSubjectId)">
fini
</button>
<button class="btn btn-primary" (click)="updateProgressEveryPeriod()">
<button class="btn btn-primary" (click)="updateTopicChangeDate()">
up temps
</button>
<br>
@ -150,26 +184,6 @@
<!-- <p>avancement: {{ getPercentProgressTimeForTopic(subjects[currentSubjectId]) }} %</p>-->
</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>

View File

@ -155,10 +155,10 @@ main {
fill: var(--gray-900);
}
//
//.left-side{
// width: 50%;
//}
.left-side{
width: 50%;
}
.subject {
display: block;
padding: 1rem;
@ -169,6 +169,7 @@ main {
width: 20em;
word-break: break-all;
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) {
.content {
flex-direction: column;

View File

@ -38,8 +38,8 @@ export class AppComponent implements OnInit, OnDestroy {
presents: string = '- tykayn';
pasteLand: string = "* Présentation du suivi sur Nextcloud - 5min (tykayn)\n" +
"* Réduction de bus factor - 5min (tykayn)\n" +
"* Réunion avec Wikimedia France - 5min (tykayn)\n" +
"* Réduction de bus factor - 10min (tykayn)\n" +
"* Réunion avec Wikimedia France - 25min (tykayn)\n" +
"";
statsExplication: string = ''
@ -145,6 +145,10 @@ export class AppComponent implements OnInit, OnDestroy {
this.startDate = this.makeDateFromHourToday(this.startTime);
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 {
let durationRegex = /-\s(\d+)min/g;
let durationRegex = /-\s(\d+)\s?min/g;
let matches = durationRegex.exec(topic);
if (matches) {
return parseInt(matches[1]);
@ -207,7 +211,7 @@ export class AppComponent implements OnInit, OnDestroy {
}
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 = ''
now:Date = new Date();
formatDateYMD(date: Date) {
const year = date.getFullYear();
@ -365,4 +370,13 @@ export class AppComponent implements OnInit, OnDestroy {
}
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;
}
}