private static void printForHiszilla() { Map<String, Long> minutesByHiszillaId = new HashMap<String, Long>(); for (DayAtWork day : days) { for (WorkActivity activity : day.getActivities()) { if (activity.isAlreadyBookedInHiszilla()) continue; String hiszillaId = activity.getHiszillaId(); if (hiszillaId == null) continue; long time = activity.getWorktimeInMinutes(); Long total = minutesByHiszillaId.get(hiszillaId); if (total == null) { total = time; } else { total = total.longValue() + time; } minutesByHiszillaId.put(hiszillaId, total); } } for (Entry<String, Long> entry : minutesByHiszillaId.entrySet()) { Long minutes = entry.getValue(); String hiszillaId = entry.getKey(); String time = String.valueOf(minutes.floatValue() / 60f); System.out.println( time + " | " + hiszillaId + " | https://hiszilla.his.de/hiszilla/show_bug.cgi?id=" + hiszillaId); } }
private static String determineAchievoIdByHiszillaId(String hiszillaId, String text) { if (hiszillaId == null) return null; for (DayAtWork day : days) { for (WorkActivity activity : day.getActivities()) { if (activity.getAchievoId() == null) continue; if (hiszillaId.equals(activity.getHiszillaId())) return activity.getAchievoId(); } } System.out.println("Achievo-ID fehlt. Hiszilla: " + hiszillaId + " Text: " + text); return null; }
private static String determineAchievoIdByText(String text) { if ("Product Backlog Refinement".equals(text)) return "22804"; for (DayAtWork day : days) { for (WorkActivity activity : day.getActivities()) { if (activity.getAchievoId() == null) continue; if (Str.isBlank(activity.getText())) continue; if (text.equals(activity.getText())) return activity.getAchievoId(); } } System.out.println("Achievo-ID fehlt. Text: " + text); return null; }
private static void writeCsv(File file) throws IOException { FileWriter out = new FileWriter(file); CsvWriter csv = new CsvWriter(out); int currentMonth = 0; for (DayAtWork day : days) { if (currentMonth != day.getDate().getMonth()) { currentMonth = day.getDate().getMonth(); csv.closeRecord(); csv.closeRecord(); } for (WorkActivity activity : day.getActivities()) { if (!activity.isBookingRequired()) continue; activity.appendTo(csv); } } out.close(); }
private static void determineAchievoIds() { for (DayAtWork day : days) { for (WorkActivity activity : day.getActivities()) { if (!activity.isBookingRequired()) continue; if (activity.getAchievoId() != null) continue; String hiszillaId = activity.getHiszillaId(); if (hiszillaId != null) { activity.setAchievoId(determineAchievoIdByHiszillaId(hiszillaId, activity.getText())); } else { activity.setAchievoId(determineAchievoIdByText(activity.getText())); } } } }