<commit_before>//this is a sample js file that can be served for playback. All js files added
//for playback should be placed in /core/public/js/ and the storyteller server
//will serve these. 

//We can use classes here instead of plain functions

async function initializePlayback()
{
    try {
        const playbackInfo = await Promise.all([
            fetch('/event'),
            fetch('/comment'),
            fetch('/playbackEditable'),
            fetch('/developer'),
            fetch('/developerGroup'),
            fetch('/project')

        ]);
        

        const results = await Promise.all([
            playbackInfo[0].json(),
            playbackInfo[1].json(),
            playbackInfo[2].json(),
            playbackInfo[3].json(),
            playbackInfo[4].json(),
            playbackInfo[5].json()
        ]);       

        playbackData.events = results[0];
        playbackData.comments = results[1];
        playbackData.numEvents = playbackData.events.length;
        playbackData.isEditable = results[2].editable;
        playbackData.developers = results[3];
        playbackData.developerGroups = results[4];
        playbackData.playbackTitle = results[5].title;

        if (!playbackData.comments['ev--1'])
        {
            const newDescription = createCommentObject('Insert DESCRIPTION here.', {id: 'ev--1', eventSequenceNumber: -1}, [], [], [], []);

            const descrFromServer = sendCommentToServer(newDescription);

            playbackData.comments['ev--1'] = [];
            playbackData.comments['ev--1'].push(descrFromServer);

        }

        console.log(playbackData.comments);

        //displays all comments
        displayAllComments();

        //Sets up the event listeners for html elements on the page
        setupEventListeners();

        //grab any existing media from the server and display it in the media control modal
        initImageGallery();

        console.log('Success Initializing Playback');

    } catch(err) {
        console.log(`Error retrieving data`);<commit_msg>fixed loading error with new playback<commit_after>//this is a sample js file that can be served for playback. All js files added
//for playback should be placed in /core/public/js/ and the storyteller server
//will serve these. 

//We can use classes here instead of plain functions

async function initializePlayback()
{
    try {
        const playbackInfo = await Promise.all([
            fetch('/event'),
            fetch('/comment'),
            fetch('/playbackEditable'),
            fetch('/developer'),
            fetch('/developerGroup'),
            fetch('/project')

        ]);
        

        const results = await Promise.all([
            playbackInfo[0].json(),
            playbackInfo[1].json(),
            playbackInfo[2].json(),
            playbackInfo[3].json(),
            playbackInfo[4].json(),
            playbackInfo[5].json()
        ]);       

        playbackData.events = results[0];
        playbackData.comments = results[1];
        playbackData.numEvents = playbackData.events.length;
        playbackData.isEditable = results[2].editable;
        playbackData.developers = results[3];
        playbackData.developerGroups = results[4];
        playbackData.playbackTitle = results[5].title;

        if (!playbackData.comments['ev--1'])
        {
            const newDescription = createCommentObject('Insert DESCRIPTION here.', {id: 'ev--1', eventSequenceNumber: -1}, [], [], [], []);

            const descrFromServer = await sendCommentToServer(newDescription);

            playbackData.comments['ev--1'] = [];
            playbackData.comments['ev--1'].push(descrFromServer);

        }

        console.log(playbackData.comments);

        //displays all comments
        displayAllComments();

        //Sets up the event listeners for html elements on the page
        setupEventListeners();

        //grab any existing media from the server and display it in the media control modal
        initImageGallery();

        console.log('Success Initializing Playback');

    } catch(err) {
        console.log(`Error retrieving data`);
{'fraction_non_alphanumeric': 0.11849710982658959, 'fraction_numerical': 0.008188824662813102, 'mean_word_length': 2.2470680218921033, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1530271', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1036, 'n_words': 271}