-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add aggregated info of selected users to report view (#906)
closes #878 TODOs: - [x] Ausblenden wenn die Ansicht nur für mich ist - [x] Umsetzung der Wochen-Ansicht - [x] angezeigte Zahlen auf Korrektheit verifizieren - aktuell wird mehr SOLL als GEPLANT angezeigt - SOLL (should): geplante Arbeitszeit abzüglich Abwesenheiten - GEPLANT (planned): geplante Arbeitszeit. z. B. in einer Woche 40h bei 5 Tagen a 8h. - ~~[ ] wenn im Graphen ein Tag ausgewählt wird, wie soll sich die Tabelle verhalten?~~ (#911) - ~~Information nur für den Tag anzeigen?~~ - ~~Zusätzlich die Information für diesen Tag anzeigen?~~ Here are some things you should have thought about: **Multi-Tenancy** - [ ] Extended new entities with `AbstractTenantAwareEntity`? - [ ] New entity added to `TenantAwareDatabaseConfiguration`? - [ ] Tested with `dev-multitenant` profile? <!-- Thanks for contributing to the zeiterfassung. Please review the following notes before submitting you pull request. Please look for other issues or pull requests which already work on this topic. Is somebody already on it? Do you need to synchronize? # Security Vulnerabilities 🛑 STOP! 🛑 If your contribution fixes a security vulnerability, please do not submit it. Instead, please write an E-Mail to [email protected] with all the information to recreate the security vulnerability. # Describing Your Changes If, having reviewed the notes above, you're ready to submit your pull request, please provide a brief description of the proposed changes. If they: 🐞 fix a bug, please describe the broken behaviour and how the changes fix it. Please label with 'type: bug' and 'status: new' 🎁 make an enhancement, please describe the new functionality and why you believe it's useful. Please label with 'type: enhancement' and 'status: new' If your pull request relates to any existing issues, please reference them by using the issue number prefixed with #. -->
- Loading branch information
Showing
22 changed files
with
816 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/de/focusshift/zeiterfassung/report/DeltaWorkingHours.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package de.focusshift.zeiterfassung.report; | ||
|
||
import de.focusshift.zeiterfassung.timeentry.ShouldWorkingHours; | ||
import de.focusshift.zeiterfassung.timeentry.WorkDuration; | ||
import de.focusshift.zeiterfassung.workingtime.ZeitDuration; | ||
|
||
import java.time.Duration; | ||
|
||
/** | ||
* Describes the difference between {@linkplain WorkDuration} and {@linkplain ShouldWorkingHours}. | ||
* | ||
* <p> | ||
* Example: {@code WorkDuration(7h) - ShouldWorkingHours(8h) = DeltaWorkingHours(-1h)} | ||
* | ||
* @param duration duration value of the delta | ||
*/ | ||
record DeltaWorkingHours(Duration duration) implements ZeitDuration { | ||
|
||
public static final DeltaWorkingHours ZERO = new DeltaWorkingHours(Duration.ZERO); | ||
public static final DeltaWorkingHours EIGHT_POSITIVE = new DeltaWorkingHours(Duration.ofHours(8)); | ||
public static final DeltaWorkingHours EIGHT_NEGATIVE = new DeltaWorkingHours(Duration.ofHours(8).negated()); | ||
|
||
public boolean isNegative() { | ||
return duration.isNegative(); | ||
} | ||
|
||
/** | ||
* Returns a {@linkplain DeltaWorkingHours} whose value is {@code (this + augend)}. | ||
* | ||
* <p> | ||
* This instance is immutable and unaffected by this method call. | ||
* | ||
* @param augend value to add, not null | ||
* @return a {@linkplain DeltaWorkingHours} whose value is {@code (this + augend)} | ||
* @throws ArithmeticException if numeric overflow occurs | ||
*/ | ||
public DeltaWorkingHours plus(DeltaWorkingHours augend) { | ||
return new DeltaWorkingHours(duration().plus(augend.duration())); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/de/focusshift/zeiterfassung/report/HasWorkDurationByUser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package de.focusshift.zeiterfassung.report; | ||
|
||
import de.focusshift.zeiterfassung.timeentry.ShouldWorkingHours; | ||
import de.focusshift.zeiterfassung.timeentry.WorkDuration; | ||
import de.focusshift.zeiterfassung.user.UserIdComposite; | ||
import de.focusshift.zeiterfassung.workingtime.PlannedWorkingHours; | ||
|
||
import java.util.Map; | ||
|
||
import static java.util.stream.Collectors.toMap; | ||
|
||
interface HasWorkDurationByUser { | ||
|
||
Map<UserIdComposite, WorkDuration> workDurationByUser(); | ||
|
||
Map<UserIdComposite, ShouldWorkingHours> shouldWorkingHoursByUser(); | ||
|
||
Map<UserIdComposite, PlannedWorkingHours> plannedWorkingHoursByUser(); | ||
|
||
/** | ||
* Returns the difference between {@linkplain ShouldWorkingHours} and the {@linkplain WorkDuration}of every user in this week. | ||
* | ||
* @return Map of delta duration for every user in this week | ||
*/ | ||
default Map<UserIdComposite, DeltaWorkingHours> deltaDurationByUser() { | ||
|
||
final Map<UserIdComposite, WorkDuration> workedByUser = workDurationByUser(); | ||
|
||
return shouldWorkingHoursByUser().entrySet().stream().collect(toMap( | ||
Map.Entry::getKey, | ||
entry -> new DeltaWorkingHours(workedByUser.get(entry.getKey()).duration().minus(entry.getValue().duration())) | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.