Skip to content

Commit

Permalink
add calc z-score btn, n/a score status, and status tag updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tdanielles committed Dec 18, 2024
1 parent 9f15770 commit b618766
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 4 deletions.
16 changes: 16 additions & 0 deletions components/Evaluator/CalcZScoreButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import styled from 'styled-components'
import { COLOR } from '../../constants'
import Button from '../button'

const StyledButton = styled(Button)`
background: ${COLOR.MIDNIGHT_PURPLE_LIGHT};
color: white;
display: inline-flex;
justify-content: center;
align-items: center;
`

export default function CalcZScoreButton() {
return <StyledButton>Calculate z-score</StyledButton>
}
9 changes: 7 additions & 2 deletions components/Evaluator/HackerEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const StyledTag = styled.div`
? `background: ${ASSESSMENT_COLOR.YELLOW};`
: p.status === APPLICATION_STATUS.scored.text
? `background: ${ASSESSMENT_COLOR.BLUE};`
: p.status === APPLICATION_STATUS.gradinginprog.text
? `background: ${ASSESSMENT_COLOR.DARK_GRAY};`
: `background: ${ASSESSMENT_COLOR.RED};`}
padding: 0px 5px;
border-radius: 4px;
Expand Down Expand Up @@ -93,8 +95,11 @@ export default function HackerEntry({
return <StyledTag status={status}>{APPLICATION_STATUS.waitlisted.displayText}</StyledTag>
case APPLICATION_STATUS.rejected.text:
return <StyledTag status={status}>{APPLICATION_STATUS.rejected.displayText}</StyledTag>
case APPLICATION_STATUS.gradinginprog.text:
return <StyledTag status={status}>{APPLICATION_STATUS.gradinginprog.displayText}</StyledTag>
case APPLICATION_STATUS.ungraded.text:
default:
return <StyledTag status={status}>Ungraded</StyledTag>
return <StyledTag status={status}>{APPLICATION_STATUS.ungraded.displayText}</StyledTag>
}
}

Expand All @@ -107,7 +112,7 @@ export default function HackerEntry({
Applicant {index}
</HackerName>
<HackerInfoText>
Score: {score?.totalScore ?? '?'}/{MAX_SCORE}
Score: {score?.totalScore !== undefined ? `${score.totalScore}/${MAX_SCORE}` : 'n/a'}
</HackerInfoText>
</StyledInfoContainer>
{getStyleTag()}
Expand Down
26 changes: 25 additions & 1 deletion components/Evaluator/Scoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,28 @@ export default function Scoring({ shouldDisplay, applicant }) {
setTotalScore(calculateTotalScore(newScores))
}

// if none of the required fields are in scores or if scores doesnt even exist, set APPLICATION_STATUS.ungraded.text
// if one of the reuiqred fields are in scores and not all, set APPLICATION_STATUS.gradinginprog.text
// if all required fields are in, set APPLICATION_STATUS.scored.text
const getStatus = scores => {

Check failure on line 101 in components/Evaluator/Scoring.js

View workflow job for this annotation

GitHub Actions / Linting

'scores' is already declared in the upper scope on line 43 column 10
// TODO: UPDATE REQUIRED FIELDS PER HACKATHON
const requiredFields = ['ResumeScore', 'ResponseOneScore', 'ResponseTwoScore', 'ResponseThreeScore']

if (!scores) {
return APPLICATION_STATUS.ungraded.text
}

const filledFields = requiredFields.filter(field => scores[field] !== null && scores[field] !== undefined)

if (filledFields.length === 0) {
return APPLICATION_STATUS.ungraded.text
} else if (filledFields.length < requiredFields.length) {

Check failure on line 113 in components/Evaluator/Scoring.js

View workflow job for this annotation

GitHub Actions / Linting

Unnecessary 'else' after 'return'
return APPLICATION_STATUS.gradinginprog.text
} else {
return APPLICATION_STATUS.scored.text
}
}

const handleSave = async () => {
const updatedScores = await updateApplicantScore(
applicant._id,
Expand All @@ -103,7 +125,9 @@ export default function Scoring({ shouldDisplay, applicant }) {
comment,
user.email
)
await updateApplicantStatus(applicant._id, APPLICATION_STATUS.scored.text)
// checks if all fields have scores and update accordingly
const newStatus = getStatus(updatedScores)
await updateApplicantStatus(applicant._id, newStatus)
setScores(updatedScores)
}

Expand Down
12 changes: 12 additions & 0 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ export const APPLICATION_STATUS = {
text: 'rejected',
displayText: 'Rejected',
},
gradinginprog: {
color: ASSESSMENT_COLOR.DARK_GRAY,
textColor: 'white',
text: 'gradinginprog',
displayText: 'In progress',
},
ungraded: {
color: ASSESSMENT_COLOR.RED,
textColor: 'white',
text: 'ungraded',
displayText: 'Ungraded',
},
scored: {
color: ASSESSMENT_COLOR.BLUE,
textColor: 'white',
Expand Down
4 changes: 3 additions & 1 deletion pages/eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Rubric from '../components/Evaluator/Rubric'
import Scoring from '../components/Evaluator/Scoring'
import Page from '../components/page'
import { getAllApplicants, getHackathons } from '../utility/firebase'
import CalcZScoreButton from '../components/Evaluator/CalcZScoreButton'

const Container = styled.div`
display: grid;
Expand Down Expand Up @@ -45,7 +46,8 @@ export default function Eval({ hackathons }) {
return (
<Page hackathons={hackathons} currentPath="eval" isFullscreen>
<Container>
<Column items={2}>
<Column items={3}>
<CalcZScoreButton />
<HackerList
applicants={applicants}
selectedApplicant={selectedApplicant}
Expand Down

0 comments on commit b618766

Please sign in to comment.