Skip to content

Commit

Permalink
Certificate eligible
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajoy10 committed Apr 7, 2024
1 parent d2e8730 commit 5d49910
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
7 changes: 5 additions & 2 deletions 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 Expand Up @@ -144,7 +144,10 @@ export default class Certificates extends React.Component {
{
this.state.events.map((event, i) => (
this.state.teams[event].map((team, j) => (
team.members.map((member, k) => (<tr key={`${i}.${j}.${k}`}>
team.members.filter((member)=>{
console.log(member)
return true;
}).map((member, k) => (<tr key={`${i}.${j}.${k}`}>
<td>{member.registrationID}</td>
<td>{member.name}</td>
<td>{event}</td>
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 5d49910

Please sign in to comment.