77 formatMultiResult ,
88} from '@wca/helpers' ;
99import { format , parseISO } from 'date-fns' ;
10- import * as ics from 'ics'
10+ import * as ics from 'ics' ;
1111
1212export const byName = ( a : { name : string } , b : { name : string } ) => a . name . localeCompare ( b . name ) ;
1313export const byDate = < T > ( a : T & { startTime : string } , b : T & { startTime : string } ) =>
@@ -157,20 +157,28 @@ const AssignmentCodeDescription = {
157157 'staff-dataentry' : 'Data Entry for:' ,
158158 'staff-announcer' : 'Announcing for:' ,
159159 'staff-delegate' : 'Delegating for:' ,
160- ' competitor' : 'Competing in:'
160+ competitor : 'Competing in:' ,
161161} ;
162162
163- export const generateIcs = ( assignments , fileName ) => {
163+ export const generateIcs = ( assignments , fileName ) => {
164164 if ( ! assignments ) {
165165 return ;
166166 }
167167
168168 console . log ( assignments ) ;
169169
170- let events : { title : string ; description : string ; location : string ; start : ics . DateArray ; end : ics . DateArray } [ ] = [ ] ;
171-
172- assignments . forEach ( item => {
173- const titleFormatted = `${ AssignmentCodeDescription [ item . assignmentCode ] } for ${ item . activity . name } ` ;
170+ let events : {
171+ title : string ;
172+ description : string ;
173+ location : string ;
174+ start : ics . DateArray ;
175+ end : ics . DateArray ;
176+ } [ ] = [ ] ;
177+
178+ assignments . forEach ( ( item ) => {
179+ const titleFormatted = `${ AssignmentCodeDescription [ item . assignmentCode ] } for ${
180+ item . activity . name
181+ } `;
174182 const startDate = new Date ( item . activity . startTime ) ;
175183 const endDate = new Date ( item . activity . endTime ) ;
176184
@@ -188,7 +196,8 @@ export const generateIcs = (assignments, fileName) => {
188196 endDate . getDate ( ) ,
189197 endDate . getHours ( ) ,
190198 endDate . getMinutes ( ) ,
191- ] ; endDate
199+ ] ;
200+ endDate ;
192201
193202 const icalEvent = {
194203 title : titleFormatted ,
@@ -222,4 +231,4 @@ export const generateIcs = (assignments, fileName) => {
222231 a . click ( ) ;
223232
224233 document . body . removeChild ( a ) ;
225- }
234+ } ;
0 commit comments