8 |
|
|
9 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
10 |
|
|
11 |
|
template '/' => page { |
12 |
|
|
13 |
|
h1 { _('Statistics') } |
14 |
|
|
15 |
|
my $orgs = A3C::Model::OrganizationCollection->new; |
16 |
|
$orgs->unlimit; |
17 |
|
|
18 |
|
dt { _('Number of schools in system') } |
19 |
|
dd { $orgs->count } |
20 |
|
|
21 |
|
my $people = A3C::Model::PersonCollection->new; |
22 |
|
$people->unlimit; |
23 |
|
|
24 |
|
dt { _('Number of persons in system') } |
25 |
|
dd { $people->count } |
26 |
|
|
27 |
|
=for later |
28 |
|
|
29 |
|
dt { _('Breakdown by towns') } |
30 |
|
dd { |
31 |
|
$orgs->redo_search; |
32 |
|
# select count(l),l from organizations group by l order by count desc limit 25 |
33 |
|
$orgs->group_by( column => 'l' ); |
34 |
|
$orgs->order_by( column => 'l', order => 'desc' ); |
35 |
|
|
36 |
|
warn "## SQL: ", $orgs->build_select_query; |
37 |
|
my $count = $orgs->column( column => 'l', function => 'count(l)' ); |
38 |
|
warn "## count: $count\n"; |
39 |
|
# $orgs->column( column => 'l' ); |
40 |
|
warn "## SQL: ", $orgs->build_select_query; |
41 |
|
|
42 |
|
ul { |
43 |
|
for ( 1 .. 1 ) { |
44 |
|
my $o = $orgs->next; |
45 |
|
warn "## ",dump( $o ); |
46 |
|
li { outs ( $o->l, '|', $o->__value('l'), $o->__value( $count ) ) } |
47 |
|
} |
48 |
|
} |
49 |
|
|
50 |
|
|
51 |
|
} |
52 |
|
|
53 |
|
=cut |
54 |
|
|
55 |
|
}; |
56 |
|
|
57 |
|
|
58 |
template 'ldap' => page { |
template 'ldap' => page { |
59 |
h1 { _('LDAP data about Schools in system') }; |
h1 { _('LDAP data about Schools in system') }; |