Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
criluc committed Sep 19, 2022
2 parents 83e4464 + 3f52ae6 commit f5fad29
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.5.5] - 2022-09-19
### Changed
- Corretta la rimozione dai gruppi, servizi di reperibità e turno delle persone
con contratto scaduto.

## [2.5.4] - 2022-09-16
### Added
- Aggiunta la possibilità di disattivare e cancellare gli orari di lavoro predefiniti
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.4
2.5.5
18 changes: 12 additions & 6 deletions app/jobs/FixAffiliationGroupAndReperibility.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,26 @@
import dao.PersonReperibilityDayDao;
import dao.PersonShiftDayDao;
import dao.ShiftDao;
import dao.wrapper.IWrapperFactory;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import lombok.var;
import lombok.extern.slf4j.Slf4j;
import manager.NotificationManager;
import models.Contract;
import models.Person;
import models.PersonReperibility;
import models.PersonReperibilityDay;
import models.PersonReperibilityType;
import models.PersonShift;
import models.PersonShiftShiftType;
import models.flows.Group;
import models.Person;
import models.PersonShift;
import org.joda.time.LocalDate;
import play.Play;
import play.jobs.Job;
Expand All @@ -52,7 +54,6 @@
*
* @author loredana
*/
@SuppressWarnings("rawtypes")
@Slf4j
@On("0 1 21 * * ?") // Ore 21:01
public class FixAffiliationGroupAndReperibility extends Job<Void> {
Expand All @@ -75,6 +76,9 @@ public class FixAffiliationGroupAndReperibility extends Job<Void> {
@Inject
static NotificationManager notificationManager;

@Inject
static IWrapperFactory wrapperFactory;

@Override
public void doJob() {

Expand All @@ -90,7 +94,9 @@ public void doJob() {
LocalDate end = LocalDate.now();

List<Contract> expriredContracts = contractDao.getExpiredContractsInPeriod(begin, end,
Optional.absent());
Optional.absent()).stream().filter(
c -> !wrapperFactory.create(c.person).getCurrentContract().isPresent())
.collect(Collectors.toList());

Map<Group, Set<Contract>> groupsManagers = new HashMap<>();
Map<PersonShiftShiftType, Set<Contract>> shiftSupervisors = new HashMap<>();
Expand Down Expand Up @@ -254,7 +260,7 @@ private Set<Group> disableGroupAffiliation(Person person, LocalDate endContractD
groups.forEach(group ->
{
group.affiliations.stream()
.filter(a -> a.isActive()).forEach(a -> {
.filter(a -> a.isActive() && a.getPerson().id.equals(person.id)).forEach(a -> {
groupsToDeactivated.add(a.getGroup());
java.time.LocalDate endDate = java.time.LocalDate.of(endContractDate.getYear(),
endContractDate.getMonthOfYear(), endContractDate.getDayOfMonth());
Expand Down

0 comments on commit f5fad29

Please sign in to comment.