<commit_before>import { Component } from '@angular/core';
import { AlertController, NavController } from 'ionic-angular';
import { UserData } from '../../providers/user-data';
import { PhoneOptions } from '../../interfaces/user-options';
import { Storage } from '@ionic/storage';

import { ConferenceData } from '../../providers/conference-data';
import { LocalNotifications } from '@ionic-native/local-notifications';


@Component({
  selector: 'page-watermotor',
  templateUrl: 'watermotor.html'
})
export class WatermotorPage {
  switches: PhoneOptions = { switchassigned: '', chargingtime: '', percentagechargednow: '' };
  submitted = false;
  switchedassignedtowatermotor: any;

  switchonetext: any = 'Switch One';
  switchtwotext: any = 'Switch Two';
  switchthreetext: any = 'Switch Three';
  switchfourtext: any = 'Switch Four';
  switchfivetext: any = 'Switch Five';
  switchsixtext: any = 'Switch Six';
  switchseventext: any = 'Switch Seven';
  switcheighttext: any = 'Switch Eight';

  durationoffullcharge: any;
  percentageofchargingpresent: any = 10;
  msg: any = '';
  switchasgsaved: boolean = false;
  idofwatermotortimer: any;
  iswatermotortimerset: boolean = false;
  diameteroftank: number = 0;
  heightoftank: number = 0;
  liquidheight: number = 0;
  //formulat pi r square into height devided by 1000 cetimeters
  //http://alloiltank.com/tank-volume-calculator/

  
  constructor(public navCtrl: NavController, public userData: UserData, public storage: Storage, public alertCtrl: AlertController, public confData: ConferenceData, private localNotifications: LocalNotifications) 
  {
    this.switchedassignedtowatermotor = 0;

    this.durationoffullcharge = new Date().toISOString();
    this.getData();
  }

  checkWaterLevel()
  {
    this.confData.checkWaterLevel().subscribe((data: any) => {
            console.log(data);        
    }); 
  }


  saveSwitchSelection()
  {
    if(this.switchedassignedtowatermotor == 0)
    {
      this.showAlertSwitchCheck();
      return true;
    }
    
    this.showAlert();
  }

