@@ -188,10 +188,9 @@ def export_getJobPageSummaryWeb(self, selectDict, sortList, startItem, maxItems,
188
188
)
189
189
summaryJobList = validJobs
190
190
191
- res = self .jobDB .getJobsAttributes (summaryJobList )
192
- if not res ["OK" ]:
193
- return res
194
- return S_OK (strToIntDict (res ["Value" ]))
191
+ result = self .jobDB .getJobsAttributes (summaryJobList )
192
+ if not result ["OK" ]:
193
+ return result
195
194
196
195
summaryDict = result ["Value" ]
197
196
# If no jobs can be selected after the properties check
@@ -352,14 +351,9 @@ def export_getDistinctAttributeValues(cls, attribute, selectDict):
352
351
353
352
@classmethod
354
353
def export_getTransformationFilesSummaryWeb (cls , selectDict , sortList , startItem , maxItems ):
355
- selectColumns = (["TransformationID" , "Status" , "UsedSE" , "TargetSE" ],)
356
- timeStamp = ("LastUpdate" ,)
357
- statusColumn = ("Status" ,)
358
354
fromDate = selectDict .get ("FromDate" , None )
359
355
if fromDate :
360
356
del selectDict ["FromDate" ]
361
- # if not fromDate:
362
- # fromDate = last_update
363
357
toDate = selectDict .get ("ToDate" , None )
364
358
if toDate :
365
359
del selectDict ["ToDate" ]
@@ -369,26 +363,21 @@ def export_getTransformationFilesSummaryWeb(cls, selectDict, sortList, startItem
369
363
else :
370
364
orderAttribute = None
371
365
# Get the columns that match the selection
372
- fcn = None
373
- fcnName = "getTransformationFiles"
374
- if hasattr (cls .transformationDB , fcnName ) and callable (getattr (cls .transformationDB , fcnName )):
375
- fcn = getattr (cls .transformationDB , fcnName )
376
- if not fcn :
377
- return S_ERROR (f"Unable to invoke gTransformationDB.{ fcnName } , it isn't a member function" )
378
- res = fcn (condDict = selectDict , older = toDate , newer = fromDate , timeStamp = timeStamp , orderAttribute = orderAttribute )
366
+ res = cls .transformationDB .getTransformationFiles (
367
+ condDict = selectDict , older = toDate , newer = fromDate , timeStamp = "LastUpdate" , orderAttribute = orderAttribute
368
+ )
379
369
if not res ["OK" ]:
380
370
return res
381
-
382
- # The full list of columns in contained here
383
371
allRows = res ["Value" ]
372
+
384
373
# Prepare the standard structure now within the resultDict dictionary
385
374
resultDict = {}
386
- # Create the total records entry
387
375
resultDict ["TotalRecords" ] = len (allRows )
388
376
389
- # Get the rows which are within the selected window
390
- if resultDict ["TotalRecords" ] == 0 :
377
+ if not allRows :
391
378
return S_OK (resultDict )
379
+
380
+ # Get the rows which are within the selected window
392
381
ini = startItem
393
382
last = ini + maxItems
394
383
if ini >= resultDict ["TotalRecords" ]:
@@ -403,25 +392,25 @@ def export_getTransformationFilesSummaryWeb(cls, selectDict, sortList, startItem
403
392
404
393
# Create the ParameterNames entry
405
394
resultDict ["ParameterNames" ] = list (selectedRows [0 ].keys ())
406
- # Find which element in the tuple contains the requested status
407
- if statusColumn not in resultDict ["ParameterNames" ]:
408
- return S_ERROR ("Provided status column not present" )
409
395
410
396
# Generate the status dictionary
411
397
statusDict = {}
412
398
for row in selectedRows :
413
- status = row [statusColumn ]
399
+ status = row ["Status" ]
414
400
statusDict [status ] = statusDict .setdefault (status , 0 ) + 1
415
401
resultDict ["Extras" ] = statusDict
416
402
417
403
# Obtain the distinct values of the selection parameters
418
404
res = cls .transformationDB .getTableDistinctAttributeValues (
419
- "TransformationFiles" , selectColumns , selectDict , older = toDate , newer = fromDate
405
+ "TransformationFiles" ,
406
+ ["TransformationID" , "Status" , "UsedSE" , "TargetSE" ],
407
+ selectDict ,
408
+ older = toDate ,
409
+ newer = fromDate ,
420
410
)
421
- distinctSelections = zip (selectColumns , [])
422
- if res ["OK" ]:
423
- distinctSelections = res ["Value" ]
424
- resultDict ["Selections" ] = distinctSelections
411
+ if not res ["OK" ]:
412
+ return res
413
+ resultDict ["Selections" ] = res ["Value" ]
425
414
426
415
return S_OK (resultDict )
427
416
0 commit comments