@@ -262,6 +262,30 @@ def active_sessions_count(self):
262
262
263
263
active_sessions_count .short_description = "Active"
264
264
265
+ def all_sessions (self ):
266
+ """Returns the set of all workshop sessions across all workshop
267
+ environments. This includes any reserved workshop sessions that have
268
+ not as yet been allocated to a user, workshop sessions which are
269
+ currently being shutdown, as well as stopped workshop sessions that
270
+ haven't been purged.
271
+
272
+ """
273
+
274
+ return Session .objects .filter (environment__portal = self )
275
+
276
+ def all_sessions_count (self ):
277
+ """Returns the count of all workshop sessions across all workshop
278
+ environments. This includes any reserved workshop sessions that have
279
+ not as yet been allocated to a user, workshop sessions which are
280
+ currently being shutdown, as well as stopped workshop sessions that
281
+ haven't been purged.
282
+
283
+ """
284
+
285
+ return self .total_sessions ().count ()
286
+
287
+ all_sessions_count .short_description = "Total"
288
+
265
289
def capacity_available (self ):
266
290
"""Returns whether there is capacity to have another workshop session.
267
291
This will always return True if no sessions maximum was specified for
@@ -499,6 +523,28 @@ def active_sessions_count(self):
499
523
500
524
active_sessions_count .short_description = "Active"
501
525
526
+ def all_sessions (self ):
527
+ """Returns the set of all workshop sessions. This includes any
528
+ reserved workshop sessions that have not as yet been allocated to a
529
+ user, workshop sessions which are currently being shutdown, as well as
530
+ stopped workshop sessions that haven't been purged.
531
+
532
+ """
533
+
534
+ return self .session_set .all ()
535
+
536
+ def all_sessions_count (self ):
537
+ """Returns the count of all workshop sessions. This includes any
538
+ reserved workshop sessions that have not as yet been allocated to a
539
+ user,workshop sessions which are currently being shutdown, as well as
540
+ stopped workshop sessions that haven't been purged.
541
+
542
+ """
543
+
544
+ return self .all_sessions ().count ()
545
+
546
+ all_sessions_count .short_description = "Total"
547
+
502
548
def allocated_session_for_user (self , user ):
503
549
"""Returns any allocated workshop session for the defined user. There
504
550
should only be at most one, so only need to return the first if one
0 commit comments