Skip to content

Commit 64213b9

Browse files
authored
Merge branch 'develop' into bugfix-2809/terminated-members-csv
2 parents bee62c5 + ecd0886 commit 64213b9

File tree

7 files changed

+104
-93
lines changed

7 files changed

+104
-93
lines changed

server/src/main/java/com/objectcomputing/checkins/services/pulseresponse/PulseResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class PulseResponse {
7777
protected PulseResponse() {
7878
}
7979

80-
public PulseResponse(UUID id, Integer internalScore, Integer externalScore, LocalDate submissionDate, @Nullable UUID teamMemberId, String internalFeelings, String externalFeelings) {
80+
public PulseResponse(UUID id, Integer internalScore, @Nullable Integer externalScore, LocalDate submissionDate, @Nullable UUID teamMemberId, String internalFeelings, String externalFeelings) {
8181
this.id = id;
8282
this.internalScore = internalScore;
8383
this.externalScore = externalScore;

web-ui/src/components/pulse/Pulse.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
margin-bottom: 1rem;
2121
padding: 1rem;
2222
}
23+
24+
.title-row {
25+
display: flex;
26+
}
2327
}
2428

2529
:root[data-mui-color-scheme='dark'] {

web-ui/src/components/pulse/Pulse.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const tooltips = [
3030
const propTypes = {
3131
comment: PropTypes.string,
3232
commentRequired: PropTypes.bool,
33+
iconRequired: PropTypes.bool,
3334
score: PropTypes.number,
3435
setComment: PropTypes.func,
3536
setScore: PropTypes.func,
@@ -38,21 +39,25 @@ const propTypes = {
3839
const Pulse = ({
3940
comment,
4041
commentRequired,
42+
iconRequired,
4143
score,
4244
setComment,
4345
setScore,
4446
title
4547
}) => (
4648
<div className="pulse">
47-
<Typography variant="h6">{title}</Typography>
49+
<div className="title-row">
50+
<Typography variant="h6">{title}</Typography>
51+
{iconRequired && <Typography variant="h6" color="red">*</Typography>}
52+
</div>
4853
<div className="icon-row">
4954
{icons.map((sentiment, index) => (
5055
<Tooltip key={`sentiment-${index}`} title={tooltips[index]} arrow>
5156
<IconButton
5257
aria-label="sentiment"
5358
className={index === score ? 'selected' : ''}
5459
data-testid={`score-button-${index}`}
55-
onClick={() => setScore(index)}
60+
onClick={() => setScore(score == index ? null : index)}
5661
sx={{ color: colors[index] }}
5762
>
5863
{sentiment}
@@ -70,7 +75,7 @@ const Pulse = ({
7075
}}
7176
placeholder="Comment"
7277
required={commentRequired}
73-
rows={4}
78+
maxRows={4}
7479
value={comment}
7580
/>
7681
</div>

web-ui/src/components/pulse/__snapshots__/Pulse.test.jsx.snap

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ exports[`renders correctly 1`] = `
66
<div
77
class="pulse"
88
>
9-
<h6
10-
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
9+
<div
10+
class="title-row"
1111
>
12-
How are you feeling about work today? (*)
13-
</h6>
12+
<h6
13+
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
14+
>
15+
How are you feeling about work today? (*)
16+
</h6>
17+
</div>
1418
<div
1519
class="icon-row"
1620
>
@@ -203,7 +207,6 @@ exports[`renders correctly 1`] = `
203207
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputMultiline css-1sqnrkk-MuiInputBase-input-MuiOutlinedInput-input"
204208
id=":r5:"
205209
placeholder="Comment"
206-
rows="4"
207210
style="height: 0px; overflow: hidden;"
208211
>
209212
Just testing

web-ui/src/pages/PulsePage.jsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,9 @@ const PulsePage = () => {
4242
const [year, month, day] = pulse.submissionDate;
4343
setSubmittedToday(
4444
year === now.getFullYear() &&
45-
month === now.getMonth() + 1 &&
46-
day === now.getDate()
45+
month === now.getMonth() + 1 &&
46+
day === now.getDate()
4747
);
48-
49-
setInternalComment(pulse.internalFeelings ?? '');
50-
setExternalComment(pulse.externalFeelings ?? '');
51-
setInternalScore(pulse.internalScore == undefined ?
52-
center : pulse.internalScore - 1);
53-
setExternalScore(pulse.externalScore == undefined ?
54-
center : pulse.externalScore - 1);
5548
}, [pulse]);
5649

5750
const loadTodayPulse = async () => {
@@ -91,7 +84,7 @@ const PulsePage = () => {
9184
const myId = currentUser?.id;
9285
const data = {
9386
externalFeelings: externalComment,
94-
externalScore: externalScore + 1, // converts to 1-based
87+
externalScore: externalScore == null ? null : externalScore + 1, // converts to 1-based
9588
internalFeelings: internalComment,
9689
internalScore: internalScore + 1, // converts to 1-based
9790
submissionDate: today,
@@ -120,10 +113,11 @@ const PulsePage = () => {
120113
<Pulse
121114
key="pulse-internal"
122115
comment={internalComment}
116+
iconRequired={true}
123117
score={internalScore}
124118
setComment={setInternalComment}
125119
setScore={setInternalScore}
126-
title="How are you feeling about work today? (*)"
120+
title="How are you feeling about work today?"
127121
/>
128122
<Pulse
129123
key="pulse-external"
@@ -137,6 +131,7 @@ const PulsePage = () => {
137131
<Button
138132
style={{ marginTop: 0 }}
139133
onClick={submit}
134+
disabled={internalScore == null}
140135
variant="contained">
141136
Submit
142137
</Button>

web-ui/src/pages/PulseReportPage.jsx

Lines changed: 56 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import {
2222
SentimentSatisfied,
2323
SentimentVerySatisfied,
2424
} from '@mui/icons-material';
25+
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
26+
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
2527
import {
2628
Avatar,
2729
Card,
@@ -33,7 +35,8 @@ import {
3335
MenuItem,
3436
Modal,
3537
TextField,
36-
Typography
38+
Typography,
39+
Link,
3740
} from '@mui/material';
3841
import ToggleButton from '@mui/material/ToggleButton';
3942
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
@@ -79,6 +82,8 @@ const ScoreOptionLabel = {
7982
'Combined': 'Both',
8083
};
8184

85+
const pulsesPerPage = 15;
86+
8287
/*
8388
// Returns a random, integer score between 1 and 5.
8489
// We may want to uncomment this later for testing.
@@ -117,6 +122,7 @@ const PulseReportPage = () => {
117122
const [expanded, setExpanded] = useState(false);
118123
const [scoreChartData, setScoreChartData] = useState([]);
119124
const [pulses, setPulses] = useState([]);
125+
const [pulsesPageNumber, setPulsesPageNumber] = useState(0);
120126
const [scope, setScope] = useState('Individual');
121127
const [scoreType, setScoreType] = useState(ScoreOption.COMBINED);
122128
const [selectedPulse, setSelectedPulse] = useState(null);
@@ -191,7 +197,9 @@ const PulseReportPage = () => {
191197
}
192198

193199
frequencies[internalScore - 1].internal++;
194-
frequencies[externalScore - 1].external++;
200+
if (externalScore != null) {
201+
frequencies[externalScore - 1].external++;
202+
}
195203

196204
let memberIdToUse;
197205
if (memberId) {
@@ -250,7 +258,9 @@ const PulseReportPage = () => {
250258
];
251259
for(let day of scoreChartDataPoints) {
252260
day.datapoints.forEach(datapoint => {
253-
externalPieCounts[datapoint.externalScore - 1].value++;
261+
if (datapoint.externalScore != null) {
262+
externalPieCounts[datapoint.externalScore - 1].value++;
263+
}
254264
});
255265
}
256266
// Filter out data with a zero value so that the pie chart does not attempt
@@ -329,6 +339,7 @@ const PulseReportPage = () => {
329339
return compare;
330340
});
331341
setPulses(pulses);
342+
setPulsesPageNumber(0);
332343
};
333344

334345
useEffect(() => {
@@ -389,63 +400,6 @@ const PulseReportPage = () => {
389400
</Card>
390401
);
391402

392-
const scoreDistributionChart = () => (
393-
<Card>
394-
<CardHeader
395-
title="Distribution of pulse scores for selected team members"
396-
titleTypographyProps={{ variant: 'h5', component: 'h2' }}
397-
/>
398-
<CardContent>
399-
<BarChart
400-
width={500}
401-
height={300}
402-
data={barChartData}
403-
margin={{
404-
top: 5,
405-
right: 30,
406-
left: 20,
407-
bottom: 5
408-
}}
409-
>
410-
<CartesianGrid strokeDasharray="3 3" />
411-
<XAxis dataKey="score" />
412-
<YAxis />
413-
<Tooltip />
414-
<Legend />
415-
{(scoreType == ScoreOption.COMBINED || scoreType == ScoreOption.INTERNAL) &&
416-
<Bar
417-
dataKey="internal"
418-
fill={ociDarkBlue}
419-
name={ScoreOptionLabel[ScoreOption.INTERNAL]}
420-
/>
421-
}
422-
{(scoreType == ScoreOption.COMBINED || scoreType == ScoreOption.EXTERNAL) &&
423-
<Bar
424-
dataKey="external"
425-
fill={ociOrange}
426-
name={ScoreOptionLabel[ScoreOption.EXTERNAL]}
427-
/>
428-
}
429-
</BarChart>
430-
<ExpandMore
431-
expand={expanded}
432-
onClick={() => setExpanded(!expanded)}
433-
aria-expanded={expanded}
434-
aria-label={expanded ? 'show less' : 'show more'}
435-
size="large"
436-
/>
437-
<Collapse
438-
className="bottom-row"
439-
in={expanded}
440-
timeout="auto"
441-
unmountOnExit
442-
>
443-
{responseSummary()}
444-
</Collapse>
445-
</CardContent>
446-
</Card>
447-
);
448-
449403
const handleCommentClick = pulse => {
450404
setSelectedPulse(pulse);
451405
setShowComments(true);
@@ -725,16 +679,36 @@ const PulseReportPage = () => {
725679
</div>
726680
}
727681
</div>
682+
<ExpandMore
683+
expand={expanded}
684+
onClick={() => setExpanded(!expanded)}
685+
aria-expanded={expanded}
686+
aria-label={expanded ? 'show less' : 'show more'}
687+
size="large"
688+
/>
689+
<Collapse
690+
className="bottom-row"
691+
in={expanded}
692+
timeout="auto"
693+
unmountOnExit
694+
>
695+
{responseSummary()}
696+
</Collapse>
728697
</CardContent>
729698
</Card>
730699
</>
731700
);
732701

733702
const responseSummary = () => {
734-
let filteredPulses = pulses;
703+
const leftDisabled = (pulsesPageNumber <= 0);
704+
const rightDisabled = (((pulsesPageNumber + 1) * pulsesPerPage) >= pulses.length);
705+
const start = pulsesPageNumber * pulsesPerPage;
706+
const pulsesSlice = pulses.slice(start, start + pulsesPerPage);
707+
708+
let filteredPulses = pulsesSlice;
735709
const teamMemberIds = teamMembers.map(member => member.id);
736710
if (teamMemberIds.length) {
737-
filteredPulses = pulses.filter(pulse =>
711+
filteredPulses = pulsesSlice.filter(pulse =>
738712
teamMemberIds.includes(pulse.teamMemberId)
739713
);
740714
}
@@ -773,6 +747,26 @@ const PulseReportPage = () => {
773747
</div>
774748
);
775749
})}
750+
<Link to="#"
751+
style={leftDisabled ? { cursor: 'auto' } : { cursor: 'pointer' }}
752+
onClick={(event) => {
753+
event.preventDefault();
754+
if (!leftDisabled) {
755+
setPulsesPageNumber(pulsesPageNumber - 1);
756+
}
757+
}}>
758+
<ArrowBackIcon/>
759+
</Link>
760+
<Link to="#"
761+
style={rightDisabled ? { cursor: 'auto' } : { cursor: 'pointer' }}
762+
onClick={(event) => {
763+
event.preventDefault();
764+
if (!rightDisabled) {
765+
setPulsesPageNumber(pulsesPageNumber + 1);
766+
}
767+
}}>
768+
<ArrowForwardIcon/>
769+
</Link>
776770
</>
777771
);
778772
};
@@ -840,7 +834,6 @@ const PulseReportPage = () => {
840834
/>
841835
{pulseScoresChart()}
842836
{averageScores()}
843-
{scoreDistributionChart()}
844837
<Modal open={showComments} onClose={() => setShowComments(false)}>
845838
<Card className="feedback-request-enable-edits-modal">
846839
<CardHeader

0 commit comments

Comments
 (0)