Solving some type issues

This commit is contained in:
Zoe Roux 2020-08-07 00:53:17 +02:00
parent 4d2174287d
commit ede2c9a234
3 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import {ItemType, LibraryItem} from "../../models/resources/library-item";
import {Show, ShowRole} from "../../models/resources/show";
import {Collection} from "../../models/resources/collection";
import {People} from "../../models/resources/people";
export class ItemsUtils
{
@ -12,7 +13,7 @@ export class ItemsUtils
return "/show/" + item.slug;
}
static getDate(item: LibraryItem | Show | ShowRole | Collection): string
static getDate(item: LibraryItem | Show | ShowRole | Collection | People): string
{
if ("role" in item && item.role)
{
@ -23,6 +24,8 @@ export class ItemsUtils
if ("type" in item && item.type && typeof item.type == "string")
return item.type;
if (!("startYear" in item))
return "";
if (item.endYear && item.startYear != item.endYear)
return `${item.startYear} - ${item.endYear}`
return item.startYear?.toString();

View File

@ -32,7 +32,7 @@ export class CollectionComponent
return this.sanitizer.bypassSecurityTrustStyle("url(" + this.collection.poster + ")");
}
getDate(item: LibraryItem | Show | ShowRole | Collection)
getDate(item: LibraryItem | Show | ShowRole | Collection | People)
{
return ItemsUtils.getDate(item);
}

View File

@ -78,7 +78,7 @@
<div class="container-fluid mt-3">
<mat-form-field>
<mat-label>Season</mat-label>
<mat-select [(value)]="season" (selectionChange)="getEpisodes(season.seasonNumber)">
<mat-select [(value)]="season" (selectionChange)="getEpisodes(season)">
<mat-option *ngFor="let season of this.seasons" [value]="season.seasonNumber">{{season.title}}</mat-option>
</mat-select>
</mat-form-field>