lib/Bb/Collaborate/Ultra/Session/Log.pm

filter: Statementstmt 76.9% 20 / 26 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 71.4% 5 / 7 Podpod 100% 1 / 1 totaltotal 66.6% 26 / 39 CC 2 SCAR 8.6
CC
2
Cov
69%
attendees
6.0
__ANON__
2.0
BEGIN
1.0
CRAP 2.4
« lib/Bb/Collaborate/Ultra/Session.pm ↑ Summary lib/Bb/Collaborate/Ultra/Session/Log/Attendee.pm »
1 package Bb::Collaborate::Ultra::Session::Log;
2 1 ▶use warnings; use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 extends 'Bb::Collaborate::Ultra::DAO';
6 1 ▶use Mouse::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 Bb::Collaborate::Ultra::Session::Log
11  
12 =head1 DESCRIPTION
13  
14 Session logging class.
15  
16 =head1 EXAMPLE
17  
18 my @sessions = Bb::Collaborate::Ultra::Session->get($connection, {contextId => $context_id});
19 for my $session (@sessions) {
20 print "Session: ". $session->name . "\n";
21 my @logs = $session->logs;
22  
23 for my $log (@logs) {
24 say "\tOpened: " .(scalar localtime $log->opened);
25 for my $attendee ($log->attendees) {
26 my $first_join;
27 my $elapsed = 0;
28 for my $attendance (@{$attendee->attendance}) {
29 my $joined = $attendance->joined;
30 $first_join = $joined
31 if !$first_join || $first_join > $joined;
32 $elapsed += $attendance->left - $joined;
33 }
34 say sprintf("\tUser %s (%s) joined at %s, stayed %d minutes", $attendee->externalUserId, $attendee->displayName, (scalar localtime $first_join), $elapsed / 60);
35 }
36 say "\tClosed: " .(scalar localtime $log->closed);
37 }
38 }
39  
40 =head1 METHODS
41  
42 This class supports the `get` method as described in L<https://xx-csa.bbcollab.com/documentation#Attendee-collection>.
43  
44 =cut
45
46 coerce __PACKAGE__, from 'HashRef' => via {
47 0 ▶ __PACKAGE__->new( $_ )
Subroutine __ANON__: not called CC=1 SCAR=6.9
48 1 };
49
50 1 __PACKAGE__->resource('instances');
51 1 __PACKAGE__->load_schema(<DATA>);
52  
53 =head2 attendees
54  
55 Logs individual attendances for this session.
56  
57 =cut
58  
59 sub attendees {
60 0 ▶ my $self = shift;
Subroutine attendees: not called CC=2 SCAR=17.9
Pod documented
61 0 ▶ my $connection = shift || $self->connection;
Condition0%0/3
shift() || $self->connection
l!l&&r!l&&!r
000
MC/DC0%0/2
shift() || $self->connection
shift() $self->connection
Truth table0%0/3
A || B
A= shift()B= $self->connection
ABresult
1X1
011
000
62 0 my $path = $self->path.'/attendees';
63 0 require Bb::Collaborate::Ultra::Session::Log::Attendee;
64 0 Bb::Collaborate::Ultra::Session::Log::Attendee->get($connection => {}, path => $path, parent => $self);
65 }
66  
67 # **NOT DOCUMENTED** in https://xx-csa.bbcollab.com/documentation
68 # schema has been reversed engineered
69 1 1;
70 __DATA__
« lib/Bb/Collaborate/Ultra/Session.pm ↑ Summary lib/Bb/Collaborate/Ultra/Session/Log/Attendee.pm »