Skip to content

Commit a5a5c4b

Browse files
committed
Add support for retrieving chairs ID from global sheet
1 parent d7e15bd commit a5a5c4b

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

tools/appscript/propose-grid.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { suggestSchedule } from '../common/schedule.mjs';
44
import reportError from './report-error.mjs';
55
import { validateGrid } from '../common/validate.mjs';
66
import { 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...`);

tools/appscript/validate-grid.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import reportError from './report-error.mjs';
22
import { getProject, saveSessionValidationInSheet } from './project.mjs';
33
import { fillGridSheet } from './schedule.mjs';
44
import { 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...');

tools/appscript/w3cid-map.mjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
}

0 commit comments

Comments
 (0)