@@ -33,6 +33,7 @@ qx.Class.define("osparc.desktop.credits.CheckoutsTableModel", {
3333 }
3434 this . setSortColumnIndexWithoutSortingData ( checkoutsCols . START . column ) ;
3535 this . setSortAscendingWithoutSortingData ( false ) ;
36+ this . setColumnSortable ( checkoutsCols . DURATION . column , false ) ;
3637 } ,
3738
3839 properties : {
@@ -135,14 +136,21 @@ qx.Class.define("osparc.desktop.credits.CheckoutsTableModel", {
135136 const licensedItemId = checkoutsItem [ "licensedItemId" ] ;
136137 const licensedItem = licensedItems . find ( licItem => licItem [ "licensedItemId" ] === licensedItemId ) ;
137138 const vipModel = vipModels . find ( vipMdl => licensedItem && ( vipMdl [ "modelId" ] == licensedItem [ "name" ] ) ) ;
139+ let start = "" ;
140+ let duration = "" ;
141+ if ( checkoutsItem [ "startedAt" ] ) {
142+ start = osparc . utils . Utils . formatDateAndTime ( new Date ( checkoutsItem [ "startedAt" ] ) ) ;
143+ if ( checkoutsItem [ "stoppedAt" ] ) {
144+ duration = osparc . utils . Utils . formatMsToHHMMSS ( new Date ( checkoutsItem [ "stoppedAt" ] ) - new Date ( checkoutsItem [ "startedAt" ] ) ) ;
145+ }
146+ }
138147 data . push ( {
139- [ checkoutsCols . PURCHASE_ID . id ] : checkoutsItem [ "licensedItemPurchaseId " ] ,
148+ [ checkoutsCols . CHECKOUT_ID . id ] : checkoutsItem [ "licensed_item_checkout_id " ] ,
140149 [ checkoutsCols . ITEM_ID . id ] : licensedItemId ,
141150 [ checkoutsCols . ITEM_LABEL . id ] : vipModel ? vipModel [ "name" ] : "unknown model" ,
142- [ checkoutsCols . START . id ] : osparc . utils . Utils . formatDateAndTime ( new Date ( checkoutsItem [ "startAt" ] ) ) ,
143- [ checkoutsCols . END . id ] : osparc . utils . Utils . formatDateAndTime ( new Date ( checkoutsItem [ "expireAt" ] ) ) ,
151+ [ checkoutsCols . START . id ] : start ,
152+ [ checkoutsCols . DURATION . id ] : duration ,
144153 [ checkoutsCols . SEATS . id ] : checkoutsItem [ "numOfSeats" ] ,
145- [ checkoutsCols . COST . id ] : checkoutsItem [ "pricingUnitCost" ] ? ( "-" + parseFloat ( checkoutsItem [ "pricingUnitCost" ] ) . toFixed ( 2 ) ) : "" , // show it negative
146154 [ checkoutsCols . USER . id ] : checkoutsItem [ "purchasedByUser" ] ,
147155 } ) ;
148156 } ) ;
0 commit comments