File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
services/static-webserver/client/source/class/osparc Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -186,8 +186,10 @@ qx.Class.define("osparc.desktop.StudyEditor", {
186186 if ( "status" in err && err [ "status" ] ) {
187187 if ( err [ "status" ] == 402 ) { // the study has some debt that needs to be paid
188188 msg = err [ "message" ] ;
189- msg += "<br>" + err [ "debtAmount" ] + "$" ;
190- study . setInDebt ( err [ "debtAmount" ] ) ;
189+ const debt = err [ "debtAmount" ] ;
190+ msg += "<br>" + debt + "$" ;
191+ study . setInDebt ( debt ) ;
192+ osparc . store . Store . getInstance ( ) . setStudyDebt ( study . getUuid ( ) , debt ) ;
191193 } else if ( err [ "status" ] == 409 ) { // max_open_studies_per_user
192194 msg = err [ "message" ] ;
193195 } else if ( err [ "status" ] == 423 ) { // Locked
Original file line number Diff line number Diff line change @@ -424,6 +424,19 @@ qx.Class.define("osparc.store.Store", {
424424 }
425425 } ,
426426
427+ setStudyDebt : function ( studyId , debt ) {
428+ const studiesWStateCache = this . getStudies ( ) ;
429+ const idx = studiesWStateCache . findIndex ( studyWStateCache => studyWStateCache [ "uuid" ] === studyId ) ;
430+ if ( idx !== - 1 ) {
431+ studiesWStateCache [ idx ] [ "inDebt" ] = debt ;
432+ }
433+
434+ const currentStudy = this . getCurrentStudy ( ) ;
435+ if ( currentStudy && currentStudy . getUuid ( ) === studyId ) {
436+ currentStudy . setInDebt ( debt ) ;
437+ }
438+ } ,
439+
427440 setTemplateState : function ( templateId , state ) {
428441 const templatesWStateCache = this . getTemplates ( ) ;
429442 const idx = templatesWStateCache . findIndex ( templateWStateCache => templateWStateCache [ "uuid" ] === templateId ) ;
You can’t perform that action at this time.
0 commit comments