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

Delete answer from dashboard #687

Merged
merged 21 commits into from
Mar 2, 2021
Merged

Delete answer from dashboard #687

merged 21 commits into from
Mar 2, 2021

Conversation

HegePI
Copy link
Contributor

@HegePI HegePI commented Feb 3, 2021

need to add tests

@codecov
Copy link

codecov bot commented Feb 3, 2021

Codecov Report

Merging #687 (388c2b6) into master (78c3b88) will increase coverage by 0.51%.
The diff coverage is 93.84%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #687      +/-   ##
==========================================
+ Coverage   90.54%   91.06%   +0.51%     
==========================================
  Files          52       58       +6     
  Lines        1830     1924      +94     
  Branches      242      257      +15     
==========================================
+ Hits         1657     1752      +95     
+ Misses        168      166       -2     
- Partials        5        6       +1     
Impacted Files Coverage Δ
...ckages/backendv2/src/controllers/dashboard/util.ts 89.79% <ø> (ø)
packages/backendv2/src/models/user_quiz_state.ts 68.00% <ø> (ø)
packages/backendv2/tests/data.ts 100.00% <ø> (ø)
...v2/src/controllers/dashboard/routes/usersRoutes.ts 76.47% <76.47%> (ø)
.../src/controllers/dashboard/routes/answersRoutes.ts 89.61% <89.61%> (ø)
packages/backendv2/src/models/quiz_answer.ts 87.72% <91.66%> (+0.49%) ⬆️
.../src/controllers/dashboard/routes/coursesRoutes.ts 95.89% <95.89%> (ø)
.../src/controllers/dashboard/routes/quizzesRoutes.ts 97.16% <97.16%> (ø)
...s/backendv2/database/seeds/quizAnswerSoftDelete.ts 100.00% <100.00%> (ø)
...kages/backendv2/src/controllers/dashboard/index.ts 100.00% <100.00%> (+7.28%) ⬆️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78c3b88...388c2b6. Read the comment docs.

})

//what todo, when no quizAnswer
if (nextBestQuizAnswer) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Else if not best call the same thing but make it set attempted: false

await UserQuizState.query(trx).update({
status: "open",
tries: userQuizState[0].tries > 0 ? userQuizState[0].tries - 1 : 0,
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also update the spam flags.

@@ -12,8 +12,9 @@ import {
} from "../../contexts/AnswerListContext"

interface AdditionalAnswerCardProps {
faded: boolean
status: string
$faded: boolean
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ ????

@HegePI HegePI requested a review from nygrenh March 1, 2021 12:21
assistant: ["view", "edit", "grade"],
teacher: ["view", "edit", "grade"],
admin: ["view", "edit", "grade", "download", "duplicate", "delete"],
assistant: ["view", "edit", "grade", "delete"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to delete-answers

const updatedUserQuizState = await userQuizState
.$query(trx)
.updateAndFetch({
status: "open",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this locked if new userQuizState.tries >= quiz.tries

@nygrenh nygrenh merged commit d4c1cc3 into master Mar 2, 2021
@nygrenh nygrenh deleted the delete-answer-from-dashboard branch March 2, 2021 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants