Skip to content

Commit

Permalink
Merge pull request #379 from manipalutsav/feature-optional-certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
abhikpai authored Apr 8, 2024
2 parents d2e8730 + 2ed92ba commit 3b54947
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Certificates/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class Certificates extends React.Component {
let sortedTeams = {};
collegesService.getParticipants(user.college).then(participants => {
for (let team of teams) {
let members = participants.filter(member => team.members.includes(member.id));
let members = participants.filter(member => team.members.includes(member.id) && member.certificateEligible);
team.members = members;
}

Expand Down
24 changes: 23 additions & 1 deletion src/components/CollegeTeams/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export default class EditMember extends React.Component {

componentWillMount() {
participantsService.get(this.props.member).then(participant => {

this.setState({ participant: participant || {} })
});

Expand Down Expand Up @@ -90,6 +89,29 @@ export default class EditMember extends React.Component {
/>
</div>

<div className="flex my-2">
<div>Eligible for certification</div>
<input
onChange={(e)=>{
const val = e.target.checked;
this.setState((prev)=>{
return {
participant: {
...prev.participant,
certificateEligible: val,
}
}
});
}}
autoComplete="off"
name="certificateEligible"
type="checkbox"
checked={this.state.participant.certificateEligible}
placeholder="Eligible for certificate"
css={{ width: 50 }}
/>
</div>

<div>
<Button
onClick={this.handleClick}
Expand Down
1 change: 1 addition & 0 deletions src/services/participants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const get = async (participantID) => {
};

const update = async (participantID, participant) => {
console.log(participant)
let response = await request("/participants/" + participantID, "PATCH", participant);

if (response && response.status === 200) {
Expand Down

0 comments on commit 3b54947

Please sign in to comment.