Browse Source

update scenes list if new scenes are available

Jérôme BUISINE 2 months ago
parent
commit
5ceb9716e3

+ 0 - 1
generateExtracts.js

@@ -67,7 +67,6 @@ const setup = async () => {
 
   // Cut the image
   const extracts = await cutImage(image, extractConfigX, extractConfigY)
-  console.log(extracts)
 
   // Move extracts images if outputDir is specified
   if (outputDir)

+ 1 - 0
src/store/mutations.js

@@ -24,6 +24,7 @@ const createProgressionObj = (state, scenes) => {
       if (state.progression[state.experimentId][state.userId][expe.name] && state.progression[state.experimentId][state.userId][expe.name][scene])
         accScene[scene] = state.progression[state.experimentId][state.userId][expe.name][scene]
       else accScene[scene] = { done: false, data: {} }
+
       return accScene
     }, {})
     accExpe[expe.name] = scenesProgressObj

+ 6 - 2
src/views/ExperimentValidated.vue

@@ -31,7 +31,7 @@
 </template>
 
 <script>
-import { mapGetters } from 'vuex'
+import { mapActions, mapGetters } from 'vuex'
 import Experiments from '@/router/experiments'
 import { getExperimentSceneList } from '@/config.utils'
 import { rand } from '@/functions'
@@ -56,6 +56,7 @@ export default {
   },
   computed: {
     ...mapGetters(['getAllExperimentProgress']),
+    ...mapActions(['loadScenesList']),
 
     hasScenesLeft() {
       return this.availableScenes.length > 0
@@ -64,7 +65,10 @@ export default {
       return this.availableScenes[rand(0, this.availableScenes.length - 1)]
     }
   },
-  mounted() {
+  async mounted() {
+    // reload scene list to update
+    await this.loadScenesList
+
     const scenesList = getExperimentSceneList(this.experimentName)
 
     // load current user progression

+ 5 - 1
src/views/Experiments/_template.vue

@@ -19,6 +19,8 @@
 import ExperimentBlock from '@/components/ExperimentBlock.vue'
 import ExperimentBase from '@/mixins/ExperimentBase'
 
+import { mapActions } from 'vuex'
+
 export default {
   components: {
     ExperimentBlock
@@ -56,7 +58,9 @@ export default {
   },
 
   // List of experiment-specific methods
-  methods: {}
+  methods: {
+    ...mapActions(['loadScenesList'])
+  }
 }
 </script>
 

+ 5 - 1
src/views/SelectExperimentScene.vue

@@ -66,7 +66,7 @@
 
 <script>
 import Loader from '@/components/Loader.vue'
-import { mapGetters } from 'vuex'
+import { mapGetters, mapActions } from 'vuex'
 import Experiments from '@/router/experiments'
 import { API_ROUTES, shuffleArray } from '@/functions'
 import { getExperimentSceneList } from '@/config.utils'
@@ -92,6 +92,7 @@ export default {
   },
   computed: {
     ...mapGetters(['getHostURI', 'getAllExperimentProgress']),
+    ...mapActions(['loadScenesList']),
 
     numberOfScenes() {
       return this.scenes.length
@@ -104,6 +105,9 @@ export default {
     }
   },
   async mounted() {
+    // reload scene list to update
+    await this.loadScenesList
+
     const scenesList = getExperimentSceneList(this.experimentName)
 
     // retrieve experiment data of user