Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
id "jacoco"
}

version "0.8.8"
version "0.8.9"
group "com.objectcomputing.checkins"

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ private List<Feedback> getFeedbackType(FeedbackType type) {
reviewPeriod.getReviewTemplateId());
break;
case FeedbackType.feedback:
use = !template.getIsReview();
use = !template.getIsReview() && request.getStatus().equalsIgnoreCase("submitted") &&
request.getSendDate() != null && request.getSendDate().isAfter(reviewPeriod.getPeriodStartDate().toLocalDate()) &&
request.getSendDate().isBefore(reviewPeriod.getCloseDate().toLocalDate());
break;
}
if (use) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
import com.objectcomputing.checkins.services.feedback_template.FeedbackTemplate;
import com.objectcomputing.checkins.services.memberprofile.MemberProfile;
import com.objectcomputing.checkins.services.reviews.ReviewPeriod;
import jnr.constants.platform.Local;

import java.time.LocalDate;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalField;
import java.util.Date;
import java.util.Random;
import java.util.UUID;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

public interface FeedbackRequestFixture extends RepositoryFixture, FeedbackTemplateFixture {

Expand Down Expand Up @@ -51,6 +58,15 @@ default FeedbackRequest saveSampleFeedbackRequest(MemberProfile creator, MemberP
return getFeedbackRequestRepository().save(new FeedbackRequest(creator.getId(), requestee.getId(), recipient.getId(), templateId, testDate, null, "pending", null, null));
}

default LocalDate getRandomLocalDateTime(LocalDateTime start, LocalDateTime end) {
LocalDate startDate = start.toLocalDate();
long daysBetween = ChronoUnit.DAYS.between(startDate, end.toLocalDate());
Random random = new Random();
long randomDays = random.nextLong(daysBetween);

return startDate.plusDays(randomDays);
}

/**
* Saves a sample feedback request
* @param creator The {@link MemberProfile} of the creator of the feedback request
Expand All @@ -60,8 +76,13 @@ default FeedbackRequest saveSampleFeedbackRequest(MemberProfile creator, MemberP
* @return The saved {@link FeedbackRequest}
*/
default FeedbackRequest saveSampleFeedbackRequest(MemberProfile creator, MemberProfile requestee, MemberProfile recipient, UUID templateId, ReviewPeriod reviewPeriod) {
LocalDate testDate = LocalDate.of(2010, 10, 8);
return getFeedbackRequestRepository().save(new FeedbackRequest(creator.getId(), requestee.getId(), recipient.getId(), templateId, testDate, null, "pending", null, reviewPeriod.getId()));
return saveSampleFeedbackRequest(creator, requestee, recipient, templateId, reviewPeriod, "pending");
}

default FeedbackRequest saveSampleFeedbackRequest(MemberProfile creator, MemberProfile requestee, MemberProfile recipient, UUID templateId, ReviewPeriod reviewPeriod, String status) {
LocalDate submitDate = getRandomLocalDateTime(reviewPeriod.getPeriodStartDate(), reviewPeriod.getCloseDate());
LocalDate sendDate = getRandomLocalDateTime(reviewPeriod.getPeriodStartDate(), submitDate.atStartOfDay());
return getFeedbackRequestRepository().save(new FeedbackRequest(creator.getId(), requestee.getId(), recipient.getId(), templateId, sendDate, null, status, submitDate, reviewPeriod.getId()));
}

default FeedbackRequest saveSampleFeedbackRequestWithStatus(MemberProfile creator, MemberProfile requestee, MemberProfile recipient, UUID templateId, String status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ default ReviewPeriod createAClosedReviewPeriod() {

default ReviewPeriod createAClosedReviewPeriod(
LocalDateTime periodStart, LocalDateTime periodEnd) {
LocalDateTime launchDate = LocalDateTime.now().plusMinutes(1)
.truncatedTo(ChronoUnit.MILLIS);
LocalDateTime selfReviewCloseDate = launchDate.plusDays(1);
LocalDateTime closeDate = selfReviewCloseDate.plusDays(1);
LocalDateTime launchDate = periodEnd.plusMinutes(1)
.truncatedTo(ChronoUnit.MILLIS).plusDays(1);
LocalDateTime selfReviewCloseDate = launchDate.plusDays(3);
LocalDateTime closeDate = selfReviewCloseDate.plusDays(7);
return getReviewPeriodRepository().save(
new ReviewPeriod(
"Period of Closure", ReviewStatus.CLOSED, null, null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void createRolesAndPermissions() {
questionTwo = saveAnotherTemplateQuestion(feedbackTemplate, 2);
feedbackRequest = saveSampleFeedbackRequest(admin, regular, admin,
feedbackTemplate.getId(),
reviewPeriod);
reviewPeriod, "submitted");
saveSampleFeedbackAnswer(questionOne.getId(), feedbackRequest.getId());
saveSampleFeedbackAnswer(questionTwo.getId(), feedbackRequest.getId());

Expand Down
2 changes: 1 addition & 1 deletion web-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web-ui",
"version": "0.8.8",
"version": "0.8.9",
"private": true,
"type": "module",
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions web-ui/src/components/kudos_dialog/KudosDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,13 @@ const KudosDialog = ({ open, recipient, teamId, onClose }) => {
value={message}
onChange={handleMessageChange}
/>
<Alert
{publicKudos ? <Alert
severity="info"
style={{ marginTop: '1rem', marginBottom: '2rem' }}
>
Kudos will be visible to admins for approval, then sent to the
recipient.
</Alert>
</Alert> : <div style={{ height: "20px" }}/>}
<Button
variant="contained"
disabled={message.trim().length === 0}
Expand Down
Loading