Skip to content

Commit d7e15bd

Browse files
committed
Fix breakouts sheet creation step
1 parent 211a7f3 commit d7e15bd

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tools/appscript/project.mjs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { getEnvKey } from '../common/envkeys.mjs';
21
import { getSessionSections } from '../common/session-sections.mjs';
32

43
/**
@@ -529,7 +528,7 @@ export function refreshProject(spreadsheet, project, { what }) {
529528
if (['all', 'sessions', 'grid'].includes(what)) {
530529
if (!sheets.sessions.sheet) {
531530
sheets.sessions.sheet = createSessionsSheet(spreadsheet, sheets, project);
532-
sheets.sessions.headers = getHeaders(sheet);
531+
sheets.sessions.headers = getHeaders(sheets.sessions.sheet);
533532
}
534533
refreshData('sessions');
535534
}
@@ -540,9 +539,7 @@ export function refreshProject(spreadsheet, project, { what }) {
540539
function createSessionsSheet(spreadsheet, sheets, project) {
541540
// Create the new sheet
542541
const title = project.metadata.type === 'groups' ? 'List' : 'Breakouts';
543-
const position = project.sheets.grid.sheet ?
544-
spreadsheet.getSheets().length - 2 :
545-
spreadsheet.getSheets().length - 1;
542+
const position = spreadsheet.getSheets().findIndex(s => s === sheets.grid.sheet) + 1;
546543
const sheet = spreadsheet.insertSheet(title, position);
547544

548545
// Set the headers row

0 commit comments

Comments
 (0)