Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

z-scores #291

Merged
merged 34 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
63b8d9f
Modify application scoring to store last updated metadata by question
daniel-panhead Dec 1, 2024
e861945
Add checks for undefined oldScores
daniel-panhead Dec 9, 2024
07c9f5f
Merge pull request #284 from nwplus/daniel/last-updated-by-question
jkuo630 Dec 9, 2024
7ac69df
Fix total eval score calculation
daniel-panhead Dec 9, 2024
9f15770
Merge pull request #287 from nwplus/daniel/fix-last-updated-by-question
daniel-panhead Dec 9, 2024
e84f52a
Transform function setup
daniel-panhead Dec 9, 2024
a1c448b
Ugly testing button in /eval
daniel-panhead Dec 9, 2024
5ec28d7
Getting app data testing
daniel-panhead Dec 9, 2024
a63b4ea
hello
jasonkuoubc Dec 9, 2024
c6795c2
added normalization calculation
ErpingS Dec 9, 2024
49de492
Turn transformScores into promise
daniel-panhead Dec 9, 2024
581e24d
added mathjs in package.json
ErpingS Dec 9, 2024
07ce21b
100xdevs
jasonkuoubc Dec 9, 2024
b1bcac4
200xdevs
jasonkuoubc Dec 9, 2024
0fc51dc
Get rid of old legacy firebase helpers
daniel-panhead Dec 9, 2024
f32b134
Update firebase with new normalized scores
daniel-panhead Dec 9, 2024
de696f2
Fix zero scores not setting
daniel-panhead Dec 9, 2024
5de3c44
fixes
daniel-panhead Dec 9, 2024
d4fcf51
Fix lint errors
daniel-panhead Dec 9, 2024
74fd780
updated mathjs to lower version for node compatability
ErpingS Dec 9, 2024
5ffb6f9
Fix lint error fix bug
daniel-panhead Dec 9, 2024
b618766
add calc z-score btn, n/a score status, and status tag updates
tdanielles Dec 18, 2024
e5c4ec5
fix linting
tdanielles Dec 18, 2024
eec5d59
fix linting?
tdanielles Dec 18, 2024
2853633
add verification modal for calculating z-score
tdanielles Dec 18, 2024
f9de840
add verification modal on attempt to change an existing score
tdanielles Dec 18, 2024
14efd25
fix linting?
tdanielles Dec 18, 2024
8c0f9c5
display total z-score for completed ones in applicant list and scorin…
tdanielles Dec 19, 2024
696012a
add total z-score filter in acceptingModal
tdanielles Dec 19, 2024
b58f2ed
fix linting AGAIN
tdanielles Dec 19, 2024
b9d1f0f
Merge pull request #290 from nwplus/trisha/normalization-ui
DonaldKLee Dec 22, 2024
41dd223
Merge pull request #288 from nwplus/normalization
DonaldKLee Dec 22, 2024
6ff9085
ui to calc button
DonaldKLee Dec 23, 2024
5ba70f9
ui to calc button
DonaldKLee Dec 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions components/Assessment/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ const GreyDiv = styled.div`
height: 100vh;
width: 100vw;
background: rgba(0, 0, 0, 0.4);
position: absolute;
top: 0;
left: 0;
position: fixed;
z-index: 99;
`

