@@ -29,6 +29,12 @@ import {
29
29
} from "./customize-student-project-functionality" ;
30
30
import type { PurchaseInfo } from "@cocalc/util/licenses/purchase/types" ;
31
31
import { delay } from "awaiting" ;
32
+ import {
33
+ NBGRADER_CELL_TIMEOUT_MS ,
34
+ NBGRADER_MAX_OUTPUT ,
35
+ NBGRADER_MAX_OUTPUT_PER_CELL ,
36
+ NBGRADER_TIMEOUT_MS ,
37
+ } from "../assignments/consts" ;
32
38
33
39
interface ConfigurationTarget {
34
40
project_id : string ;
@@ -123,10 +129,6 @@ export class ConfigurationActions {
123
129
set_student_project_functionality = async (
124
130
student_project_functionality : StudentProjectFunctionality ,
125
131
) : Promise < void > => {
126
- console . log (
127
- "set_student_project_functionalit" ,
128
- student_project_functionality ,
129
- ) ;
130
132
this . set ( { student_project_functionality, table : "settings" } ) ;
131
133
await this . course_actions . student_projects . configure_all_projects ( ) ;
132
134
} ;
@@ -310,7 +312,9 @@ export class ConfigurationActions {
310
312
} ;
311
313
312
314
// project_id is a uuid *or* empty string.
313
- set_nbgrader_grade_project = async ( project_id : string ) : Promise < void > => {
315
+ set_nbgrader_grade_project = async (
316
+ project_id : string = "" ,
317
+ ) : Promise < void > => {
314
318
this . set ( {
315
319
nbgrader_grade_project : project_id ,
316
320
table : "settings" ,
@@ -322,29 +326,35 @@ export class ConfigurationActions {
322
326
}
323
327
} ;
324
328
325
- set_nbgrader_cell_timeout_ms = ( nbgrader_cell_timeout_ms : number ) : void => {
329
+ set_nbgrader_cell_timeout_ms = (
330
+ nbgrader_cell_timeout_ms : number = NBGRADER_CELL_TIMEOUT_MS ,
331
+ ) : void => {
326
332
this . set ( {
327
333
nbgrader_cell_timeout_ms,
328
334
table : "settings" ,
329
335
} ) ;
330
336
} ;
331
337
332
- set_nbgrader_timeout_ms = ( nbgrader_timeout_ms : number ) : void => {
338
+ set_nbgrader_timeout_ms = (
339
+ nbgrader_timeout_ms : number = NBGRADER_TIMEOUT_MS ,
340
+ ) : void => {
333
341
this . set ( {
334
342
nbgrader_timeout_ms,
335
343
table : "settings" ,
336
344
} ) ;
337
345
} ;
338
346
339
- set_nbgrader_max_output = ( nbgrader_max_output : number ) : void => {
347
+ set_nbgrader_max_output = (
348
+ nbgrader_max_output : number = NBGRADER_MAX_OUTPUT ,
349
+ ) : void => {
340
350
this . set ( {
341
351
nbgrader_max_output,
342
352
table : "settings" ,
343
353
} ) ;
344
354
} ;
345
355
346
356
set_nbgrader_max_output_per_cell = (
347
- nbgrader_max_output_per_cell : number ,
357
+ nbgrader_max_output_per_cell : number = NBGRADER_MAX_OUTPUT_PER_CELL ,
348
358
) : void => {
349
359
this . set ( {
350
360
nbgrader_max_output_per_cell,
@@ -382,7 +392,7 @@ export class ConfigurationActions {
382
392
this . set_compute_image ( image ) ;
383
393
} ;
384
394
385
- set_nbgrader_parallel = ( nbgrader_parallel : number ) : void => {
395
+ set_nbgrader_parallel = ( nbgrader_parallel : number = PARALLEL_DEFAULT ) : void => {
386
396
this . set ( {
387
397
nbgrader_parallel,
388
398
table : "settings" ,
@@ -498,7 +508,6 @@ async function configureGroup({
498
508
settings : CourseSettingsRecord ;
499
509
actions : CourseActions ;
500
510
} ) {
501
- console . log ( "configureGroup:" , group ) ;
502
511
switch ( group ) {
503
512
case "collaborator-policy" :
504
513
const allow_colabs = ! ! settings . get ( "allow_collabs" ) ;
@@ -517,6 +526,31 @@ async function configureGroup({
517
526
) ,
518
527
) ;
519
528
return ;
529
+ case "nbgrader" :
530
+ await actions . configuration . set_nbgrader_grade_project (
531
+ settings . get ( "nbgrader_grade_project" ) ,
532
+ ) ;
533
+ await actions . configuration . set_nbgrader_cell_timeout_ms (
534
+ settings . get ( "nbgrader_cell_timeout_ms" ) ,
535
+ ) ;
536
+ await actions . configuration . set_nbgrader_timeout_ms (
537
+ settings . get ( "nbgrader_timeout_ms" ) ,
538
+ ) ;
539
+ await actions . configuration . set_nbgrader_max_output (
540
+ settings . get ( "nbgrader_max_output" ) ,
541
+ ) ;
542
+ await actions . configuration . set_nbgrader_max_output_per_cell (
543
+ settings . get ( "nbgrader_max_output_per_cell" ) ,
544
+ ) ;
545
+ await actions . configuration . set_nbgrader_include_hidden_tests (
546
+ ! ! settings . get ( "nbgrader_include_hidden_tests" ) ,
547
+ ) ;
548
+ return ;
549
+
550
+ case "network-file-systems" :
551
+ case "env-variables" :
552
+ case "upgrades" :
553
+ case "software-environment" :
520
554
default :
521
555
throw Error ( `configuring group ${ group } not implemented` ) ;
522
556
}
0 commit comments