File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { suggestSchedule } from '../common/schedule.mjs';
44import reportError from './report-error.mjs' ;
55import { validateGrid } from '../common/validate.mjs' ;
66import { Srand } from '../common/jsrand.mjs' ;
7+ import { fetchMapping } from './w3cid-map.mjs' ;
78
89/**
910 * Generate the grid for the current spreadsheet
@@ -20,6 +21,7 @@ async function proposeGrid(spreadsheet) {
2021 try {
2122 console . log ( 'Read data from spreadsheet...' ) ;
2223 const project = getProject ( spreadsheet ) ;
24+ project . w3cIds = await fetchMapping ( ) ;
2325 if ( ! project . sheets . sessions . sheet ) {
2426 reportError ( 'No sheet found that contains the list of sessions, please import data from GitHub first.' ) ;
2527 return ;
@@ -28,7 +30,9 @@ async function proposeGrid(spreadsheet) {
2830
2931 console . log ( 'Prompt user...' ) ;
3032 console . log ( '- TODO: prompt user for confirmation and parameters' ) ;
31- const options = { } ;
33+ const options = {
34+ preserve : [ 'all' ]
35+ } ;
3236 console . log ( 'Prompt user... done' ) ;
3337
3438 console . log ( `Validate sessions...` ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import reportError from './report-error.mjs';
22import { getProject , saveSessionValidationInSheet } from './project.mjs' ;
33import { fillGridSheet } from './schedule.mjs' ;
44import { validateGrid } from '../common/validate.mjs' ;
5+ import { fetchMapping } from './w3cid-map.mjs' ;
56
67/**
78 * Export the event data as JSON
@@ -11,6 +12,7 @@ export default async function () {
1112 console . log ( 'Read data from spreadsheet...' ) ;
1213 const spreadsheet = SpreadsheetApp . getActiveSpreadsheet ( ) ;
1314 const project = getProject ( spreadsheet ) ;
15+ project . w3cIds = await fetchMapping ( ) ;
1416 console . log ( 'Read data from spreadsheet... done' ) ;
1517
1618 console . log ( 'Validate the grid...' ) ;
Original file line number Diff line number Diff line change 1+ import { getEnvKey } from '../common/envkeys.mjs' ;
2+
3+ /**
4+ * Fetch private mapping information from the Google sheet
5+ */
6+ export async function fetchMapping ( ) {
7+ const W3CID_SPREADSHEET = await getEnvKey ( 'W3CID_SPREADSHEET' ) ;
8+ const spreadsheet = SpreadsheetApp . openById ( W3CID_SPREADSHEET ) ;
9+
10+ const mapping = { } ;
11+ for ( const sheet of spreadsheet . getSheets ( ) ) {
12+ const rows = sheet . getDataRange ( ) . getValues ( ) ;
13+ for ( const row of rows . slice ( 1 ) ) {
14+ mapping [ row [ 0 ] ] = row [ 1 ] ;
15+ }
16+ }
17+
18+ return mapping ;
19+ }
You can’t perform that action at this time.
0 commit comments