Skip to content

Commit

Permalink
Merge pull request #60 from consiglionazionaledellericerche/59-fix-ma…
Browse files Browse the repository at this point in the history
…pper-per-absence

corretto mapper
  • Loading branch information
criluc authored Nov 11, 2024
2 parents f8905e2 + 2a11bed commit d15dc85
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
@RestController
@RequestMapping(ApiRoutes.BASE_PATH + "/competences")
class CompetencesController {

private final WrapperFactory wrapperFactory;
private final SecurityRules rules;
private final PersonFinder personFinder;
Expand Down Expand Up @@ -149,8 +148,8 @@ ResponseEntity<CompetencesDto> show(

for (java.util.Map.Entry<CompetenceCode, String> entry : map.entrySet()) {
CompetenceCodeDto cptCodeDto = new CompetenceCodeDto();
cptCodeDto.setCode(entry.getKey().code);
cptCodeDto.setDescription(entry.getKey().description);
cptCodeDto.setCode(entry.getKey().getCode());
cptCodeDto.setDescription(entry.getKey().getDescription());
cptCodeDto.setValue(entry.getValue());
competenceCodeListDto.add(cptCodeDto);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public abstract AbsenceTypeJustifiedBehaviourDto convert(
@Mapping(target = "externalId", source = "absence.externalIdentifier")
@Mapping(target = "justifiedTime",
expression = "java(absence.justifiedTime())")
//@Mapping(target = "date", expression = "java(absence.getAbsenceDate())")
@Mapping(target = "date", expression = "java(absence.getAbsenceDate())")
@Mapping(target = "replacingAbsencesGroup", source = "replacingAbsencesGroup")
@Mapping(target = "nothingJustified", expression = "java(absence.nothingJustified())")
public abstract AbsenceShowDto convert(Absence absence, List<Object> replacingAbsencesGroup);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@

package it.cnr.iit.epas.dto.v4.mapper;

import it.cnr.iit.epas.dto.v4.CompetenceCodeDto;
import it.cnr.iit.epas.dto.v4.CompetenceDto;
import it.cnr.iit.epas.dto.v4.ContractShowDto;
import it.cnr.iit.epas.dto.v4.PersonMonthCompetenceRecapDto;
import it.cnr.iit.epas.manager.recaps.competences.PersonMonthCompetenceRecap;
import it.cnr.iit.epas.models.Competence;
import it.cnr.iit.epas.models.CompetenceCode;
import it.cnr.iit.epas.models.Contract;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
Expand All @@ -37,6 +39,8 @@ public interface CompetencesMapper {

PersonMonthCompetenceRecapDto convertPersonMonthCompetenceRecap(PersonMonthCompetenceRecap recap);

CompetenceCodeDto convert(CompetenceCode competenceCode);

@Mapping(target = "personId", source = "person.id")
CompetenceDto convertCompetence(Competence competence);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import it.cnr.iit.epas.models.absences.JustifiedType.JustifiedTypeName;
import it.cnr.iit.epas.models.dto.AbsenceToRecoverDto;
import it.cnr.iit.epas.models.enumerate.StampTypes;
import it.cnr.iit.epas.security.SecurityService;
import it.cnr.iit.epas.utils.DateUtility;
import java.time.LocalDate;
import java.time.YearMonth;
Expand All @@ -42,6 +43,7 @@
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;

Expand Down Expand Up @@ -101,15 +103,15 @@ public int getNumberOfMealTicketToUse() {
* Costruisce l'oggetto contenente tutte le informazioni da renderizzare nella pagina tabellone
* timbrature.
*
* @param personDayManager personDayManager
* @param personDayDao personDayDao
* @param personManager personManager
* @param personDayManager personDayManager
* @param personDayDao personDayDao
* @param personManager personManager
* @param stampingDayRecapFactory stampingDayRecapFactory
* @param wrapperFactory wrapperFactory
* @param year year
* @param month month
* @param person person
* @param considerExitingNow se considerare nel calcolo l'uscita in questo momento
* @param wrapperFactory wrapperFactory
* @param year year
* @param month month
* @param person person
* @param considerExitingNow se considerare nel calcolo l'uscita in questo momento
*/
public PersonStampingRecap(PersonDayManager personDayManager, PersonDayDao personDayDao,
PersonManager personManager, PersonStampingDayRecapFactory stampingDayRecapFactory,
Expand All @@ -118,11 +120,13 @@ public PersonStampingRecap(PersonDayManager personDayManager, PersonDayDao perso

// DATI DELLA PERSONA
//FIXME: da correggere prima dell'utilizzo di spring boot
//al momento messo in next.js la chiamata al securecheck per controllare se modificabile o meno
canEditStampings = true;
//if (Session.current() != null && Security.getUser() != null
// && Security.getUser().isPresent()) {
// canEditStampings = Resecure.check("Stampings.edit", null);
//}
/*if (Session.current() != null && Security.getUser() != null
&& Security.getUser().isPresent()) {
canEditStampings = Resecure.check("Stampings.edit", null);
}*/

final long start = System.currentTimeMillis();
log.trace("inizio creazione nuovo PersonStampingRecap. Person = {}, year = {}, month = {}",
person.getFullname(), year, month);
Expand All @@ -137,11 +141,9 @@ public PersonStampingRecap(PersonDayManager personDayManager, PersonDayDao perso
LocalDate begin = LocalDate.of(year, month, 1);
LocalDate end = DateUtility.endOfMonth(begin);


List<PersonDay> personDays =
personDayDao.getPersonDayInPeriod(person, begin, Optional.ofNullable(end));


this.numberOfInOut =
Math.max(MIN_IN_OUT_COLUMN, personDayManager.getMaximumCoupleOfStampings(personDays));

Expand Down

0 comments on commit d15dc85

Please sign in to comment.