@@ -23,12 +23,20 @@ type YamlRaw = {
2323 withChildren : boolean | undefined
2424}
2525
26+ export type SectionConfig = {
27+ withChildren : boolean
28+ }
29+
30+ export function sectionToKey ( section : string [ ] ) {
31+ return section . join ( '\n' )
32+ }
33+
2634type Yaml = {
2735 assignment : string | undefined
2836 assignmentName : string | undefined
2937 paths : ( string | PathMap ) [ ]
3038 section : string [ ] [ ]
31- withChildren : boolean
39+ sectionConfig : Map < string , SectionConfig >
3240}
3341
3442export type TimeExtension = {
@@ -194,21 +202,24 @@ function validityState(ymls: YamlRaw[]): Yaml[] {
194202 if ( assignmentId === undefined ) {
195203 throw new Error ( 'assignment and assignmentName does not exist' )
196204 }
205+ const withChildren = yml . withChildren !== false
197206 if ( map . has ( assignmentId ) ) {
198207 const item = map . get ( assignmentId )
199208 if ( ! item ) {
200209 continue
201210 }
202211 item . section . push ( section )
203212 item . paths = item . paths . concat ( yml . paths || [ ] )
213+ item . sectionConfig . set ( sectionToKey ( section ) , { withChildren : withChildren } )
204214 } else {
205- const withChildren = yml . withChildren !== false
215+ const sectionConfig : Map < string , SectionConfig > = new Map ( )
216+ sectionConfig . set ( sectionToKey ( section ) , { withChildren : withChildren } )
206217 map . set ( assignmentId , {
207218 assignment : yml . assignment ,
208219 assignmentName : yml . assignmentName ,
209220 paths : yml . paths || [ ] ,
210221 section : [ section ] ,
211- withChildren : withChildren
222+ sectionConfig : sectionConfig
212223 } )
213224 }
214225 }
@@ -232,13 +243,14 @@ function validateYmlCfg(ymls: Yaml[]): Yaml[] {
232243 }
233244 item . section = item . section . concat ( section )
234245 item . paths = item . paths . concat ( yml . paths || [ ] )
246+ item . sectionConfig = yml . sectionConfig
235247 } else {
236248 map . set ( assignmentId , {
237249 assignment : yml . assignment ,
238250 assignmentName : yml . assignmentName ,
239251 paths : yml . paths || [ ] ,
240252 section : section ,
241- withChildren : yml . withChildren
253+ sectionConfig : yml . sectionConfig
242254 } )
243255 }
244256 }
@@ -301,7 +313,7 @@ async function reducePublish(courseId: string, srcDir: string, yamlDir: string,
301313 if ( ! item . assignment ) {
302314 throw new Error ( `assignment not found with name "${ item . assignmentName } "` )
303315 }
304- await tools . reduce ( srcDir , tmpDstDir , item . section , _ . compact ( paths ) , item . withChildren )
316+ await tools . reduce ( srcDir , tmpDstDir , item . section , _ . compact ( paths ) , item . sectionConfig )
305317 await assignment . publish ( courseId , item . assignment , tmpDstDir , changelogOrOptions )
306318 fs . rmSync ( tmpDstDir , { recursive : true } )
307319 }
0 commit comments