Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
Merge branch 'JMU-CIME:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
wjed authored Mar 26, 2024
2 parents 0951384 + da4e585 commit fc06288
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 16 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@
1. `pm2 stop fe-dev`
1. change the symlink for live in fe-dev to the newly readied version
* cd /home/ec2-user/fe-dev-versions
* ls -al
* rm live
* ln -s /home/ec2-user/fe-dev-versions/<v0.2.2> live
1. cd /home/ec2-user/fe-dev-versions/live #WARNING: you must have cd'ed into the current version first because the start script is just running `next start` which expects to find package.json and etc in the current dir.
1. `pm2 start npm --name "fe-dev" -- start`
`pm2 start npm --name "fe-prod" -- start``
`pm2 start npm --name "fe-prod" -- start`
1. `pm2 save`

## Deploying PROD

1. package.json needs to specify the different port
* change the `start` line in package.json to `"start": "next start -p 3003"`
1. .env files may need to be copied from prior versions
1 change: 1 addition & 0 deletions components/student/create/aural.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export default function CreativityAuralActivity() {
}}
orig={json}
colors={currentAssignment?.part?.chord_scale_pattern}
instrumentName={currentAssignment?.instrument}
/>
</>
)}
Expand Down
4 changes: 4 additions & 0 deletions components/student/create/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export default function CreativityActivity() {
trim={1}
onUpdate={handleTonicUpdate}
colors='tonic'
instrumentName={currentAssignment?.instrument}
/>
</div>
</div>
Expand All @@ -169,6 +170,7 @@ export default function CreativityActivity() {
trim={1}
onUpdate={handleSubdominantUpdate}
colors='subdominant'
instrumentName={currentAssignment?.instrument}
/>
</div>
</div>
Expand All @@ -192,6 +194,7 @@ export default function CreativityActivity() {
trim={1}
onUpdate={handleDominantUpdate}
colors='dominant'
instrumentName={currentAssignment?.instrument}
/>
</div>
</div>
Expand Down Expand Up @@ -255,6 +258,7 @@ export default function CreativityActivity() {
colors={currentAssignment?.part?.chord_scale_pattern}
selectedMeasure={selectedMeasure}
debugMsg='final explore composition flateditor instance'
instrumentName={currentAssignment?.instrument}
/>
<Recorder
submit={submitCreativity}
Expand Down
2 changes: 1 addition & 1 deletion components/student/create/theoretical.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default function CreativityActivity() {
}
<Button onClick={()=>{setIsDoneComposing(true)}}>Done Composing</Button>
<h2>Step {subScores.length + 1} - Combined</h2>
{scoreDataRef.current && scoreDataRef.current.length > 0 && isDoneComposing && <MergingScore giveJSON={onMerged} scores={scoreDataRef} />}
{scoreDataRef.current && scoreDataRef.current.length > 0 && isDoneComposing && <MergingScore giveJSON={onMerged} scores={scoreDataRef} instrumentName={currentAssignment?.instrument} />}
<Recorder
submit={submitCreativity}
accompaniment={currentAssignment?.part?.piece?.accompaniment}
Expand Down
17 changes: 10 additions & 7 deletions components/teacher/grade/rte.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ export default function RTE({ submission, submitAction, autoFocus = false }) {
const userInfo = useSelector((state) => state.currentUser);
const { slug } = router.query;
const [isFormFocused, setFormFocus] = useState(false);
const [rhythm, setRhythm] = useState(0);
const [tone, setTone] = useState(0);
const [expression, setExpression] = useState(0);
const [rhythm, setRhythm] = useState(submission?.grade?.rhythm ?? 0);
const [tone, setTone] = useState(submission?.grade?.tone ?? 0);
const [expression, setExpression] = useState(submission?.grade?.expression ?? 0);
const audioRef = useRef();
const dispatch = useDispatch();
const queryClient = useQueryClient();
const gradeMutation = useMutation(mutateGradeSubmission(slug), {
onMutate: async (newGrade) => {
dispatch(beginUpload('grade'));
dispatch(beginUpload(`grade-${submission.id}`));
// Cancel any outgoing refetches (so they don't overwrite our optimistic update)
await queryClient.cancelQueries('gradeableSubmissions');
// Snapshot the previous value
Expand All @@ -51,14 +51,14 @@ export default function RTE({ submission, submitAction, autoFocus = false }) {
},
// If the mutation fails, use the context returned from onMutate to roll back
onError: (err, newGrade, context) => {
dispatch(uploadFailed('grade'));
dispatch(uploadFailed(`grade-${submission.id}`));
queryClient.setQueryData(
'gradeableSubmissions',
context.previousSubmissions
);
},
onSuccess: () => {
dispatch(uploadSucceeded('grade'));
dispatch(uploadSucceeded(`grade-${submission.id}`));
},
// Always refetch after error or success:
onSettled: () => {
Expand Down Expand Up @@ -105,6 +105,7 @@ export default function RTE({ submission, submitAction, autoFocus = false }) {
>
<Form.Control
type="number"
defaultValue={rhythm}
onChange={(ev) => {
setRhythm(ev.target.value);
}}
Expand All @@ -121,6 +122,7 @@ export default function RTE({ submission, submitAction, autoFocus = false }) {
<FloatingLabel controlId="floatingInput" label="Tone" className="mb-3">
<Form.Control
type="number"
defaultValue={tone}
onChange={(ev) => {
setTone(ev.target.value);
}}
Expand All @@ -140,6 +142,7 @@ export default function RTE({ submission, submitAction, autoFocus = false }) {
>
<Form.Control
type="number"
defaultValue={expression}
onChange={(ev) => {
setExpression(ev.target.value);
}}
Expand All @@ -154,7 +157,7 @@ export default function RTE({ submission, submitAction, autoFocus = false }) {
<Button variant="primary" type="submit" className="mb-3">
Submit
</Button>{' '}
<StatusIndicator statusId={submission?.id ?? 'respond'} />
<StatusIndicator statusId={(!!submitAction ? submission?.id : `grade-${submission.id}`) ?? 'respond'} />
</Form>
);
}
24 changes: 17 additions & 7 deletions pages/courses/[slug]/[piece]/[actCategory]/[partType]/grade.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,30 @@ import { useQuery } from 'react-query';
import { getRecentSubmissions } from '../../../../../../api';
import Layout from "../../../../../../components/layout";
import GradePerform from "../../../../../../components/teacher/grade/perform";
import { Spinner } from "react-bootstrap";

export default function GradeActivity() {
const router = useRouter();
const { slug, piece, partType } = router.query;

// TODO: should't render this thing if not a teacher
const { isLoading, error, data: submissions } = useQuery(['gradeableSubmissions', slug, piece, partType], getRecentSubmissions({ slug, piece, partType }))
const { isLoading, error, data: submissions } = useQuery(['gradeableSubmissions', slug, piece, partType], getRecentSubmissions({ slug, piece, partType }), { enabled: !!slug && !!piece && !!partType })

if (error) return `An error has occurred: ${error.message}`


if (isLoading || !submissions) return 'Loading...'
if (error) return `An error has occurred: ${ error.message}`

return <Layout>
<GradePerform submissions={submissions} />
{ !slug || !piece || !partType || isLoading || !submissions ?
<Spinner
as="span"
animation="border"
size="sm"
role="status"
aria-hidden="true"
variant="primary"
>
<span className="visually-hidden">Loading...</span>
</Spinner> :
<GradePerform submissions={submissions} />
}
</Layout>
}

0 comments on commit fc06288

Please sign in to comment.