@@ -33,6 +33,10 @@ export default Service.extend(Evented, {
3333 this . set ( 'applicationinteraction.model' , model ) ;
3434 } ,
3535 updateLandscapeList ( reload ) {
36+ if ( this . get ( 'mockBackend' ) ) {
37+ this . set ( 'landscapeList' , [ ] ) ;
38+ this . set ( 'landscapeList' , this . get ( 'store' ) . peekAll ( 'tutoriallandscape' ) ) ;
39+ } else {
3640 this . set ( 'landscapeList' , [ ] ) ;
3741 this . get ( 'store' ) . findAll ( 'tutoriallandscape' , { reload } )
3842 . then ( landscapes => {
@@ -41,6 +45,7 @@ export default Service.extend(Evented, {
4145 landscapeList . sort ( ( landscape1 , landscape2 ) => parseInt ( landscape1 . id ) < parseInt ( landscape2 . id ) ? - 1 : 1 ) ;
4246 this . set ( 'landscapeList' , landscapeList ) ;
4347 } ) ;
48+ }
4449 } ,
4550 loadLandscape ( model ) {
4651 if ( this . get ( 'landscape' ) !== null ) {
@@ -55,19 +60,22 @@ export default Service.extend(Evented, {
5560 }
5661 }
5762 if ( model . get ( 'landscapeTimestamp' ) != undefined && model . get ( 'landscapeTimestamp' ) != "" ) {
58- this . importLandscape ( model . get ( 'landscapeTimestamp' ) , "" ) ;
63+ if ( model . get ( 'landscapeTimestamp' ) != this . get ( 'landscape.timestamp.timestamp' ) ) {
64+ this . importLandscape ( model . get ( 'landscapeTimestamp' ) , "" ) ;
65+ }
5966 }
6067
6168 } ,
6269 importLandscape ( landscapeTimestamp , name ) {
6370 if ( this . get ( 'mockBackend' ) ) {
64- this . get ( 'store' ) . queryRecord ( 'landscape' , { timestamp : landscapeTimestamp } ) . then ( ( landscape ) => {
65- this . set ( 'landscape' , landscape ) ;
66- this . get ( 'renderingService' ) . reSetupScene ( ) ;
67- } ) ;
71+ this . get ( 'store' ) . queryRecord ( 'landscape' , { timestamp : landscapeTimestamp } ) . then ( ( landscape ) => {
72+ this . set ( 'landscape' , landscape ) ;
73+ this . get ( 'renderingService' ) . reSetupScene ( ) ;
74+ } ) ;
6875 } else {
6976 this . get ( 'store' ) . queryRecord ( 'tutoriallandscape' , { timestamp : landscapeTimestamp } ) . then ( ( tutlandscape ) => {
7077 this . set ( 'landscape' , tutlandscape ) ;
78+ this . get ( 'renderingService' ) . reSetupScene ( ) ;
7179 } , ( ) => {
7280 this . get ( 'store' ) . queryRecord ( 'landscape' , { timestamp : landscapeTimestamp } ) . then ( ( landscape ) => {
7381 if ( ! this . get ( 'store' ) . hasRecordForId ( 'tutoriallandscape' , landscape . get ( 'id' ) ) ) {
@@ -90,8 +98,10 @@ export default Service.extend(Evented, {
9098 timestamprecord . save ( ) ;
9199 landscaperecord . save ( ) ;
92100 this . set ( 'landscape' , landscaperecord ) ;
101+ this . get ( 'renderingService' ) . reSetupScene ( ) ;
93102 } else {
94103 this . set ( 'landscape' , landscape ) ;
104+ this . get ( 'renderingService' ) . reSetupScene ( ) ;
95105 }
96106 } ) ;
97107 } ) ;
0 commit comments