  checkWaterLevel()
  {

    if(this.diameteroftank == 0 || this.heightoftank == 0)
    {
      this.showMsgError();
      return true;
    }

    this.storage.set('diameteroftank',this.diameteroftank);
    this.storage.set('heightoftank',this.heightoftank);

    let howfaristheobjectreadingsrc: any;


    let responsearray: any = [];
    let pointer: any = this;

    setTimeout(function(){ 
        responsearray.push(25);

        setTimeout(function(){ 
            responsearray.push(5);  

            setTimeout(function(){ 
                responsearray.push(25); 

                setTimeout(function(){ 
                    responsearray.push(25);

                    setTimeout(function(){ 
                        responsearray.push(5);  
                        console.log(pointer.removeSmallest(responsearray));

                        console.log(JSON.stringify(pointer.removeSmallest(responsearray)));

                        let min: any = Math.min.apply(null, responsearray);
                        let leftarray: any = responsearray.filter((e: any) => {return e != min});


                        min = Math.min.apply(null, leftarray);
                        leftarray = responsearray.filter((e: any) => {return e != min});
                        
                        alert(JSON.stringify(leftarray));
                        
                        leftarray = pointer.removeSmallest(leftarray);

                        leftarray = pointer.removeSmallest(leftarray);
                        
                        alert(JSON.stringify(leftarray));

                        howfaristheobjectreadingsrc =  leftarray[0] + leftarray[1] + leftarray[2];

                        howfaristheobjectreadingsrc = howfaristheobjectreadingsrc/3;
                        alert(howfaristheobjectreadingsrc);
                        pointer.checkWaterLevelStep2(howfaristheobjectreadingsrc);

                    }, 1000);    

                }, 1000); 

            }, 1000);
<commit_msg>25 july<commit_after>import { Component } from '@angular/core';
import { AlertController, NavController } from 'ionic-angular';
import { UserData } from '../../providers/user-data';
import { PhoneOptions } from '../../interfaces/user-options';
import { Storage } from '@ionic/storage';

import { ConferenceData } from '../../providers/conference-data';
import { LocalNotifications } from '@ionic-native/local-notifications';


@Component({
  selector: 'page-watermotor',
  templateUrl: 'watermotor.html'
})
export class WatermotorPage {
  switches: PhoneOptions = { switchassigned: '', chargingtime: '', percentagechargednow: '' };
  submitted = false;
  switchedassignedtowatermotor: any;

  switchonetext: any = 'Switch One';
  switchtwotext: any = 'Switch Two';
  switchthreetext: any = 'Switch Three';
  switchfourtext: any = 'Switch Four';
  switchfivetext: any = 'Switch Five';
  switchsixtext: any = 'Switch Six';
  switchseventext: any = 'Switch Seven';
  switcheighttext: any = 'Switch Eight';

  durationoffullcharge: any;
  percentageofchargingpresent: any = 10;
  msg: any = '';
  switchasgsaved: boolean = false;
  idofwatermotortimer: any;
  iswatermotortimerset: boolean = false;
  diameteroftank: number = 0;
  heightoftank: number = 0;
  liquidheight: number = 0;
  //formulat pi r square into height devided by 1000 cetimeters
  //http://alloiltank.com/tank-volume-calculator/

  
  constructor(public navCtrl: NavController, public userData: UserData, public storage: Storage, public alertCtrl: AlertController, public confData: ConferenceData, private localNotifications: LocalNotifications) 
  {
    this.switchedassignedtowatermotor = 0;

    this.durationoffullcharge = new Date().toISOString();
    this.getData();
  }



  saveSwitchSelection()
  {
    if(this.switchedassignedtowatermotor == 0)
    {
      this.showAlertSwitchCheck();
      return true;
    }
    
    this.showAlert();
  }

  checkWaterLevel()
  {

    if(this.diameteroftank == 0 || this.heightoftank == 0)
    {
      this.showMsgError();
      return true;
    }

    this.storage.set('diameteroftank',this.diameteroftank);
    this.storage.set('heightoftank',this.heightoftank);

    let howfaristheobjectreadingsrc: any;


    let responsearray: any = [];
    let pointer: any = this;

    this.confData.checkWaterLevel().subscribe((data: any) => {
            console.log(data);        
    }); 
    setTimeout(function(){ 
        responsearray.push(25);

        setTimeout(function(){ 
            responsearray.push(6);  

            setTimeout(function(){ 
                responsearray.push(25); 

                setTimeout(function(){ 
                    responsearray.push(25);

                    setTimeout(function(){ 
                        responsearray.push(5);  
                        //console.log(pointer.removeSmallest(responsearray));

                        //console.log(JSON.stringify(pointer.removeSmallest(responsearray)));

                        let min: any = Math.min.apply(null, responsearray);
                        let leftarrayfirst: any = responsearray.filter((e: any) => {return e != min});
                          //alert(JSON.stringify(leftarrayfirst));

                        min = Math.min.apply(null, leftarrayfirst);
                        let leftarray: any = leftarrayfirst.filter((e: any) => {return e != min});
                        
                        //alert(JSON.stringify(leftarray));
                        
                      
                        //alert(leftarray.length);
                        
                        let i: any = 0;
                        let sumofreadings: any = 0;

                        for(i=0;i<leftarray.length;i++)
                        {
                            sumofreadings = sumofreadings + leftarray[i];
                        }

                        howfaristheobjectreadingsrc = sumofreadings/i+1;
                        alert(howfaristheobjectreadingsrc);
                        pointer.checkWaterLevelStep2(howfaristheobjectreadingsrc);

                    }, 1000);    

                }, 1000); 

            }, 1000);

{'fraction_non_alphanumeric': 0.11405642023346303, 'fraction_numerical': 0.009484435797665369, 'mean_word_length': 2.1941747572815533, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, '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': '7201966', 'n_tokens_mistral': 2386, 'n_tokens_neox': 2201, 'n_words': 445}