Second round of comments for userstory inner table

This commit is contained in:
Nicolai Ort 2020-07-10 22:25:39 +02:00
parent 76210d8d0d
commit bc1c6b06be

View File

@ -65,6 +65,11 @@ export class UserstoryInnerTableComponent extends TableComponentBase<
}
//#region getters
/**
* Returns a filtered list of all userstories that have a selected priority.
* If no pritority to be filtered for is defined it just returns all userstories.
*/
public get filteredItems() {
if (this.filterPriority == null) {
return this.items;
@ -72,10 +77,19 @@ export class UserstoryInnerTableComponent extends TableComponentBase<
return this.items.filter((t) => t.priority == this.filterPriority);
}
/**
* Returns the number of related tasks of a given userstory.
* The relation is defined by the userstoryid property of the task object and the id property of the userstory object.
* @param userstory The userstory for which the number of related tasks gets calculated
*/
public getNumberOfTasks(userstory: ScrumUserstory) {
return this.tasks.filter((t) => t.userstoryid === userstory.id).length;
}
/**
* Returns the title of the status that has the provided id.
* @param id id of the searched status
*/
getStatusTitleById(id) {
var status = this.status.find((x) => x.id === id);
if (!status) {
@ -84,6 +98,10 @@ export class UserstoryInnerTableComponent extends TableComponentBase<
return status.title;
}
/**
* Returns the title of the category that has the provided id.
* @param id id of the searched category
*/
getCategoryTitleById(id) {
var category = this.categories.find((x) => x.id === id);
if (!category) {
@ -94,6 +112,10 @@ export class UserstoryInnerTableComponent extends TableComponentBase<
//#endregion getters
//#region userstoryTableFunctions
/**
* Deletes a userstory by calling the delete method via the backendService and removing it from the tabel's items array.
* @param userstory userstory that will be deleted
*/
public deleteUserstory(userstory: ScrumUserstory) {
this.backendService.deleteUserstory(userstory).subscribe((response) => {
if (response.status > 399) {