All files / src/app/linqpad-review-pages/referentials/services referentials-format.service.ts

100% Statements 15/15
83.33% Branches 5/6
100% Functions 3/3
100% Lines 13/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  1x   1x   1x 6x       1x 1x 1x 1x 1x 1x 1x   1x   1x  
import { IFileInfo } from '../../../model/fileInfo.model';
import { FormatService } from '../../../services/data-service/format.service';
 
export class ReferentialsFormatService extends FormatService {
 
  getBadgeColor(metric) {
    return metric === 0 ? 'green'
      : metric < 10 ? 'orange' : 'red';
  }
 
  getMetric(tempDiv: HTMLElement): number {
    let total = 0;
    const elementsWithColumnTotal = tempDiv.getElementsByClassName('columntotal');
    const totalAsString = elementsWithColumnTotal[3].innerHTML;
    const isnum = /^\d+$/.test(totalAsString);
    Eif (isnum) {
      total = Number(totalAsString);
    }
    return total;
  }
}