Skip to content

Commit ec753a3

Browse files
committed
Handle remote modality (#7)
1 parent cf937ed commit ec753a3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/app.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,17 @@ program
381381

382382
const mesure = moment('11:30', 'HH:mm').format('LT').length;
383383

384+
let rooms = (activity.modality === 'Distanciel') ? 'Remote' : 'Unknown';
385+
386+
if (activity.rooms?.length > 0) {
387+
const roomInfo = activity.rooms[0];
388+
rooms = activity.rooms.map(room => `${roomInfo.campus} ${roomInfo.name} (${roomInfo.floor})`).join(' - ');
389+
}
390+
384391
return {
385392
Day: activity_start.format('ddd, LL'),
386393
Schedule: `${activity_start.format('LT').padStart(mesure, '0')} -> ${activity_end.format('LT').padStart(mesure, '0')}`,
387-
'Room(s)': (activity.rooms || []).reduce((str, room) => `${str ? `${str} - ` : ''}${room.campus} ${room.name} (${room.floor})`, ''),
394+
'Room(s)': rooms,
388395
Name: activity.name,
389396
Teacher: activity.teacher,
390397
};

0 commit comments

Comments
 (0)