<commit_before>import { Component, OnInit, ViewChild } from '@angular/core';
import { NgbActiveModal, NgbCalendar, NgbTimepicker } from '@ng-bootstrap/ng-bootstrap';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';

@Component({
    selector: 'app-mezzo-actions-modal',
    templateUrl: './mezzo-actions-modal.component.html',
    styleUrls: ['./mezzo-actions-modal.component.css']
})
export class MezzoActionsModalComponent implements OnInit {

    @ViewChild('timepickerRef') timepickerRef: NgbTimepicker;

    time = { hour: 13, minute: 30, second: 0 };

    timeActionForm: FormGroup;
    submitted: boolean;

    todayDate: any;
    dateNow: any;

    navigation: 'select';
    outsideDays: 'visible';

    title: string;
    titleStato: string;
    statoMezzo: string;
    dataInViaggio: any;

    listaEventi: any;
    ultimoMezzo = false;

    checkbox: { sospesa: boolean, chiusa: boolean, aperta: boolean } = {
        sospesa: true,
        chiusa: false,
        aperta: false,
    };
    azioneIntervento: string;

    constructor(public modal: NgbActiveModal, private fb: FormBuilder, calendar: NgbCalendar) {
        this.todayDate = calendar.getToday();
        this.dateNow = calendar.getToday();
    }

    ngOnInit(): void {
        setInterval(() => {
            this.updateNowDate();
        }, 1000);
        this.initForm();
        this.checkUltimoMezzo();
    }

    initForm(): void {
        this.formatTime();
        this.timeActionForm = this.fb.group({
            orarioAttuale: [this.title !== 'Modifica'],
            orarioPersonalizzato: [this.title === 'Modifica'],
            nowDate: [new Date()],<commit_msg>Fix cambio stato mezzo clear interval<commit_after>import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { NgbActiveModal, NgbCalendar, NgbTimepicker } from '@ng-bootstrap/ng-bootstrap';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';

@Component({
    selector: 'app-mezzo-actions-modal',
    templateUrl: './mezzo-actions-modal.component.html',
    styleUrls: ['./mezzo-actions-modal.component.css']
})
export class MezzoActionsModalComponent implements OnInit, OnDestroy {

    @ViewChild('timepickerRef') timepickerRef: NgbTimepicker;

    time = { hour: 13, minute: 30, second: 0 };

    timeActionForm: FormGroup;
    submitted: boolean;

    todayDate: any;
    dateNow: any;

    navigation: 'select';
    outsideDays: 'visible';

    title: string;
    titleStato: string;
    statoMezzo: string;
    dataInViaggio: any;

    listaEventi: any;
    ultimoMezzo = false;

    checkbox: { sospesa: boolean, chiusa: boolean, aperta: boolean } = {
        sospesa: true,
        chiusa: false,
        aperta: false,
    };
    azioneIntervento: string;

    nowDateInterval: any;

    constructor(public modal: NgbActiveModal, private fb: FormBuilder, calendar: NgbCalendar) {
        this.todayDate = calendar.getToday();
        this.dateNow = calendar.getToday();
    }

    ngOnInit(): void {
        this.nowDateInterval = setInterval(() => {
            this.updateNowDate();
        }, 1000);
        this.initForm();
        this.checkUltimoMezzo();
    }

    ngOnDestroy(): void {
        if (this.nowDateInterval) {
            clearInterval(this.nowDateInterval);
        }
    }

    initForm(): void {
        this.formatTime();
        this.timeActionForm = this.fb.group({
            orarioAttuale: [this.title !== 'Modifica'],
            orarioPersonalizzato: [this.title === 'Modifica'],
            nowDate: [new Date()],
{'fraction_non_alphanumeric': 0.12794612794612795, 'fraction_numerical': 0.005050505050505051, 'mean_word_length': 2.9175824175824174, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3878672', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1071, 'n_words': 238}