import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { Observable } from 'rxjs';
import { SubjectsService } from 'src/app/core/service/settings/subjects.service';
import { TestingInformationService } from 'src/app/core/service/testing-information/testing-information.service';
import { createQueryStringFromObject } from 'src/app/shared/util/func';

@Component({
  selector: 'app-grade-summary',
  templateUrl: './grade-summary.container.html',
  styleUrls: ['./grade-summary.container.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class GradeSummaryContainer implements OnInit {
  testingInfo$ = new Observable()
  constructor(
    private testingInformationSV: TestingInformationService
  ) { }

  ngOnInit(): void {
    this.testingInfo$ = this.testingInformationSV.getAll()
  }

  search(query){
    
    if(query) return this.testingInfo$ = this.testingInformationSV.search(`?${query}`)
    if(!query) return this.testingInfo$ = this.testingInformationSV.getAll()
  }

}
