Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalnjs committed Sep 26, 2024
1 parent 09b7533 commit 283917f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ <h1 class="text-placeholder">000</h1>
<p><kbd>Shift</kbd> + <kbd>R</kbd> Reset theme</p>
</div>
<div data-modal-page="reset" data-page-title="Reset">
<button data-reset="history">Clear History</button>
<button data-reset="history">Clear Responses</button>
<button data-reset="all">Reset All Settings</button>
</div>
</dialog>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ <h1 class="text-placeholder">000</h1>
<p><kbd>Shift</kbd> + <kbd>R</kbd> Reset theme</p>
</div>
<div data-modal-page="reset" data-page-title="Reset">
<button data-reset="history">Clear History</button>
<button data-reset="history">Clear Responses</button>
<button data-reset="all">Reset All Settings</button>
</div>
</dialog>
Expand Down
10 changes: 4 additions & 6 deletions src/checker/checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,10 @@ function resetInputs() {

// Check answer
async function submitClick(code, segment, question, answer) {
window.scroll(0, 0);
var qA = storage.get("questionsAnswered") || [];
var alreadyAnswered = qA.find(q => q.segment == segment && q.question == question)
if (alreadyAnswered && alreadyAnswered.status == 'correct') {
window.scroll(0, 0);
return ui.modeless(`<i class="bi bi-exclamation-lg"></i>`, 'Already Submitted!');
}
if (alreadyAnswered && alreadyAnswered.status == 'correct') return ui.modeless(`<i class="bi bi-exclamation-lg"></i>`, 'Already Submitted!');
await fetch(domain + '/check_answer', {
method: "POST",
headers: {
Expand All @@ -228,7 +226,7 @@ await fetch(domain + '/check_answer', {
.then(r => r.json())
.then(r => {
if (typeof r.correct != 'undefined') {
ui.modeless(`<i class="bi bi-${(r.correct) ? 'check' : 'x'}-lg"></i>`, (r.correct) ? 'Correct!' : 'Incorrect');
ui.modeless(`<i class="bi bi-${(r.correct) ? 'check' : 'x'}-lg"></i>`, (r.correct) ? 'Correct' : 'Try Again');
qA.push({ "segment": segment, "question": question, "status": (r.correct) ? 'Correct' : 'In Progress' });
} else if (typeof r.error != 'undefined') {
ui.modeless(`<i class="bi bi-exclamation-triangle"></i>`, 'Error');
Expand Down Expand Up @@ -584,7 +582,7 @@ function updateHistory() {
// Reset modals
const resets = {
"history": () => {
ui.prompt("Clear history?", "This action cannot be reversed!", [
ui.prompt("Clear Responses?", "This action cannot be reversed!", [
{
text: "Cancel",
close: true,
Expand Down

0 comments on commit 283917f

Please sign in to comment.