Skip to content

Commit

Permalink
Merge branch 'develop' into feature-2805/convert-skills-data-structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ocielliottc authored Jan 10, 2025
2 parents ba7714b + 03c2c99 commit 6d422c9
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class PulseResponse {
protected PulseResponse() {
}

public PulseResponse(UUID id, Integer internalScore, Integer externalScore, LocalDate submissionDate, @Nullable UUID teamMemberId, String internalFeelings, String externalFeelings) {
public PulseResponse(UUID id, Integer internalScore, @Nullable Integer externalScore, LocalDate submissionDate, @Nullable UUID teamMemberId, String internalFeelings, String externalFeelings) {
this.id = id;
this.internalScore = internalScore;
this.externalScore = externalScore;
Expand Down
5 changes: 3 additions & 2 deletions web-ui/src/components/admin/users/Users.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import AdminMemberCard from '../../member-directory/AdminMemberCard';
import MemberModal from '../../member-directory/MemberModal';
import {
createMember,
reportAllMembersCsv
reportSelectedMembersCsv
} from '../../../api/member';
import { AppContext } from '../../../context/AppContext';
import { UPDATE_MEMBER_PROFILES, UPDATE_TOAST } from '../../../context/actions';
Expand Down Expand Up @@ -110,7 +110,8 @@ const Users = () => {
});

const downloadMembers = async () => {
let res = await reportAllMembersCsv(csrf);
const res = await reportSelectedMembersCsv(
normalizedMembers.map((m) => m.id), csrf);
if (res?.error) {
dispatch({
type: UPDATE_TOAST,
Expand Down
4 changes: 4 additions & 0 deletions web-ui/src/components/pulse/Pulse.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
margin-bottom: 1rem;
padding: 1rem;
}

.title-row {
display: flex;
}
}

:root[data-mui-color-scheme='dark'] {
Expand Down
11 changes: 8 additions & 3 deletions web-ui/src/components/pulse/Pulse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const tooltips = [
const propTypes = {
comment: PropTypes.string,
commentRequired: PropTypes.bool,
iconRequired: PropTypes.bool,
score: PropTypes.number,
setComment: PropTypes.func,
setScore: PropTypes.func,
Expand All @@ -38,21 +39,25 @@ const propTypes = {
const Pulse = ({
comment,
commentRequired,
iconRequired,
score,
setComment,
setScore,
title
}) => (
<div className="pulse">
<Typography variant="h6">{title}</Typography>
<div className="title-row">
<Typography variant="h6">{title}</Typography>
{iconRequired && <Typography variant="h6" color="red">*</Typography>}
</div>
<div className="icon-row">
{icons.map((sentiment, index) => (
<Tooltip key={`sentiment-${index}`} title={tooltips[index]} arrow>
<IconButton
aria-label="sentiment"
className={index === score ? 'selected' : ''}
data-testid={`score-button-${index}`}
onClick={() => setScore(index)}
onClick={() => setScore(score == index ? null : index)}
sx={{ color: colors[index] }}
>
{sentiment}
Expand All @@ -70,7 +75,7 @@ const Pulse = ({
}}
placeholder="Comment"
required={commentRequired}
rows={4}
maxRows={4}
value={comment}
/>
</div>
Expand Down
13 changes: 8 additions & 5 deletions web-ui/src/components/pulse/__snapshots__/Pulse.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ exports[`renders correctly 1`] = `
<div
class="pulse"
>
<h6
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
<div
class="title-row"
>
How are you feeling about work today? (*)
</h6>
<h6
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
>
How are you feeling about work today? (*)
</h6>
</div>
<div
class="icon-row"
>
Expand Down Expand Up @@ -203,7 +207,6 @@ exports[`renders correctly 1`] = `
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputMultiline css-1sqnrkk-MuiInputBase-input-MuiOutlinedInput-input"
id=":r5:"
placeholder="Comment"
rows="4"
style="height: 0px; overflow: hidden;"
>
Just testing
Expand Down
2 changes: 1 addition & 1 deletion web-ui/src/components/volunteer/VolunteerEvents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ const VolunteerEvents = ({ forceUpdate = () => {}, onlyMe = false }) => {
<Autocomplete
disableClearable
getOptionLabel={(option) =>
option === 'new' ? 'Create a New Organization' : (relationshipMap[option]?.organizationId && organizationMap[relationshipMap[option].organizationId]?.name) || 'Unknown'
option === 'new' ? 'Create a New Organization' : (relationshipMap[option]?.organizationId && organizationMap[relationshipMap[option].organizationId]?.name) || ''
}
options={['new', ...relationships.filter((rel) => !rel.endDate).map((rel) => rel.id)]} // Use relationship IDs
onChange={(event, value) => {
Expand Down
17 changes: 6 additions & 11 deletions web-ui/src/pages/PulsePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,9 @@ const PulsePage = () => {
const [year, month, day] = pulse.submissionDate;
setSubmittedToday(
year === now.getFullYear() &&
month === now.getMonth() + 1 &&
day === now.getDate()
month === now.getMonth() + 1 &&
day === now.getDate()
);

setInternalComment(pulse.internalFeelings ?? '');
setExternalComment(pulse.externalFeelings ?? '');
setInternalScore(pulse.internalScore == undefined ?
center : pulse.internalScore - 1);
setExternalScore(pulse.externalScore == undefined ?
center : pulse.externalScore - 1);
}, [pulse]);

const loadTodayPulse = async () => {
Expand Down Expand Up @@ -91,7 +84,7 @@ const PulsePage = () => {
const myId = currentUser?.id;
const data = {
externalFeelings: externalComment,
externalScore: externalScore + 1, // converts to 1-based
externalScore: externalScore == null ? null : externalScore + 1, // converts to 1-based
internalFeelings: internalComment,
internalScore: internalScore + 1, // converts to 1-based
submissionDate: today,
Expand Down Expand Up @@ -120,10 +113,11 @@ const PulsePage = () => {
<Pulse
key="pulse-internal"
comment={internalComment}
iconRequired={true}
score={internalScore}
setComment={setInternalComment}
setScore={setInternalScore}
title="How are you feeling about work today? (*)"
title="How are you feeling about work today?"
/>
<Pulse
key="pulse-external"
Expand All @@ -137,6 +131,7 @@ const PulsePage = () => {
<Button
style={{ marginTop: 0 }}
onClick={submit}
disabled={internalScore == null}
variant="contained">
Submit
</Button>
Expand Down
8 changes: 6 additions & 2 deletions web-ui/src/pages/PulseReportPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ const PulseReportPage = () => {
}

frequencies[internalScore - 1].internal++;
frequencies[externalScore - 1].external++;
if (externalScore != null) {
frequencies[externalScore - 1].external++;
}

let memberIdToUse;
if (memberId) {
Expand Down Expand Up @@ -256,7 +258,9 @@ const PulseReportPage = () => {
];
for(let day of scoreChartDataPoints) {
day.datapoints.forEach(datapoint => {
externalPieCounts[datapoint.externalScore - 1].value++;
if (datapoint.externalScore != null) {
externalPieCounts[datapoint.externalScore - 1].value++;
}
});
}
// Filter out data with a zero value so that the pie chart does not attempt
Expand Down
31 changes: 21 additions & 10 deletions web-ui/src/pages/__snapshots__/PulsePage.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ exports[`renders correctly 1`] = `
<div
class="pulse"
>
<h6
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
<div
class="title-row"
>
How are you feeling about work today? (*)
</h6>
<h6
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
>
How are you feeling about work today?
</h6>
<h6
class="MuiTypography-root MuiTypography-h6 css-1i2vuon-MuiTypography-root"
>
*
</h6>
</div>
<div
class="icon-row"
>
Expand Down Expand Up @@ -205,7 +214,6 @@ exports[`renders correctly 1`] = `
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputMultiline css-1sqnrkk-MuiInputBase-input-MuiOutlinedInput-input"
id=":r5:"
placeholder="Comment"
rows="4"
style="height: 0px; overflow: hidden;"
/>
<textarea
Expand Down Expand Up @@ -233,11 +241,15 @@ exports[`renders correctly 1`] = `
<div
class="pulse"
>
<h6
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
<div
class="title-row"
>
How are you feeling about life outside of work?
</h6>
<h6
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
>
How are you feeling about life outside of work?
</h6>
</div>
<div
class="icon-row"
>
Expand Down Expand Up @@ -430,7 +442,6 @@ exports[`renders correctly 1`] = `
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputMultiline css-1sqnrkk-MuiInputBase-input-MuiOutlinedInput-input"
id=":rb:"
placeholder="Comment"
rows="4"
style="height: 0px; overflow: hidden;"
/>
<textarea
Expand Down

0 comments on commit 6d422c9

Please sign in to comment.