Skip to content

Commit 596fce3

Browse files
committed
bugfixing
1 parent 9fece45 commit 596fce3

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed
Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,17 @@
11
package org.woehlke.simpleworklist.task;
22

3-
import java.util.List;
4-
import java.util.Locale;
5-
63
import lombok.extern.slf4j.Slf4j;
7-
import org.springframework.beans.factory.annotation.Autowired;
8-
import javax.validation.Valid;
94

105
import org.springframework.stereotype.Controller;
11-
import org.springframework.ui.Model;
12-
import org.springframework.validation.BindingResult;
13-
import org.springframework.validation.ObjectError;
146
import org.springframework.web.bind.annotation.*;
157
import org.woehlke.simpleworklist.common.AbstractController;
16-
import org.woehlke.simpleworklist.taskstate.TaskMoveService;
17-
import org.woehlke.simpleworklist.context.Context;
188
import org.woehlke.simpleworklist.project.Project;
199

2010
@Slf4j
2111
@Controller
2212
@RequestMapping(path = "/task")
2313
public class TaskController extends AbstractController {
2414

25-
private final TaskMoveService taskMoveService;
26-
private final TaskControllerService taskControllerService;
27-
28-
@Autowired
29-
public TaskController(TaskMoveService taskMoveService, TaskControllerService taskControllerService) {
30-
this.taskMoveService = taskMoveService;
31-
this.taskControllerService = taskControllerService;
32-
}
33-
34-
3515
@RequestMapping(path = "/delete/{taskId}", method = RequestMethod.GET)
3616
public final String deleteTaskGet(@PathVariable("taskId") Task task) {
3717
if(task!= null){
@@ -52,8 +32,8 @@ public final String undeleteTaskGet(@PathVariable("taskId") Task task) {
5232

5333
@RequestMapping(path = "/transform/{taskId}", method = RequestMethod.GET)
5434
public final String transformTaskIntoProjectGet(@PathVariable("taskId") Task task) {
55-
long projectId = 0;
5635
if(task != null) {
36+
long projectId = 0;
5737
if (task.getProject() != null) {
5838
projectId = task.getProject().getId();
5939
}
@@ -68,8 +48,13 @@ public final String transformTaskIntoProjectGet(@PathVariable("taskId") Task tas
6848
taskService.delete(task);
6949
projectId = thisProject.getId();
7050
log.info("tried to transform Task " + task.getId() + " to new Project " + projectId);
51+
if(projectId == 0){
52+
return "redirect:/project/root/";
53+
} else {
54+
return "redirect:/project/" + projectId + "/";
55+
}
7156
}
72-
return "redirect:/project/" + projectId + "/";
57+
return "redirect:/taskstate/inbox";
7358
}
7459

7560
}

src/main/java/org/woehlke/simpleworklist/task/TaskEditController.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ public final String editTaskPost(
6666
@PathVariable long taskId,
6767
@Valid Task task,
6868
@ModelAttribute("userSession") UserSessionBean userSession,
69-
BindingResult result, Locale locale, Model model) {
69+
BindingResult result,
70+
Locale locale,
71+
Model model
72+
) {
7073
Task persistentTask = taskService.findOne(taskId);
7174
long projectId = 0;
7275
Project thisProject;

0 commit comments

Comments
 (0)