Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
types: [python]
files: ^(bases|components)/

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
hooks:
- id: ruff
types: [python]
files: ^(bases|components)/
1 change: 1 addition & 0 deletions bases/rsptx/admin_server_api/routers/instructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,7 @@ async def _copy_one_assignment(
course=target_course.id,
name=old_assignment.name,
duedate=due_date,
updated_date=datetime.datetime.now(),
description=old_assignment.description,
points=old_assignment.points,
threshold_pct=old_assignment.threshold_pct,
Expand Down
6 changes: 5 additions & 1 deletion bases/rsptx/admin_server_api/routers/lti1p3.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
fetch_instructor_courses,
validate_user_credentials,
)
from rsptx.db.crud.assignment import is_assignment_visible_to_students

from rsptx.configuration import settings
from rsptx.logging import rslogger
Expand Down Expand Up @@ -445,7 +446,10 @@ async def launch(request: Request):
status_code=400, detail=f"Assignment {lineitem_assign_id} not found"
)

if not rs_assign.visible and not message_launch.check_teacher_access():
if (
not is_assignment_visible_to_students(rs_assign)
and not message_launch.check_teacher_access()
):
raise HTTPException(
status_code=400,
detail=f"Assignment {rs_assign.name} is not open for students",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"prismjs": "^1.30.0",
"quill": "^2.0.3",
"react": "^18.2.0",
"react-datepicker": "^7.6.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.53.2",
"react-hot-toast": "^2.4.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@
.formField textarea,
.formField :global(.p-inputtext),
.formField :global(.p-inputtextarea),
.formField :global(.p-calendar),
.formField :global(.p-inputnumber),
.formField :global(.p-selectbutton) {
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const AssignmentBuilder = () => {
// Event handlers
const handleCreateNew = () => {
navigateToCreate("basic");
reset(defaultAssignment);
reset(defaultAssignment as unknown as Assignment);
};

const handleEdit = (assignment: Assignment) => {
Expand All @@ -108,18 +108,6 @@ export const AssignmentBuilder = () => {
await duplicateAssignment(assignment.id);
};

const handleVisibilityChange = async (assignment: Assignment, visible: boolean) => {
try {
await updateAssignment({
...assignment,
visible
});
toast.success(`Assignment ${visible ? "visible" : "hidden"} for students`);
} catch (error) {
toast.error("Failed to update assignment visibility");
}
};

const handleReleasedChange = async (assignment: Assignment, released: boolean) => {
try {
await updateAssignment({
Expand All @@ -144,6 +132,21 @@ export const AssignmentBuilder = () => {
}
};

const handleVisibilityChange = async (
assignment: Assignment,
data: { visible: boolean; visible_on: string | null; hidden_on: string | null }
) => {
try {
await updateAssignment({
...assignment,
...data
});
toast.success("Visibility updated");
} catch (error) {
toast.error("Failed to update visibility");
}
};

const handleWizardComplete = async () => {
const formValues = getValues();
const payload: CreateAssignmentPayload = {
Expand All @@ -156,7 +159,9 @@ export const AssignmentBuilder = () => {
nofeedback: formValues.nofeedback,
nopause: formValues.nopause,
peer_async_visible: formValues.peer_async_visible,
visible: false,
visible: formValues.visible,
visible_on: formValues.visible_on || null,
hidden_on: formValues.hidden_on || null,
released: true,
enforce_due: formValues.enforce_due || false
};
Expand Down Expand Up @@ -192,9 +197,9 @@ export const AssignmentBuilder = () => {
onCreateNew={handleCreateNew}
onEdit={handleEdit}
onDuplicate={handleDuplicate}
onVisibilityChange={handleVisibilityChange}
onReleasedChange={handleReleasedChange}
onEnforceDueChange={handleEnforceDueChange}
onVisibilityChange={handleVisibilityChange}
onRemove={onRemove}
/>
)}
Expand All @@ -205,13 +210,21 @@ export const AssignmentBuilder = () => {
nameError={nameError}
canProceed={canProceed}
onBack={() => {
if (wizardStep === "type") {
if (wizardStep === "visibility") {
updateWizardStep("type");
} else if (wizardStep === "type") {
updateWizardStep("basic");
} else {
navigateToList();
}
}}
onNext={() => updateWizardStep("type")}
onNext={() => {
if (wizardStep === "basic") {
updateWizardStep("type");
} else if (wizardStep === "type") {
updateWizardStep("visibility");
}
}}
onComplete={handleWizardComplete}
onNameChange={handleNameChange}
onTypeSelect={(type) => handleTypeSelect(type, setValue)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
useCreateAssignmentMutation,
useGetAssignmentsQuery
} from "@store/assignment/assignment.logic.api";
import { useParams } from "react-router-dom";
import { useParams, useNavigate } from "react-router-dom";

import { CreateAssignmentPayload } from "@/types/assignment";

Expand All @@ -16,6 +16,7 @@ import { AssignmentWizard } from "./wizard/AssignmentWizard";

export const AssignmentBuilderCreate = () => {
const { step } = useParams<{ step?: string }>();
const navigate = useNavigate();
const { isLoading, isError, data: assignments = [] } = useGetAssignmentsQuery();
const [createAssignment] = useCreateAssignmentMutation();

Expand All @@ -32,18 +33,24 @@ export const AssignmentBuilderCreate = () => {
watch
});

const wizardStep = step === "type" ? "type" : "basic";

const wizardStep = step === "type" ? "type" : step === "visibility" ? "visibility" : "basic";
console.log(step, wizardStep);
const handleBack = () => {
if (wizardStep === "type") {
window.location.href = "/builder/create";
} else {
window.location.href = "/builder";
if (wizardStep === "basic") {
navigate("/builder");
} else if (wizardStep === "type") {
navigate("/builder/create");
} else if (wizardStep === "visibility") {
navigate("/builder/create/type");
}
};

const handleNext = () => {
window.location.href = "/builder/create/type";
if (wizardStep === "basic") {
navigate("/builder/create/type");
} else if (wizardStep === "type") {
navigate("/builder/create/visibility");
}
};

const handleWizardComplete = () => {
Expand All @@ -58,13 +65,15 @@ export const AssignmentBuilderCreate = () => {
nofeedback: formValues.nofeedback,
nopause: formValues.nopause,
peer_async_visible: formValues.peer_async_visible,
visible: false,
visible: formValues.visible,
visible_on: formValues.visible_on || null,
hidden_on: formValues.hidden_on || null,
released: true,
enforce_due: formValues.enforce_due || false
};

createAssignment(payload);
window.location.href = "/builder";
navigate("/builder");
};

if (isLoading) {
Expand Down
Loading