From 7ce8b20841e8a16740aa1ec319737ee1283637a6 Mon Sep 17 00:00:00 2001 From: ASH Date: Tue, 30 Apr 2019 22:05:57 +0400 Subject: [PATCH] #79 fixing bug --- src/main/java/ru/ulstu/students/service/TaskService.java | 9 ++++++--- src/main/resources/public/js/tasks.js | 8 ++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/ru/ulstu/students/service/TaskService.java b/src/main/java/ru/ulstu/students/service/TaskService.java index d35720d..0fab0be 100644 --- a/src/main/java/ru/ulstu/students/service/TaskService.java +++ b/src/main/java/ru/ulstu/students/service/TaskService.java @@ -130,12 +130,15 @@ public class TaskService { return newTask; } + @Transactional public void generateYearTasks() { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); - List tasks = taskRepository.findToGenerate(cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.YEAR)); - System.out.println(cal.get(Calendar.DAY_OF_MONTH) + " " + cal.get(Calendar.MONTH)); - tasks.forEach(task -> taskRepository.save(copyYearTask(task))); + List tasks = taskRepository.findToGenerate(cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.YEAR) - 1); + tasks.forEach(task -> { + Task newTask = copyYearTask(task); + taskRepository.save(newTask); + }); } public List getTaskStatuses() { diff --git a/src/main/resources/public/js/tasks.js b/src/main/resources/public/js/tasks.js index f756199..0eb2da6 100644 --- a/src/main/resources/public/js/tasks.js +++ b/src/main/resources/public/js/tasks.js @@ -21,6 +21,14 @@ $(document).ready(function () { $("#input-tag").keyup(function (event) { if(event.keyCode == 13 || event.keyCode == 188) { var tagNumber = $("#tags .tag").length; + if(length != 0) { + tagNumber = $("#tags .tag").last() + .children('input') + .attr("name") + .split(']')[0] + .split('[')[1]; + tagNumber++; + } var tagName = $.trim($(this).val()); var addTag = true; // проверка, добавлен ли этот тег