Added several improvements, changes and bug fixes

This commit is contained in:
Robert Vokac 2024-03-16 16:03:13 +00:00
parent a95ca6a58d
commit 1e518b5964
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055

View File

@ -85,10 +85,12 @@ public class DayPanel extends JPanel {
JButton newButton = new JButton("New");
JButton pasteButton = new JButton("Paste");
JButton reviewButton = new JButton("Review");;
JButton reviewButton = new JButton("Review");
JButton statusButton = new JButton("Status");
buttons.add(newButton);
buttons.add(pasteButton);
buttons.add(reviewButton);
buttons.add(statusButton);
add(buttons);
this.scrollPane
@ -166,6 +168,24 @@ public class DayPanel extends JPanel {
.collect(
Collectors.joining("\n"))), null);
});
statusButton.addActionListener(e-> {
List<ActivityPanel> activityPanels = new ArrayList<>();
Arrays
.stream(panelInsideScrollPane.getComponents())
.filter(c-> c instanceof ActivityPanel).forEach(f-> activityPanels.add((ActivityPanel) f));
Collections.sort(activityPanels);
double done = 0d;
double todo = 8d;
for(ActivityPanel ap:activityPanels) {
double now = ap.getActivity().getSpentHours() + ap.getActivity().getSpentMinutes() / 60d;
done = done + now;
todo = todo - now;
}
Utils.showNotification("Current status: done=" + NumberFormats.FORMATTER_TWO_DECIMAL_PLACES.format(done) + "h. todo="+ NumberFormats.FORMATTER_TWO_DECIMAL_PLACES.format(todo));
});
// for (int i = 0; i < 10; i++) {
// add(new ActivityPanel(activityRepository,
// new Activity("id", 2000, 7, 7, "name", "comment", "ticket", 2, 30,