Skip to content

Commit

Permalink
do not pass grades if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
shilendras committed Sep 28, 2023
1 parent ea68c90 commit 5725939
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
6 changes: 4 additions & 2 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

20 changes: 14 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const graphQLClient = new GraphQLClient(endpoint, {
const mutation = gql`
mutation GradeSubmission(
$submissionId: ID!
$grades: [GradeInput!]!
$grades: [GradeInput!]
$checklist: JSON!
$feedback: String
) {
Expand Down Expand Up @@ -111,15 +111,23 @@ if (!fail_submission && !reportData) {

const skip: boolean = reportData?.grade === 'skip'

const variables = {
type Variables = {
submissionId: string
grades?: GradeInput[]
checklist: JSON
feedback?: string
}

const variables: Variables = {
submissionId: submissionData.id,
grades: getGrades(
submissionData.target.evaluation_criteria,
reportData?.status === 'success'
),
checklist: submissionData.checklist,
feedback: reportData?.feedback || feedbackInput
}
const grades = getGrades(
submissionData.target.evaluation_criteria,
reportData?.status === 'success'
)
if (grades.length !== 0) variables['grades'] = grades

export async function run(): Promise<void> {
try {
Expand Down

0 comments on commit 5725939

Please sign in to comment.