Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix-2793/bar-chart-truncated
Browse files Browse the repository at this point in the history
  • Loading branch information
mkimberlin authored Dec 18, 2024
2 parents 3291416 + cd15b30 commit 910713f
Show file tree
Hide file tree
Showing 9 changed files with 579 additions and 418 deletions.
1 change: 1 addition & 0 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ dependencies {

yarnBuildElements(project(":web-ui"))

implementation("net.steppschuh.markdowngenerator:markdowngenerator:1.3.1.1")
implementation("io.micronaut:micronaut-jackson-databind")
implementation("io.micronaut:micronaut-http-client")
implementation("io.micronaut:micronaut-management")
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
import com.objectcomputing.checkins.services.feedback_answer.FeedbackAnswerServices;
import com.objectcomputing.checkins.services.feedback_template.template_question.TemplateQuestionServices;
import com.objectcomputing.checkins.services.employee_hours.EmployeeHoursServices;
import com.objectcomputing.checkins.services.file.FileServices;

import io.micronaut.http.MediaType;
import io.micronaut.http.HttpStatus;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Post;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.multipart.CompletedFileUpload;
Expand All @@ -27,6 +31,7 @@
import reactor.core.publisher.Flux;
import reactor.core.scheduler.Schedulers;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -51,6 +56,7 @@ public class ReportDataController {
private final FeedbackAnswerServices feedbackAnswerServices;
private final TemplateQuestionServices templateQuestionServices;
private final EmployeeHoursServices employeeHoursServices;
private final FileServices fileServices;

public ReportDataController(ReportDataServices reportDataServices,
KudosRepository kudosRepository,
Expand All @@ -61,7 +67,8 @@ public ReportDataController(ReportDataServices reportDataServices,
FeedbackRequestServices feedbackRequestServices,
FeedbackAnswerServices feedbackAnswerServices,
TemplateQuestionServices templateQuestionServices,
EmployeeHoursServices employeeHoursServices) {
EmployeeHoursServices employeeHoursServices,
FileServices fileServices) {
this.reportDataServices = reportDataServices;
this.kudosRepository = kudosRepository;
this.kudosRecipientRepository = kudosRecipientRepository;
Expand All @@ -72,6 +79,7 @@ public ReportDataController(ReportDataServices reportDataServices,
this.feedbackAnswerServices = feedbackAnswerServices;
this.templateQuestionServices = templateQuestionServices;
this.employeeHoursServices = employeeHoursServices;
this.fileServices = fileServices;
}

@Post(uri="/upload", consumes = MediaType.MULTIPART_FORM_DATA)
Expand Down Expand Up @@ -115,35 +123,22 @@ private String uploadHelper(ReportDataServices.DataType dataType,
}
}

@Get
@Post(uri="/generate")
@RequiredPermission(Permission.CAN_CREATE_MERIT_REPORT)
public List<ReportDataDTO> get(@NotNull List<UUID> memberIds,
@NotNull UUID reviewPeriodId) {
List<ReportDataDTO> list = new ArrayList<ReportDataDTO>();
for (UUID memberId : memberIds) {
ReportDataCollation data = new ReportDataCollation(
memberId, reviewPeriodId,
kudosRepository,
kudosRecipientRepository,
memberProfileServices,
reviewPeriodServices,
reportDataServices,
feedbackTemplateServices,
feedbackRequestServices,
feedbackAnswerServices,
templateQuestionServices,
employeeHoursServices);
list.add(new ReportDataDTO(memberId, reviewPeriodId,
data.getStartDate(), data.getEndDate(),
data.getMemberProfile(), data.getKudos(),
data.getCompensationHistory(),
data.getCurrentInformation(),
data.getPositionHistory(),
data.getSelfReviews(),
data.getReviews(),
data.getFeedback(),
data.getReportHours()));
}
return list;
public HttpStatus generate(@Body @Valid ReportDataDTO dto) {
MarkdownGeneration markdown =
new MarkdownGeneration(reportDataServices,
kudosRepository,
kudosRecipientRepository,
memberProfileServices,
reviewPeriodServices,
feedbackTemplateServices,
feedbackRequestServices,
feedbackAnswerServices,
templateQuestionServices,
employeeHoursServices,
fileServices);
markdown.upload(dto.getMemberIds(), dto.getReviewPeriodId());
return HttpStatus.OK;
}
}
Original file line number Diff line number Diff line change
@@ -1,58 +1,20 @@
package com.objectcomputing.checkins.services.reports;

import com.objectcomputing.checkins.services.memberprofile.MemberProfile;
import io.micronaut.core.annotation.Introspected;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDate;
import java.util.List;
import java.util.UUID;

@Getter
@Setter
@AllArgsConstructor
@Introspected
public class ReportDataDTO {

@NotNull
private UUID memberId;
private List<UUID> memberIds;

@NotNull
private UUID reviewPeriodId;

@NotNull
private LocalDate startDate;

@NotNull
private LocalDate endDate;

@NotNull
private MemberProfile memberProfile;

@NotNull
private List<ReportKudos> kudos;

@NotNull
private List<CompensationHistory.Compensation> compensationHistory;

@NotNull
private CurrentInformation.Information currentInformation;

@NotNull
private List<PositionHistory.Position> positionHistory;

@NotNull
private List<Feedback> selfReviews;

@NotNull
private List<Feedback> reviews;

@NotNull
private List<Feedback> feedback;

@NotNull
private ReportHours hours;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.objectcomputing.checkins.services.reports;

/*************************************************************************
*
* This class is here due to the fact that the ReportDataController now
* references the FileServices. The real FileServicesImpl requires the
* GoogleApiAccess class that does not exist during testing.
*
* This replacement class does not require that and can help us test the
* output of the MarkdownGeneration class.
*
************************************************************************/

import com.objectcomputing.checkins.services.file.FileInfoDTO;
import com.objectcomputing.checkins.services.file.FileServices;
import com.objectcomputing.checkins.services.file.FileServicesImpl;

import io.micronaut.http.multipart.CompletedFileUpload;

import java.io.File;
import java.util.Set;
import java.util.HashSet;
import java.util.UUID;

import jakarta.inject.Singleton;
import io.micronaut.context.env.Environment;
import io.micronaut.context.annotation.Replaces;
import io.micronaut.context.annotation.Requires;

@Singleton
@Replaces(FileServicesImpl.class)
@Requires(env = Environment.TEST)
public class FileServicesImplReplacement implements FileServices {
public String documentName = "";
public String documentText = "";

public Set<FileInfoDTO> findFiles(UUID checkInId) {
return new HashSet<FileInfoDTO>();
}

public File downloadFiles(String uploadDocId) {
return null;
}

public FileInfoDTO uploadFile(UUID checkInID, CompletedFileUpload file) {
return new FileInfoDTO();
}

public FileInfoDTO uploadDocument(String directory,
String name, String text) {
documentName = name;
documentText = text;
return new FileInfoDTO();
}

public boolean deleteFile(String uploadDocId) {
return true;
}
}
Loading

0 comments on commit 910713f

Please sign in to comment.