From d15d262b87cdfac01a8bd3de78ff03f45b9e908b Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Thu, 26 Nov 2020 15:48:37 -0500 Subject: [PATCH] Fixed bug that resulted in the "download videos in the last X days" timerange in edit subscriptions to come up blank --- .../edit-subscription-dialog.component.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/app/dialogs/edit-subscription-dialog/edit-subscription-dialog.component.ts b/src/app/dialogs/edit-subscription-dialog/edit-subscription-dialog.component.ts index 5d50872..0be5253 100644 --- a/src/app/dialogs/edit-subscription-dialog/edit-subscription-dialog.component.ts +++ b/src/app/dialogs/edit-subscription-dialog/edit-subscription-dialog.component.ts @@ -39,16 +39,12 @@ export class EditSubscriptionDialogComponent implements OnInit { if (this.sub.timerange) { const timerange_str = this.sub.timerange.split('-')[1]; - console.log(timerange_str); const number = timerange_str.replace(/\D/g,''); let units = timerange_str.replace(/[0-9]/g, ''); - console.log(units); - - // // remove plural on units - // if (units[units.length-1] === 's') { - // units = units.substring(0, units.length-1); - // } + if (+number === 1) { + units = units.replace('s', ''); + } this.timerange_amount = parseInt(number); this.timerange_unit = units; @@ -86,12 +82,16 @@ export class EditSubscriptionDialogComponent implements OnInit { } timerangeChanged(value, select_changed) { - console.log(this.timerange_amount); - console.log(this.timerange_unit); + if (+this.timerange_amount === 1) { + this.timerange_unit = this.timerange_unit.replace('s', ''); + } else { + if (!this.timerange_unit.includes('s')) { + this.timerange_unit += 's'; + } + } if (this.timerange_amount && this.timerange_unit && !this.download_all) { this.new_sub.timerange = 'now-' + this.timerange_amount.toString() + this.timerange_unit; - console.log(this.new_sub.timerange); } else { this.new_sub.timerange = null; }