Skip to content

Commit

Permalink
FIX Problème d'affichage des données
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainAntunes committed Dec 25, 2022
1 parent b755d10 commit 5d0b606
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
18 changes: 12 additions & 6 deletions kairos-api/Kairos.API/Controllers/StudiesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,16 @@ public async Task<ActionResult> StopStudies()
// On supprime l'ancienne session
_memoryCache.Remove(userContext.UserId);

// Si la session a été actualisé il y a moins de 2 {MinutesMinimumHeatbeat} minutes minutes
if (liveStudy.LastRefresh.AddMinutes(MinutesMinimumHeatbeat) < DateTime.UtcNow)
{
// On la sauvegarde dans la base de données avec le temps du dernier battement
var study = new Studies(Guid.NewGuid().ToString(),
((int) (liveStudy.LastRefresh - liveStudy.StartTime).TotalSeconds).ToString(
CultureInfo.InvariantCulture),
liveStudy.StartTime, GetPersonalGroup());
var study = new Studies(
Guid.NewGuid().ToString(),
((int) (liveStudy.LastRefresh - liveStudy.StartTime).TotalSeconds).ToString(CultureInfo.InvariantCulture),
liveStudy.StartTime,
GetPersonalGroup()
);

study.Labels = new List<Label>();
liveStudy.Labels.ForEach(label =>
Expand All @@ -208,9 +211,12 @@ public async Task<ActionResult> StopStudies()
else
{
// On la sauvegarde dans la base de données avec le temps actuel
var study = new Studies(Guid.NewGuid().ToString(),
var study = new Studies(
Guid.NewGuid().ToString(),
((int) (DateTime.UtcNow - liveStudy.LastRefresh).TotalSeconds).ToString(CultureInfo.InvariantCulture),
liveStudy.StartTime, GetPersonalGroup());
liveStudy.StartTime,
GetPersonalGroup()
);

study.Labels = new List<Label>();
liveStudy.Labels.ForEach(label =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class StatisticsComponent implements AfterViewInit {
this.modalDialogService.displayModal(error.error.message)
},
next: (hoursPerLabel: IHoursStudiedWeekLabelModel) => {
this.timeBarChartData.labels = hoursPerLabel.label;
this.timeBarChartData.labels = hoursPerLabel.labels;
this.timeBarChartData.datasets[0].data = hoursPerLabel.hours;

this.refreshChart();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface IHoursStudiedWeekModel {
}

export interface IHoursStudiedWeekLabelModel {
label: string[];
labels: string[];
hours: number[];
}

Expand Down
14 changes: 8 additions & 6 deletions kairos-web/src/app/services/timer/timer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import { ModalDialogService } from '../modal-dialog/modal-dialog.service';
providedIn: 'root'
})
export class TimerService implements OnDestroy {

private subscription: Subscription[] = [];

base: any;
intervalHeartbeat: any;
private subscription: Subscription[] = [];
labelId: string = "";
minuteStr: string;
secondStr: string;
Expand All @@ -21,9 +23,9 @@ export class TimerService implements OnDestroy {
isStarted: boolean = false;
isCollapsed: boolean = false;

constructor(private modalDialog: ModalDialogService,
private alertDialog: AlertDialogService,
private http: HttpClient,
constructor(private modalDialog: ModalDialogService,
private alertDialog: AlertDialogService,
private http: HttpClient,
private auth: AuthService) {
this.getValues();
this.minuteStr = this.updateTime(this.minute);
Expand Down Expand Up @@ -112,13 +114,13 @@ export class TimerService implements OnDestroy {
var modalSubscription = (this.modalDialog.modalValue.subscribe((data => {
if (data) {
this.stopCountdown();
result = data;
result = data;
} else {
modalSubscription.unsubscribe();
}
})
));

return result;
}

Expand Down

0 comments on commit 5d0b606

Please sign in to comment.