ccp-eva / matt

⛵️ Moral Attitudes Study
MIT License
0 stars 0 forks source link

Möglichkeit, eine Slide zurückzugehen? falls man hängen bleibt #208

Open NoemiThiede opened 1 year ago

kalaschnik commented 1 year ago

Would require modifying the main procedure loop... sounds more like a post release thing

kalaschnik commented 1 year ago

Putting the currentProcedure in global data, for example:

for (const [index, slide] of data.currentProcedure.entries()) {
        // save slides in global data object
        data.previousSlide = data.currentProcedure[index - 1];
        data.currentSlide = slide;
        data.nextSlide = data.currentProcedure[index + 1];
        data.slideCounter++;

        // init default procedure response
        data.procedure[slide] = {
            duration: 0,
            response: '',
        };

        // track dilemma slides

        // start time tracking
        const startTime = new Date().getTime();

        // iterate through the slides
        await (await import(`./${slide}`)).default();

        await sleep(config.globals.slideGapDuration);

        // stop audio playback if it is still playing anything
        stop();

        // save duration of each slide
        data.procedure[slide].duration = new Date().getTime() - startTime;
    }

You should also provide utility functions such as:

- goToSlideIndex()
- nextSlide()
- previousSide()