remove some logs, start percent

This commit is contained in:
Tykayn 2024-05-22 11:50:28 +02:00 committed by tykayn
parent 25334bae90
commit 32aff9701e
3 changed files with 39 additions and 17 deletions

View File

@ -31,7 +31,19 @@
</p> </p>
</li> </li>
</ul> </ul>
<div class="debug_time_proxy" *ngIf="debug_proxy_time">
Débug du proxy de temps.
On utilise pas directement l'heure actuelle pour comparer les durées afin de rendre le tout testable.
Heure proxy:
{{timeProxy.hour}} :
{{timeProxy.min}}
Heure réelle:
{{now.getHours()}} :
{{timeProxy.min}}
</div>
<div class="pad"> <div class="pad">
<h2> <h2>
@ -182,7 +194,7 @@
</div> </div>
<!-- <p>avancement: {{ getPercentProgressTimeForTopic(subjects[currentSubjectId]) }} %</p>--> <p>avancement: {{ getPercentProgressTimeForTopic(subjects[currentSubjectId]) }} %</p>
</div> </div>
</div> </div>

View File

@ -156,20 +156,21 @@ main {
} }
.left-side{ .left-side {
width: 50%; width: 21em;
} }
.subject { .subject {
display: block; display: block;
padding: 1rem; padding: 1rem 1rem 1rem 2rem;
border-left: 10px solid white; border-left: 10px solid white;
width: 20em;
&.active { &.active {
border-left-color: #00b89c; border-left-color: #00b89c;
width: 20em;
word-break: break-all; word-break: break-all;
word-wrap: break-word; word-wrap: break-word;
padding-left: 2rem;
} }
} }
@ -211,10 +212,11 @@ pre {
} }
} }
.content-current-subject{ .content-current-subject {
padding-left: 10rem; padding-left: 5rem;
box-sizing:border-box; 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

@ -25,6 +25,8 @@ export class AppComponent implements OnInit, OnDestroy {
// startTime: string = "17:00"; // startTime: string = "17:00";
endTime: string = "22:00"; endTime: string = "22:00";
now: Date = new Date();
timeProxy: any = { timeProxy: any = {
hour: 10, hour: 10,
min: 30, min: 30,
@ -144,10 +146,11 @@ 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; let self = this;
// this.interval = setInterval(() => { this.interval = setInterval(() => {
self.now = new Date()
// self.updateTopicChangeDate() // self.updateTopicChangeDate()
// }, 5000) }, 1000)
} }
@ -192,13 +195,18 @@ export class AppComponent implements OnInit, OnDestroy {
getPercentProgressTimeForTopic(topic: Topic) { getPercentProgressTimeForTopic(topic: Topic) {
let now = new Date(); let now = new Date();
console.log('topic démarré', topic.startDate.getTime()) // console.log('topic démarré', topic.startDate.getTime())
console.log('topic va se finir', topic.endDate.getTime(), topic.endDate.getTime() - topic.startDate.getTime()) // console.log('topic va se finir', topic.endDate.getTime(), topic.endDate.getTime() - topic.startDate.getTime())
return Math.floor((now.getTime() - topic.startDate.getTime()) / (topic.endDate.getTime() - topic.startDate.getTime()) * 100); return Math.floor((now.getTime() - topic.startDate.getTime()) / (topic.endDate.getTime() - topic.startDate.getTime()) * 100);
} }
/**
* clore un sujet, mettre à jour le nombre de secondes passées
* @param currentSubjectId
*/
finishTopic(currentSubjectId: number) { finishTopic(currentSubjectId: number) {
this.subjects[currentSubjectId].finished = true this.subjects[currentSubjectId].finished = true
this.nextSubject()
} }
/** /**
@ -274,7 +282,8 @@ export class AppComponent implements OnInit, OnDestroy {
} }
compteRendu: string = '' compteRendu: string = ''
now:Date = new Date(); // now:Date = new Date();
debug_proxy_time: boolean = true;
formatDateYMD(date: Date) { formatDateYMD(date: Date) {
const year = date.getFullYear(); const year = date.getFullYear();
@ -375,7 +384,6 @@ export class AppComponent implements OnInit, OnDestroy {
let min = Math.min(date1.getTime(),date2.getTime()); let min = Math.min(date1.getTime(),date2.getTime());
let max = Math.max(date1.getTime(),date2.getTime()); let max = Math.max(date1.getTime(),date2.getTime());
let now = new Date().getTime(); let now = new Date().getTime();
console.log('min', min, now , max)
return min < now && max > now; return min < now && max > now;
} }
} }