merge declaration and initialisation of speed in TorrentStatusPipe
This commit is contained in:
parent
08c1750def
commit
f5f2760f80
1 changed files with 2 additions and 4 deletions
|
|
@ -2,7 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core';
|
||||||
import { RealDebridStatus, Torrent } from './models/torrent.model';
|
import { RealDebridStatus, Torrent } from './models/torrent.model';
|
||||||
import { FileSizePipe } from './filesize.pipe';
|
import { FileSizePipe } from './filesize.pipe';
|
||||||
|
|
||||||
@Pipe({ name: 'status', })
|
@Pipe({ name: 'status' })
|
||||||
export class TorrentStatusPipe implements PipeTransform {
|
export class TorrentStatusPipe implements PipeTransform {
|
||||||
constructor(private pipe: FileSizePipe) {}
|
constructor(private pipe: FileSizePipe) {}
|
||||||
|
|
||||||
|
|
@ -32,9 +32,7 @@ export class TorrentStatusPipe implements PipeTransform {
|
||||||
|
|
||||||
let allSpeeds = downloading.reduce((sum, m) => sum + m.speed, 0);
|
let allSpeeds = downloading.reduce((sum, m) => sum + m.speed, 0);
|
||||||
|
|
||||||
let speed: string | string[] = '0';
|
const speed: string | string[] = this.pipe.transform(allSpeeds, 'filesize');
|
||||||
|
|
||||||
speed = this.pipe.transform(allSpeeds, 'filesize');
|
|
||||||
|
|
||||||
return `Downloading file ${downloading.length + downloaded.length}/${
|
return `Downloading file ${downloading.length + downloaded.length}/${
|
||||||
torrent.downloads.length
|
torrent.downloads.length
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue