<commit_before>import { CanActivate, ActivatedRouteSnapshot, Router } from "@angular/router"
import { Injectable } from "@angular/core";
import { ProvinceService } from "../shared/province.service";


@Injectable()
export class ProvinceDetailActivator implements CanActivate {
  constructor(private provinceService: ProvinceService, private router:Router) {}

  canActivate(route: ActivatedRouteSnapshot) {
   const provinceExists = !!this.provinceService.getProvince(route.params['provinceCode']);

   if(!provinceExists) {
      this.router.navigate(['/404'])
    }
    return provinceExists;
  }
}<commit_msg>update province-detail activator<commit_after>import { CanActivate, ActivatedRouteSnapshot, Router } from "@angular/router"
import { Injectable } from "@angular/core";
import { ProvinceService } from "../shared/province.service";


@Injectable()
export class ProvinceDetailActivator implements CanActivate {
  constructor(private provinceService: ProvinceService, private router: Router) {}

  canActivate(route: ActivatedRouteSnapshot) {
    this.provinceService.getProvince(route.params['provinceCode']).subscribe(provinceExists => {
      if (!provinceExists) {
        this.router.navigate(['/404']);
      }
    });
    return true;
  }
}
{'fraction_non_alphanumeric': 0.12111553784860558, 'fraction_numerical': 0.004780876494023904, 'mean_word_length': 5.343434343434343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5213165', 'n_tokens_mistral': 351, 'n_tokens_neox': 341, 'n_words': 70}