icoa-cli 2.14.0 → 2.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/exam.js +21 -1
- package/dist/repl.js +2 -3
- package/package.json +1 -1
package/dist/commands/exam.js
CHANGED
|
@@ -27,7 +27,16 @@ function checkTimeRemaining() {
|
|
|
27
27
|
if (!deadline)
|
|
28
28
|
return true;
|
|
29
29
|
if (new Date() >= deadline) {
|
|
30
|
-
|
|
30
|
+
const state = getExamState();
|
|
31
|
+
if (state && state.session.examId === 'demo-free') {
|
|
32
|
+
// Demo expired — auto-clear
|
|
33
|
+
printWarning('Demo time expired. Starting fresh!');
|
|
34
|
+
printInfo('Type: demo');
|
|
35
|
+
clearExamState();
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
printError('Time expired! Use "exam submit" to submit your answers.');
|
|
39
|
+
}
|
|
31
40
|
return false;
|
|
32
41
|
}
|
|
33
42
|
return true;
|
|
@@ -549,6 +558,17 @@ export function registerExamCommand(program) {
|
|
|
549
558
|
const answered = Object.keys(state.answers).length;
|
|
550
559
|
const total = state.session.questionCount;
|
|
551
560
|
const unanswered = total - answered;
|
|
561
|
+
if (answered === 0) {
|
|
562
|
+
printWarning('No answers to submit.');
|
|
563
|
+
if (state.session.examId === 'demo-free') {
|
|
564
|
+
clearExamState();
|
|
565
|
+
printInfo('Demo cleared. Type: demo to start again.');
|
|
566
|
+
}
|
|
567
|
+
else {
|
|
568
|
+
printInfo('Answer some questions first: exam q 1');
|
|
569
|
+
}
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
552
572
|
let msg = `Submit ${answered}/${total} answers?`;
|
|
553
573
|
if (unanswered > 0) {
|
|
554
574
|
msg += chalk.yellow(` ${unanswered} unanswered.`);
|
package/dist/repl.js
CHANGED
|
@@ -178,12 +178,11 @@ export async function startRepl(program, resumeMode) {
|
|
|
178
178
|
const modeLabel = chalk.cyan.bold('[Selection Mode]');
|
|
179
179
|
console.log(' ' + modeLabel);
|
|
180
180
|
console.log();
|
|
181
|
+
console.log(chalk.white(' Ready to start? Just type ') + chalk.bold.cyan('demo') + chalk.white(' and press ') + chalk.yellow('Enter') + chalk.white('!'));
|
|
182
|
+
console.log();
|
|
181
183
|
console.log(chalk.gray(' ─────────────────────────────────────────────'));
|
|
182
184
|
console.log(chalk.bold.cyan(' demo') + chalk.gray(' Free practice exam (30 questions)'));
|
|
183
|
-
console.log(chalk.gray(' No account needed. Try it now!'));
|
|
184
|
-
console.log();
|
|
185
185
|
console.log(chalk.white(' exam <token>') + chalk.gray(' Enter exam with access token'));
|
|
186
|
-
console.log(chalk.gray(' Provided by your proctor.'));
|
|
187
186
|
console.log(chalk.gray(' ─────────────────────────────────────────────'));
|
|
188
187
|
console.log();
|
|
189
188
|
}
|