const ModalDiv = styled.div`
width: 400px;
height: 70%;
overflow-y: auto;
position: absolute;
position: fixed;
left: 50%;
top: 25%;
background-color: white;
Expand All @@ -25,7 +27,7 @@ const ModalDiv = styled.div`
align-items: center;
`

export default function Modal({ children, setShowing }) {
export default function Modal({ children, setShowing, className }) {
const backgroundRef = useRef()
useEffect(() => {
const escFunction = ({ keyCode }) => {
Expand All @@ -47,7 +49,7 @@ export default function Modal({ children, setShowing }) {
}
}}
>
<ModalDiv>{children}</ModalDiv>
<ModalDiv className={className}>{children}</ModalDiv>
</GreyDiv>
)
}
11 changes: 11 additions & 0 deletions components/Assessment/acceptingModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const acceptApplicant = async applicant => {
export default function AcceptingModal({ setShowing }) {
const [totalApplicants, setTotalApplicants] = useState(0)
const [score, setScore] = useState(undefined)
const [zscore, setZScore] = useState(undefined)
const [numHackathonsMin, setNumHackathonsMin] = useState(undefined)
const [numHackathonsMax, setNumHackathonsMax] = useState(undefined)
const [yearLevelOptions, setYearLevelOptions] = useState([])
Expand All @@ -82,6 +83,7 @@ export default function AcceptingModal({ setShowing }) {
const getApplicants = async () => {
const apps = await getApplicantsToAccept(
score,
zscore,
numHackathonsMin,
numHackathonsMax,
yearLevelsSelected,
Expand Down Expand Up @@ -138,6 +140,15 @@ export default function AcceptingModal({ setShowing }) {
value={score ?? ''}
placeholder="minimum score"
/>
<TotalApplicantsP>Minimum z-score</TotalApplicantsP>
<ScoreInput
onChange={e => {
// eslint-disable-next-line no-restricted-globals
if (!isNaN(e.target.value)) setZScore(e.target.value)
}}
value={zscore ?? ''}
placeholder="minimum z-score"
/>
<TotalApplicantsP>Number of Hackathons Attended</TotalApplicantsP>
<RangeContainer>
<ShortInput
Expand Down
77 changes: 77 additions & 0 deletions components/Evaluator/CalcZScoreButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import React, { useState } from 'react'
import styled from 'styled-components'
import { COLOR } from '../../constants'
import Button from '../button'
import Modal from '../Assessment/Modal'
import { calculateNormalizedScores } from '../../utility/normalization'

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

const StyledModal = styled(Modal)`
height: auto !important;
border-radius: 10px;
`
const ModalContent = styled.div`
padding: 20px;
text-align: center;
`

const ButtonContainer = styled.div`
display: flex;
justify-content: center;
margin-top: 20px;
`

const ModalButton = styled(Button)`
margin: 10px;
background: ${props => (props.variant === 'no' ? COLOR.RED : COLOR.GREEN)};
color: white;
`

export default function CalcZScoreButton() {
const [isModalOpen, setIsModalOpen] = useState(false)
const handleButtonClick = () => {
setIsModalOpen(true)
}

const handleYesClick = () => {
calculateNormalizedScores()
setIsModalOpen(false)
}

const handleNoClick = () => {
setIsModalOpen(false)
}
return (
<>
<StyledButton onClick={handleButtonClick}>Calculate z-score</StyledButton>
{isModalOpen && (
<StyledModal setShowing={setIsModalOpen}>
<ModalContent>
<p>
🚨<strong>You are about to run a big script!</strong>
</p>
<p>
Are you sure you want to calculate all z-scores? Please verify that{' '}
<strong>all grading has been completed.</strong>
</p>
<ButtonContainer>
<ModalButton variant="no" onClick={handleNoClick}>
No
</ModalButton>
<ModalButton variant="yes" onClick={handleYesClick}>
Yes
</ModalButton>
</ButtonContainer>
</ModalContent>
</StyledModal>
)}
</>
)
}
41 changes: 37 additions & 4 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 All @@ -68,6 +70,11 @@ const StyledTag = styled.div`
justify-content: center;
`

const ScoreContainer = styled.div`
display: flex;
gap: 10px;
`

export default function HackerEntry({
index,
// firstName,
Expand All @@ -93,9 +100,30 @@ 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>
}
}

const getTotalZScore = () => {
const { NumExperiences, ResponseOneScore, ResponseTwoScore, ResponseThreeScore } = score?.scores || {}
if (
NumExperiences?.normalizedScore !== undefined &&
ResponseOneScore?.normalizedScore !== undefined &&
ResponseTwoScore?.normalizedScore !== undefined &&
ResponseThreeScore?.normalizedScore !== undefined
) {
return (
NumExperiences.normalizedScore +
ResponseOneScore.normalizedScore +
ResponseTwoScore.normalizedScore +
ResponseThreeScore.normalizedScore
)
}
return undefined
}

return (
Expand All @@ -106,9 +134,14 @@ export default function HackerEntry({
{/* {firstName} {lastName} */}
Applicant {index}
</HackerName>
<HackerInfoText>
Score: {score?.totalScore ?? '?'}/{MAX_SCORE}
</HackerInfoText>
<ScoreContainer>
<HackerInfoText>
Score: {score?.totalScore !== undefined ? `${score.totalScore}/${MAX_SCORE}` : 'n/a'}
</HackerInfoText>
<HackerInfoText>
{getTotalZScore() !== undefined && <strong>z: {getTotalZScore().toFixed(2)}</strong>}
</HackerInfoText>
</ScoreContainer>
</StyledInfoContainer>
{getStyleTag()}
</StyledHackerEntryDiv>
Expand Down
4 changes: 4 additions & 0 deletions components/Evaluator/HackerList.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Icon from '../Icon'
import { Title5 } from '../Typography'
import Input from '../input'
import HackerEntry from './HackerEntry'
// import { calculateNormalizedScores } from '../../utility/normalization'

const Container = styled.div`
height: 60%;
Expand Down Expand Up @@ -166,6 +167,9 @@ export default function HackerList({ applicants, selectedApplicant, setSelectedA
) : (
<>
<Title5 color={COLOR.MIDNIGHT_PURPLE}>Applicant List</Title5>
{/* <button onClick={calculateNormalizedScores} type="button">
Transform Scores
</button> */}
<ButtonContainer>
<StyledIcon icon="search" onClick={() => setSearchActive(true)} />
<StyledIcon
Expand Down
Loading
Loading