diff --git a/src/app/backlog-table/backlog.component.ts b/src/app/backlog-table/backlog.component.ts
index cb7fccc..a99e19a 100644
--- a/src/app/backlog-table/backlog.component.ts
+++ b/src/app/backlog-table/backlog.component.ts
@@ -27,7 +27,7 @@ export class BacklogComponent extends TableComponentBase<
public filterPriority: string | null = null;
public status: ScrumStatus[] = [];
public categories: ScrumCategory[] = [];
- public currentSprint: ScrumSprint;
+ public sprints: ScrumSprint[] = [];
public backlog: ScrumUserstory[] = [];
public choosen: ScrumUserstory[] = [];
@@ -38,13 +38,19 @@ export class BacklogComponent extends TableComponentBase<
private route: ActivatedRoute,
) {
super();
-
+ backendService.getSprints().subscribe((response) => {
+ if (response.status > 399) {
+ alert('Fehler');
+ } else {
+ this.sprints.push(...response.body);
+ }
+ });
backendService.getUserstories().subscribe((response) => {
if (response.status > 399) {
alert('Fehler');
} else {
- this.items.push(...response.body);
- this.backlog = this.items;
+ this.backlog = response.body.filter(u => u.sprintid == null);
+ this.choosen = response.body.filter(u => u.sprintid == this.currentSprint.id);
}
});
backendService.getTasks().subscribe((response) => {
@@ -68,7 +74,6 @@ export class BacklogComponent extends TableComponentBase<
this.categories.push(...response.body);
}
});
- this.getCurrentSprint();
}
public deleteUserstory(userstory: ScrumUserstory) {
@@ -101,38 +106,6 @@ export class BacklogComponent extends TableComponentBase<
return this.tasks.filter((t) => t.userstoryid === userstory.id).length;
}
- public sortById() {
- this.doNumericSort('id', (us) => us.id);
- }
-
- public sortByTitle() {
- this.doStringSort('title', (us) => us.title);
- }
-
- public sortByPrio() {
- this.doNumericSort('priority', (us) => getNumberForPriority(us.priority));
- }
-
- public sortByTasks() {
- this.doNumericSort('tasks', (us) => this.getNumberOfTasks(us));
- }
-
- sortByStatus() {
- this.doNumericSort('statusid', (us) => us.statusid);
- }
-
- sortByCategory() {
- this.doNumericSort('categoryid', (us) => us.categoryid);
- }
-
- getStatusTitleById(id) {
- var status = this.status.find((x) => x.id === id);
- if (!status) {
- return 'N/A';
- }
- return status.title;
- }
-
getCategoryTitleById(id) {
var category = this.categories.find((x) => x.id === id);
if (!category) {
@@ -147,23 +120,29 @@ export class BacklogComponent extends TableComponentBase<
this.choosen.push(userstory);
const index = this.backlog.indexOf(userstory);
this.backlog.splice(index, 1);
-
+ userstory.sprintid = this.currentSprint.id;
+ this.backendService.putUserstory(userstory).subscribe((response) => {
+ if (response.status > 399) {
+ alert('Fehler');
+ }
+ });
}
- public deleteFromSprintBacklog(userstory: ScrumUserstory){
+ public deleteFromSprintBacklog(userstory: ScrumUserstory){
const index = this.choosen.indexOf(userstory);
this.choosen.splice(index, 1);
- this.backlog.push(userstory);
+ this.backlog.push(userstory)
+ userstory.sprintid = null;
+ this.backendService.putUserstory(userstory).subscribe((response) => {
+ if (response.status > 399) {
+ alert('Fehler');
+ }
+ });
}
- public getCurrentSprint()
- {
- this.backendService.getSprints().subscribe((response) => {
- if (response.status > 399) {
- } else {
- const now = Date.now();
- this.currentSprint = response.body.find(s => Date.parse(s.startDate) < now && Date.parse(s.endDate) > now);
- }});
+ public get currentSprint(): ScrumSprint {
+ const now = Date.now();
+ return this.sprints.find(s => Date.parse(s.startDate) < now && Date.parse(s.endDate) > now);
}
public openSprintForm(editSprint?: ScrumSprint) {