Parcourir la source

update use of calibration; calibration shown every scenes

Jérôme BUISINE il y a 3 ans
Parent
commit
53919fcf9b

+ 4 - 2
src/mixins/ExperimentBase.vue

@@ -31,9 +31,11 @@ export default {
     ...mapGetters(['getHostURI', 'getExperimentProgress', 'isExperimentDone'])
   },
   mounted() {
-    // here push in session (if not already there) current user advancement
+    // when new session push (if not already there) current user advancement (number of scenes) and redirect to calibration
     if (window.sessionStorage.getItem('sin3d-nb-scenes') === null) {
-      window.sessionStorage.setItem('sin3d-nb-scenes', 0)
+      window.sessionStorage.setItem('sin3d-nb-scenes', 1)
+      this.sceneName = '50_shades_of_grey'
+      this.$router.push(`/experiments/${this.experimentName}/50_shades_of_grey`)
     }
 
     if (!this.getExperimentProgress({ experimentName: this.experimentName, sceneName: this.sceneName }).experimentName)

+ 0 - 3
src/views/ExperimentValidated.vue

@@ -110,10 +110,7 @@ export default {
       let nScenes = Number(window.sessionStorage.getItem('sin3d-nb-scenes'))
       window.sessionStorage.setItem('sin3d-nb-scenes', nScenes + 1)
 
-      console.log('Check ', nScenes, ' => ', this.showCalibrationEvery)
-
       if (nScenes % this.showCalibrationEvery === 0) {
-        console.log('Start redirect to calibration')
         this.$router.push(`/experiments/${this.experimentName}/50_shades_of_grey`)
       }
       else if (this.hasScenesLeft) {

+ 2 - 2
src/views/Experiments/CalibrationMeasurement.vue

@@ -131,7 +131,7 @@ export default {
       const URI = `${this.getHostURI}${API_ROUTES.listSceneQualities(
         this.sceneName
       )}`
-      const { data } = await fetch(URI).then(res => res.json())
+      const { data } = await fetch(URI).then(res => res.json()).catch(e => console.log(e))
       this.qualities = data
 
       // remove reference
@@ -140,7 +140,7 @@ export default {
 
     // get reference size of image
     await Promise.all([
-      this.getImage('max').then(res => (reference = res))
+      this.getImage('max').then(res => (reference = res)).catch(e => console.log(e))
     ])
 
     this.maxWidth = reference.metadata.width

+ 36 - 47
src/views/Experiments/MatchExtractsWithReference.vue

@@ -309,64 +309,53 @@ export default {
     ...mapGetters(['getHostURI', 'getAllExperimentProgress'])
   },
   async mounted() {
-    // redirect by default to calibration scene
-    let nScenes = Number(window.sessionStorage.getItem('sin3d-nb-scenes'))
-    if (nScenes === 0) {
-      console.log('number of scene is', nScenes)
-      window.sessionStorage.setItem('sin3d-nb-scenes', nScenes + 1)
-      this.$router.push(`/experiments/${this.experimentName}/50_shades_of_grey`)
-    }
-    else {
-      // Load config for this scene to local state
-      this.loadConfig()
+    // Load config for this scene to local state
+    this.loadConfig()
 
-      // Load progress from store into local state
-      this.loadProgress()
+    // Load progress from store into local state
+    this.loadProgress()
 
-      this.launcherURI = this.getHostURI + '/launcher/'
+    this.launcherURI = this.getHostURI + '/launcher/'
 
-      let reference = null
+    let reference = null
 
-      // Load scene data from the API
-      await Promise.all([
-        this.getImage('max').then(res => (reference = res)),
-        this.getQualitiesList()
-      ])
+    // Load scene data from the API
+    await Promise.all([
+      this.getImage('max').then(res => (reference = res)).catch(e => console.log(e)),
+      this.getQualitiesList()
+    ])
 
-      this.referenceImage = reference.link
+    this.referenceImage = reference.link
 
-      this.maxWidth = reference.metadata.width
-      this.maxHeight = reference.metadata.height
+    this.maxWidth = reference.metadata.width
+    this.maxHeight = reference.metadata.height
 
-      // Load the cached configuration in the configurator component
-      if (this.lockConfig === false) this.$refs.configurator.setDefaultConfig(this.extractConfig)
+    // Load the cached configuration in the configurator component
+    if (this.lockConfig === false) this.$refs.configurator.setDefaultConfig(this.extractConfig)
 
-      // Load extracts if none were cached
-      // if (this.extracts.length === 0)
-      await this.setExtractConfig(this.extractConfig, this.$refs.configurator)
+    // Load extracts if none were cached
+    // if (this.extracts.length === 0)
+    await this.setExtractConfig(this.extractConfig, this.$refs.configurator)
 
-      this.saveProgress()
-      this.loadExperimentState()
+    this.saveProgress()
+    this.loadExperimentState()
 
-      // check window size
-      this.checkWindow()
-      window.addEventListener('resize', this.checkWindow)
+    // check window size
+    this.checkWindow()
+    window.addEventListener('resize', this.checkWindow)
 
-      // check if calibration is already done
-      if (this.sceneName === '50_shades_of_grey') {
-        // load current user progression
-        this.progression = this.getAllExperimentProgress()
-        let done = this.progression[this.experimentName][this.sceneName].done
-
-        console.log('Calibration scene is done', done)
-
-        if (done === true) {
-          console.log('Change of state for calibration')
-          this.calibrationCheck = true
-          this.runExpe = true
-          this.explanation = false
-          this.calibrationScene = true
-        }
+    // check if calibration is already done
+    if (this.sceneName === '50_shades_of_grey') {
+      // load current user progression
+      this.progression = this.getAllExperimentProgress()
+      let done = this.progression[this.experimentName][this.sceneName].done
+
+      // change variable state for calibration if already done
+      if (done === true) {
+        this.calibrationCheck = true
+        this.runExpe = true
+        this.explanation = false
+        this.calibrationScene = true
       }
     }
   },

+ 1 - 1
src/views/Experiments/MatchExtractsWithReferenceAll.vue

@@ -111,7 +111,7 @@ export default {
 
     // Load scene data from the API
     await Promise.all([
-      this.getImage('max').then(res => (reference = res)),
+      this.getImage('max').then(res => (reference = res)).catch(e => console.log(e)),
       this.getQualitiesList()
     ])
 

+ 1 - 1
src/views/SelectExperimentScene.vue

@@ -124,6 +124,7 @@ export default {
     for (const aScene of scenesList) {
       const { data: thumb } = await fetch(`${this.getHostURI}${API_ROUTES.getImage(aScene, 'max')}`)
         .then(res => res.json())
+        .catch(e => console.log(e))
 
       let sceneObj = {
         name: thumb.sceneName,
@@ -161,7 +162,6 @@ export default {
     if (window.sessionStorage.getItem('sin3d-nb-scenes') !== null) {
       let nScenes = Number(window.sessionStorage.getItem('sin3d-nb-scenes'))
 
-      console.log('Redirect to calibration when selection')
       if (nScenes % this.showCalibrationEvery === 0)
         this.$router.push(`/experiments/${this.experimentName}/50_shades_of_grey`)
     }