From fdc7725ed11cc9e380a57718438a09aa078aa958 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 7 Aug 2015 10:09:33 +0100 Subject: [PATCH 01/62] Added many-to-many relationships for allowed_course_years. --- Kinza/lib/Kinza/Schema/Result/Course.pm | 6 ++++++ Kinza/lib/Kinza/Schema/Result/Year.pm | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/Kinza/lib/Kinza/Schema/Result/Course.pm b/Kinza/lib/Kinza/Schema/Result/Course.pm index 53916b0..ccb8ced 100644 --- a/Kinza/lib/Kinza/Schema/Result/Course.pm +++ b/Kinza/lib/Kinza/Schema/Result/Course.pm @@ -152,6 +152,12 @@ __PACKAGE__->has_many( # Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-08-06 21:20:39 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OZOk6Ub4lvYIpB6HmsKX+w +__PACKAGE__->many_to_many( + 'allowed_years', + 'allowed_course_years', + 'year', +); + sub in_term { my $self = shift; my ($term_id) = @_; diff --git a/Kinza/lib/Kinza/Schema/Result/Year.pm b/Kinza/lib/Kinza/Schema/Result/Year.pm index 4a7e8d6..5825af6 100644 --- a/Kinza/lib/Kinza/Schema/Result/Year.pm +++ b/Kinza/lib/Kinza/Schema/Result/Year.pm @@ -109,6 +109,11 @@ __PACKAGE__->has_many( # Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-08-06 20:26:43 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Voy/j4F8FWlKmxxjtu7vwg +__PACKAGE__->many_to_many( + 'allowed_courses', + 'allowed_course_years', + 'course', +); # You can replace this text with custom code or comments, and it will be preserved on regeneration __PACKAGE__->meta->make_immutable; From 161a53b72f825c6d5c934fd3979b6b9af38dced5 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 7 Aug 2015 10:15:43 +0100 Subject: [PATCH 02/62] Added some more many-to-many relationships. --- Kinza/lib/Kinza/Schema/Result/Course.pm | 6 ++++++ Kinza/lib/Kinza/Schema/Result/Presentation.pm | 6 ++++++ Kinza/lib/Kinza/Schema/Result/Student.pm | 6 ++++++ Kinza/lib/Kinza/Schema/Result/Term.pm | 5 +++++ 4 files changed, 23 insertions(+) diff --git a/Kinza/lib/Kinza/Schema/Result/Course.pm b/Kinza/lib/Kinza/Schema/Result/Course.pm index ccb8ced..6c9dd9a 100644 --- a/Kinza/lib/Kinza/Schema/Result/Course.pm +++ b/Kinza/lib/Kinza/Schema/Result/Course.pm @@ -158,6 +158,12 @@ __PACKAGE__->many_to_many( 'year', ); +__PACKAGE__->many_to_many( + 'terms', + 'presentation', + 'term', +); + sub in_term { my $self = shift; my ($term_id) = @_; diff --git a/Kinza/lib/Kinza/Schema/Result/Presentation.pm b/Kinza/lib/Kinza/Schema/Result/Presentation.pm index 2627204..d354c1a 100644 --- a/Kinza/lib/Kinza/Schema/Result/Presentation.pm +++ b/Kinza/lib/Kinza/Schema/Result/Presentation.pm @@ -140,6 +140,12 @@ __PACKAGE__->belongs_to( # Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-08-06 21:20:39 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YTuKcLoRM8o+QdjfN8Lqmw +__PACKAGE__->many_to_many( + 'students', + 'attendance', + 'student', +); + sub spaces { my $self = shift; diff --git a/Kinza/lib/Kinza/Schema/Result/Student.pm b/Kinza/lib/Kinza/Schema/Result/Student.pm index 0a87019..5d937c7 100644 --- a/Kinza/lib/Kinza/Schema/Result/Student.pm +++ b/Kinza/lib/Kinza/Schema/Result/Student.pm @@ -161,6 +161,12 @@ __PACKAGE__->has_many( # Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-09-08 21:57:00 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WItYpQSEGRBD4mS7LjkZWQ +__PACKAGE__->many_to_many( + 'presentations' + 'attendences', + 'presentation', +); + sub sorted_attendances { my $self = shift; diff --git a/Kinza/lib/Kinza/Schema/Result/Term.pm b/Kinza/lib/Kinza/Schema/Result/Term.pm index a8912c2..465701d 100644 --- a/Kinza/lib/Kinza/Schema/Result/Term.pm +++ b/Kinza/lib/Kinza/Schema/Result/Term.pm @@ -109,6 +109,11 @@ __PACKAGE__->has_many( # Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-08-06 20:23:53 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vJSudtGulTNaHbywDmTwTg +__PACKAGE__->many_to_many( + 'courses', + 'presentations', + 'course', +); # You can replace this text with custom code or comments, and it will be preserved on regeneration __PACKAGE__->meta->make_immutable; From e470cf13fe116848c8ed1a4bbecc9b38464c6d0e Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 7 Aug 2015 11:58:39 +0100 Subject: [PATCH 03/62] Fix typo --- Kinza/lib/Kinza/Schema/Result/Student.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kinza/lib/Kinza/Schema/Result/Student.pm b/Kinza/lib/Kinza/Schema/Result/Student.pm index 5d937c7..0220618 100644 --- a/Kinza/lib/Kinza/Schema/Result/Student.pm +++ b/Kinza/lib/Kinza/Schema/Result/Student.pm @@ -162,7 +162,7 @@ __PACKAGE__->has_many( # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WItYpQSEGRBD4mS7LjkZWQ __PACKAGE__->many_to_many( - 'presentations' + 'presentations', 'attendences', 'presentation', ); From 50dacaa08bb7ff55d057c75bd2f73842d13b8350 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 7 Aug 2015 12:19:59 +0100 Subject: [PATCH 04/62] Only show students courses that their year can sign up for. --- Kinza/lib/Kinza/Schema/Result/Student.pm | 5 +++++ Kinza/views/index.tt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Kinza/lib/Kinza/Schema/Result/Student.pm b/Kinza/lib/Kinza/Schema/Result/Student.pm index 0220618..bcd2624 100644 --- a/Kinza/lib/Kinza/Schema/Result/Student.pm +++ b/Kinza/lib/Kinza/Schema/Result/Student.pm @@ -188,6 +188,11 @@ sub locked { return $self->attendances->count; } +sub allowed_courses { + my $self = shift; + + return $self->form->year->allowed_courses; +} # You can replace this text with custom code or comments, and it will be preserved on regeneration __PACKAGE__->meta->make_immutable; diff --git a/Kinza/views/index.tt b/Kinza/views/index.tt index a7dcf92..80103eb 100644 --- a/Kinza/views/index.tt +++ b/Kinza/views/index.tt @@ -32,7 +32,7 @@ T[% t.seq %] [% END -%] -[% FOREACH c IN courses -%] +[% FOREACH c IN student.allowed_courses -%] [% c.title %][% IF c.description %]
[% c.description %][% END %] [% SET total_terms = terms.size; From 6a9cb35d4beaf60b8c44dabb3402d967639c6dfa Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 7 Aug 2015 12:26:17 +0100 Subject: [PATCH 05/62] Use new many-to-many relationships when loading courses --- Kinza/lib/Kinza/Schema/Result/Course.pm | 2 +- util/load_courses | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Kinza/lib/Kinza/Schema/Result/Course.pm b/Kinza/lib/Kinza/Schema/Result/Course.pm index 6c9dd9a..8a1a5e3 100644 --- a/Kinza/lib/Kinza/Schema/Result/Course.pm +++ b/Kinza/lib/Kinza/Schema/Result/Course.pm @@ -160,7 +160,7 @@ __PACKAGE__->many_to_many( __PACKAGE__->many_to_many( 'terms', - 'presentation', + 'presentations', 'term', ); diff --git a/util/load_courses b/util/load_courses index 72f9ea9..ba140ba 100755 --- a/util/load_courses +++ b/util/load_courses @@ -55,16 +55,14 @@ foreach (@courses) { if (length $t > 1) { ($t, $number) = split //, $t; } - $crs->add_to_presentations({ - term_id => $term{$t}->id, - number_of_terms => $number, - }); + $crs->add_to_terms( + $term{$t}, + { number_of_terms => $number }, + ); } foreach my $y (@{$_->{ages}}) { next unless $year{$y}; - $crs->add_to_allowed_course_years({ - year_id => $year{$y}->id, - }) + $crs->add_to_allowed_years( $year{$y} ) } -} \ No newline at end of file +} From 315c4d53e2b5ceb32b6952a77082e7be21a80445 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 14:15:24 +0100 Subject: [PATCH 06/62] Allow people to see the closed page when we are closed! --- Kinza/lib/Kinza.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index f7efc7c..c521980 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -27,7 +27,7 @@ my $live = '2015-09-04T12:45'; my %private = map { $_ => 1 } qw[/submit]; hook before => sub { - if ($now lt $live) { + if (request->path_info ne '/closed' and $now lt $live) { forward '/closed'; } if ($private{request->path_info} and ! session('user')) { From 2caafc35086c39abdf5aecd9451106a43beb352e Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 14:40:55 +0100 Subject: [PATCH 07/62] Cleaner closed handling (again) --- Kinza/lib/Kinza.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index c521980..a42c6b0 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -22,12 +22,13 @@ my $pres_rs = schema()->resultset('Presentation'); my $pass_rs = schema()->resultset('PasswordReset'); my $now = DateTime->now(time_zone => 'Europe/London'); -my $live = '2015-09-04T12:45'; +my $live = '2015-08-04T12:45'; my %private = map { $_ => 1 } qw[/submit]; +my %open = map { $_ => 1 } qw[/closed]; hook before => sub { - if (request->path_info ne '/closed' and $now lt $live) { + if ($open{request->path_info} and $now lt $live) { forward '/closed'; } if ($private{request->path_info} and ! session('user')) { From 28d47cc05b5700519b6f34d8e6a694f13a27cccc Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 15:00:35 +0100 Subject: [PATCH 08/62] Add .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..449ffa7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +db_schema/kinza.dump From 53d9051779fcfabf15a6d7e6ccd5434b62a140b8 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 15:04:38 +0100 Subject: [PATCH 09/62] Use full names for terms --- Kinza/views/index.tt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Kinza/views/index.tt b/Kinza/views/index.tt index 80103eb..75500c8 100644 --- a/Kinza/views/index.tt +++ b/Kinza/views/index.tt @@ -25,11 +25,11 @@

Here are your options:

- +
- + [% FOREACH t IN terms -%] - + [% END -%] [% FOREACH c IN student.allowed_courses -%] From 4af29c3686857f8d017b3001735cacb66a04a813 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 18:08:35 +0100 Subject: [PATCH 10/62] Fix weirdness over courses that take more than one term. --- Kinza/views/index.tt | 13 ++++++++----- Kinza/views/layouts/main.tt | 5 +++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Kinza/views/index.tt b/Kinza/views/index.tt index 75500c8..790822f 100644 --- a/Kinza/views/index.tt +++ b/Kinza/views/index.tt @@ -36,12 +36,15 @@ [% SET total_terms = terms.size; + SET skip_terms = 0; FOREACH t IN terms; - SET p = c.in_term(t.id); - SET count_of_terms = 0 -%] - -[% SET count_of_terms = count_of_terms + p.number_of_terms; - LAST IF count_of_terms >= total_terms; + IF ! skip_terms; THEN; + SET p = c.in_term(t.id) -%] + +[% SET skip_terms = p.number_of_terms - 1 IF p; + ELSE; + SET skip_terms = skip_terms - 1; + END; END -%] [% END -%] diff --git a/Kinza/views/layouts/main.tt b/Kinza/views/layouts/main.tt index 61a99ae..d113709 100644 --- a/Kinza/views/layouts/main.tt +++ b/Kinza/views/layouts/main.tt @@ -8,6 +8,11 @@ + From 52b3e52b7fc2b8f59fd1800a297bc250d11d4891 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 18:25:34 +0100 Subject: [PATCH 11/62] Split display logic (in order to make it a little simpler to follow) --- Kinza/views/index.tt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Kinza/views/index.tt b/Kinza/views/index.tt index 790822f..06000ac 100644 --- a/Kinza/views/index.tt +++ b/Kinza/views/index.tt @@ -39,9 +39,13 @@ SET skip_terms = 0; FOREACH t IN terms; IF ! skip_terms; THEN; - SET p = c.in_term(t.id) -%] - -[% SET skip_terms = p.number_of_terms - 1 IF p; + SET p = c.in_term(t.id); + IF p; THEN -%] + +[% SET skip_terms = p.number_of_terms - 1; + ELSE -%] + +[% END; ELSE; SET skip_terms = skip_terms - 1; END; From 2daccec8c4c4c1426fdd431f87a39fe0bbefb868 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 18:38:05 +0100 Subject: [PATCH 12/62] Give the radio buttons classes generated from the course and term ids. --- Kinza/views/index.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kinza/views/index.tt b/Kinza/views/index.tt index 06000ac..a60e4e7 100644 --- a/Kinza/views/index.tt +++ b/Kinza/views/index.tt @@ -41,7 +41,7 @@ IF ! skip_terms; THEN; SET p = c.in_term(t.id); IF p; THEN -%] - + [% SET skip_terms = p.number_of_terms - 1; ELSE -%] From 0f82690a6cf6c3cbc9dc4fd245ce4b7124d4fcdd Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 19:12:32 +0100 Subject: [PATCH 13/62] Added some incredibly clever jQuery. --- Kinza/public/javascripts/kinza.js | 7 +++++++ Kinza/views/layouts/main.tt | 1 + 2 files changed, 8 insertions(+) create mode 100644 Kinza/public/javascripts/kinza.js diff --git a/Kinza/public/javascripts/kinza.js b/Kinza/public/javascripts/kinza.js new file mode 100644 index 0000000..b01da02 --- /dev/null +++ b/Kinza/public/javascripts/kinza.js @@ -0,0 +1,7 @@ +$("input:radio").on('click', function(){ + var classList = $(this).attr('class').split(/\s+/); + $.each( classList, function(index, item){ + $("input:radio." + item).prop('checked', false); + }); + $(this).prop('checked', true); +}); diff --git a/Kinza/views/layouts/main.tt b/Kinza/views/layouts/main.tt index d113709..b8064e6 100644 --- a/Kinza/views/layouts/main.tt +++ b/Kinza/views/layouts/main.tt @@ -57,6 +57,7 @@ + From 8434569950817c69247a93dea90689481c414714 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 19:26:54 +0100 Subject: [PATCH 14/62] Tidier handling of all those resultsets --- Kinza/lib/Kinza.pm | 48 ++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index a42c6b0..265f33c 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -15,11 +15,9 @@ my $cfg = config->{plugins}; $cfg->{DBIC}{default}{user} = $ENV{KZ_USER}; $cfg->{DBIC}{default}{password} = $ENV{KZ_PASS}; -my $student_rs = schema()->resultset('Student'); -my $term_rs = schema()->resultset('Term'); -my $course_rs = schema()->resultset('Course'); -my $pres_rs = schema()->resultset('Presentation'); -my $pass_rs = schema()->resultset('PasswordReset'); +my %rs = map { + $_ => schema()->resultset($_) +} qw[Student Term Course Presentation PasswordReset]; my $now = DateTime->now(time_zone => 'Europe/London'); my $live = '2015-08-04T12:45'; @@ -54,7 +52,7 @@ get '/' => sub { my $student; if (session('email')) { - $student = $student_rs->find({ + $student = $rs{Student}->find({ email => session('email'), }); } @@ -67,8 +65,8 @@ get '/' => sub { error => $error, choices => $choices, student => $student, - courses => [ $course_rs->all ], - terms => [ $term_rs->all ], + courses => [ $rs{Course}->all ], + terms => [ $rs{Term}->all ], }; }; @@ -84,15 +82,15 @@ post '/save' => sub { my %courses; my @unavailable; foreach (keys %params) { - my $pres = $pres_rs->find({ id => $params{$_} }); + my $pres = $rs{Presentation}->find({ id => $params{$_} }); $terms += $pres->number_of_terms; $courses{$pres->course->id} = 1; push @unavailable, $pres->course->title . ' (' . $pres->term->name . ')' if $pres->full; } - if ($terms != $term_rs->count) { - session 'error' => 'You must register for four terms of courses'; + if ($terms != $rs{Term}->count) { + session 'error' => 'You must register for three terms of courses'; return redirect '/'; } @@ -108,7 +106,7 @@ post '/save' => sub { } # Save the data - my $student = $student_rs->find({ + my $student = $rs{Student}->find({ email => session('email'), }); @@ -151,7 +149,7 @@ EO_EMAIL }; get '/dummies' => sub { - my @students = $student_rs->search({ + my @students = $rs{Student}->search({ verify => { '!=' => undef }, }); @@ -167,7 +165,7 @@ get '/reports/form' => sub { header 'Content-Disposition' => 'attachment; filename="form.csv"'; my $csv; - my $terms = join ',', map { $_->name } $term_rs->all; + my $terms = join ',', map { $_->name } $rs{Term}->all; foreach my $y (schema->resultset('Year')->search({}, { order_by => 'id', @@ -198,7 +196,7 @@ get '/reports/course' => sub { my $csv; - foreach my $p ($pres_rs->search({}, { order_by => 'id' })) { + foreach my $p ($rs{Presentation}->search({}, { order_by => 'id' })) { $csv .= '"' . $p->course->title . '/' . $p->term->name . qq["\n]; foreach my $a ($p->attendances) { $csv .= $a->student->name. "\n"; @@ -213,10 +211,10 @@ get '/reports/numbers' => sub { content_type 'text/csv'; header 'Content-Disposition' => 'attachment; filename="numbers.csv"'; - my $csv = "Course,T1,T2,T3,T4\n"; - my @terms = $term_rs->all; + my $csv = 'Course,' . join(',', map { $_->name} $rs{Term}->all) . "\n"; + my @terms = $rs{Term}->all; - foreach my $c ($course_rs->search({}, { order_by => 'title' })) { + foreach my $c ($rs{Course}->search({}, { order_by => 'title' })) { $csv .= '"' . $c->title . '"'; foreach my $t (@terms) { if (my $p = $t->presentations->find({ course_id => $c->id })) { @@ -251,7 +249,7 @@ post '/register' => sub { return redirect '/register'; } - if (my $user = $student_rs->find({ + if (my $user = $rs{Student}->find({ email => param('email'), })) { session 'error' => 'Email ' . $user->email . @@ -263,7 +261,7 @@ post '/register' => sub { length => 32, charset => [ 'a' .. 'z', '0' .. '9' ], }); - my $user = $student_rs->create({ + my $user = $rs{Student}->create({ name => param('name'), email => param('email'), password => passphrase(param('password'))->generate->rfc2307, @@ -279,7 +277,7 @@ post '/register' => sub { get '/verify/:code' => sub { my $code = param('code'); - my $student = $student_rs->find({ + my $student = $rs{Student}->find({ verify => $code, }); @@ -295,7 +293,7 @@ get '/verify/:code' => sub { }; get '/resend' => sub { - my $student = $student_rs->find({ + my $student = $rs{Student}->find({ email => session('email'), }); @@ -307,7 +305,7 @@ get '/resend' => sub { }; post '/resend' => sub { - my $student = $student_rs->find({ + my $student = $rs{Student}->find({ email => session('email'), }); @@ -342,7 +340,7 @@ post '/login' => sub { return redirect '/login'; } - my $user = $student_rs->find({ + my $user = $rs{Student}->find({ email => params->{email}, }); unless ($user) { @@ -384,7 +382,7 @@ post '/password' => sub { return redirect '/password'; } my $email = params->{email}; - my $student = $student_rs->find({ + my $student = $rs{Student}->find({ email => $email, }); unless ($student) { From 6b86c8252bd0b673adf7381e5020877b0c3e82ad Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 19:27:56 +0100 Subject: [PATCH 15/62] Avoid querying the term table twice. --- Kinza/lib/Kinza.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 265f33c..63308f6 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -211,8 +211,8 @@ get '/reports/numbers' => sub { content_type 'text/csv'; header 'Content-Disposition' => 'attachment; filename="numbers.csv"'; - my $csv = 'Course,' . join(',', map { $_->name} $rs{Term}->all) . "\n"; my @terms = $rs{Term}->all; + my $csv = 'Course,' . join(',', map { $_->name} @terms) . "\n"; foreach my $c ($rs{Course}->search({}, { order_by => 'title' })) { $csv .= '"' . $c->title . '"'; From 48fbefd21f16d6e861d7e915cca3576e6e39e2dc Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 19:28:55 +0100 Subject: [PATCH 16/62] It might not always be five terms --- Kinza/lib/Kinza.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 63308f6..df3ad9b 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -75,7 +75,7 @@ post '/save' => sub { session 'choices' => { reverse %params }; - # Check that student has signed up for five terms + # Check that student has signed up for all terms # And that all their courses are different # And that all courses are still available my $terms = 0; From 0838cb59c52caf19ca910d6a26dd9e53989fe6d3 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 20:34:56 +0100 Subject: [PATCH 17/62] Ignore the dump file no matter where it is. --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 449ffa7..9c5324f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -db_schema/kinza.dump +kinza.dump +*/kinza.dump From 8fbbd2df2cfdb0f48f14abd988f27d252ca8ca47 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 8 Aug 2015 20:57:59 +0100 Subject: [PATCH 18/62] Show logged-in users form in navbar and year on selection page. --- Kinza/views/index.tt | 2 +- Kinza/views/layouts/main.tt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Kinza/views/index.tt b/Kinza/views/index.tt index a60e4e7..0a910d7 100644 --- a/Kinza/views/index.tt +++ b/Kinza/views/index.tt @@ -22,7 +22,7 @@ [% END -%] [% ELSE -%] -

Here are your options:

+

Here are the options available to [% student.form.year.name %]:

CourseCourseT[% t.seq %][% t.name %]
[% c.title %][% IF c.description %]
[% c.description %][% END %]
[% IF p; THEN %][% ELSE %] [% END %] 1; THEN %] colspan=[% p.number_of_terms; END %] title="[% t.name %]">[% IF p; THEN %][% ELSE %] [% END %]
1; THEN %] colspan=[% p.number_of_terms; END %] title="[% t.name %]">[% IF p; THEN %][% ELSE %] [% END %] 1; THEN %] colspan=[% p.number_of_terms; END %] title="[% t.name %]">  1; THEN %] colspan=[% p.number_of_terms; END %] title="[% t.name %]"> 1; THEN %] colspan=[% p.number_of_terms; END %] title="[% t.name %]"> 
diff --git a/Kinza/views/layouts/main.tt b/Kinza/views/layouts/main.tt index b8064e6..95ac2ce 100644 --- a/Kinza/views/layouts/main.tt +++ b/Kinza/views/layouts/main.tt @@ -33,7 +33,7 @@ [% END -%] -
- +
- +
- +
- +
- +
-
+
From d63fdb64a451e4d08991f1c791b8c8d5630e5ea2 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 10 Aug 2015 14:42:50 +0100 Subject: [PATCH 22/62] Added a missing course --- db_schema/courses.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/db_schema/courses.txt b/db_schema/courses.txt index 8d5ae74..5c40a50 100644 --- a/db_schema/courses.txt +++ b/db_schema/courses.txt @@ -149,6 +149,11 @@ M,L U5,L6,U6 Max 12 +Stencil and Spray Paint +All terms +All ages, +Max 12 + Table Tennis All terms All ages From 3a6b20999e769233a318174178e6768ee1ec7fbe Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Wed, 12 Aug 2015 21:24:43 +0100 Subject: [PATCH 23/62] Get more stuff from environment variables. Fixed closed stuff (again!) --- Kinza/lib/Kinza.pm | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index bd76294..1c44ac4 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -5,6 +5,7 @@ use Dancer2::Plugin::DBIC; use Dancer2::Plugin::Email; use Dancer2::Plugin::Passphrase; use DateTime; +use DateTime::Format::Strptime; use Kinza::Reports; @@ -12,8 +13,12 @@ our $VERSION = '0.1'; prefix undef; -$ENV{KZ_USER} && $ENV{KZ_PASS} - or die 'Must set KZ_USER and KZ_PASS'; +my @envs = qw[ KZ_USER KZ_PASS KZ_HOST KZ_DOMAIN KZ_OPEN ]; + +if (my @missing = grep { ! defined $ENV{$_} } @envs) { + die 'You must set ', join(', ', @missing[0 .. $#missing - 1]), + (@missing > 1 ? ' and ' : ''), $missing[-1]; +} my $cfg = config->{plugins}; $cfg->{DBIC}{default}{user} = $ENV{KZ_USER}; @@ -23,14 +28,19 @@ my %rs = map { $_ => schema()->resultset($_) } qw[Student Term Course Presentation PasswordReset]; +my $dt_p = DateTime::Format::Strptime->new( + pattern => '%Y-%m-%dT%H:%M', + time_zone => 'Europe/London', + on_error => 'croak', +); my $now = DateTime->now(time_zone => 'Europe/London'); -my $live = '2015-08-04T12:45'; +my $live = $dt_p->parse_datetime($ENV{KZ_OPEN}); my %private = map { $_ => 1 } qw[/submit]; my %open = map { $_ => 1 } qw[/closed]; hook before => sub { - if ($open{request->path_info} and $now lt $live) { + if (! $open{request->path_info} and $now < $live) { forward '/closed'; } if ($private{request->path_info} and ! session('user')) { @@ -41,7 +51,8 @@ hook before => sub { hook before_template => sub { my $params = shift; - $params->{email} = session('email'); + $params->{email} = session('email'); + $params->{domain} = $ENV{KZ_DOMAIN}; }; get '/closed' => sub { @@ -183,11 +194,8 @@ post '/register' => sub { return redirect '/register'; } - warn "EMAIL: '$email'"; - - if ($email !~ /\@schs\.gdst\.net$/) { - warn "REGEX FAIL " . ($email !~ /\@schs\.gdst\.net$/); - session 'error' => "You must use your \@schs.gdst.net email address"; + if ($email !~ /\@\Q$ENV{KZ_DOMAIN}/) { + session 'error' => "You must use your \@$ENV{KZ_DOMAIN} email address"; return redirect '/register'; } From d46bffbdb2ad68c5141b81a046a0e1f0910d25d7 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Thu, 13 Aug 2015 09:56:28 +0100 Subject: [PATCH 24/62] Add the opening time to the closed screen --- Kinza/lib/Kinza.pm | 1 + Kinza/views/comingsoon.tt | 1 + 2 files changed, 2 insertions(+) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 1c44ac4..2ac787e 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -53,6 +53,7 @@ hook before_template => sub { my $params = shift; $params->{email} = session('email'); $params->{domain} = $ENV{KZ_DOMAIN}; + $params->{live} = $live; }; get '/closed' => sub { diff --git a/Kinza/views/comingsoon.tt b/Kinza/views/comingsoon.tt index be984fe..ef664e0 100644 --- a/Kinza/views/comingsoon.tt +++ b/Kinza/views/comingsoon.tt @@ -1,2 +1,3 @@

SCHS Kinza 2015/16

Please come back later to register.

+

We open on [% live.strftime('%A %d $B %Y, at %H:%M') %].

From fa3e8b5101b9d26385a6433b9191ed191c8f6680 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Thu, 13 Aug 2015 09:57:26 +0100 Subject: [PATCH 25/62] Fix typo --- Kinza/views/comingsoon.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kinza/views/comingsoon.tt b/Kinza/views/comingsoon.tt index ef664e0..472d79d 100644 --- a/Kinza/views/comingsoon.tt +++ b/Kinza/views/comingsoon.tt @@ -1,3 +1,3 @@

SCHS Kinza 2015/16

Please come back later to register.

-

We open on [% live.strftime('%A %d $B %Y, at %H:%M') %].

+

We open on [% live.strftime('%A %d %B %Y, at %H:%M') %].

From 19492effc42f36f3aab35f4c4ab096665db529da Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 21 Aug 2015 20:34:04 +0100 Subject: [PATCH 26/62] Fix typo in name --- db_schema/forms.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db_schema/forms.csv b/db_schema/forms.csv index 9759486..607cdf2 100644 --- a/db_schema/forms.csv +++ b/db_schema/forms.csv @@ -55,7 +55,7 @@ L4K,26,Taylor,Cassia,TTAY15,St Andrews, L4K,27,Telling,Jessica,TTEL01,St Georges, L4K,28,Tokaya,Jasmine,TTOK01,St Andrews, L4K,29,Valle,Alicia,TVAL03,St Patricks, -L4S,1,Atakelt Wubneh,Leah,TATA02,St Georges,Leah Wubneah +L4S,1,Atakelt Wubneh,Leah,TATA02,St Georges,Leah Wubneh L4S,2,Auricchio,Catherine,TAUR01,St Andrews, L4S,3,Bexley,Ella,TBEX01,St Patricks, L4S,4,Bose,Lara,TBOS03,St Davids, From 518f10a174fef0d4a7c2cd0fe9f6e33a0d96703a Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 6 Sep 2015 12:30:17 +0100 Subject: [PATCH 27/62] Ignore *.tsv files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9c5324f..e4292b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ kinza.dump */kinza.dump +db_schema/*.tsv From 6933cc2bfe0f46308f9ae0cad4c6cb63900feee2 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 6 Sep 2015 12:31:48 +0100 Subject: [PATCH 28/62] Deleted tsv files from git --- db_schema/Course.tsv | 37 ---------- db_schema/Form.tsv | 24 ------- db_schema/Presentation.tsv | 138 ------------------------------------- db_schema/Year.tsv | 8 --- 4 files changed, 207 deletions(-) delete mode 100644 db_schema/Course.tsv delete mode 100644 db_schema/Form.tsv delete mode 100644 db_schema/Presentation.tsv delete mode 100644 db_schema/Year.tsv diff --git a/db_schema/Course.tsv b/db_schema/Course.tsv deleted file mode 100644 index 13fd695..0000000 --- a/db_schema/Course.tsv +++ /dev/null @@ -1,37 +0,0 @@ -title description teacher room capacity number_of_terms -Acting Audition only - see Mrs Evans Mrs. Teacher Room 101 -1 1 -Ancient Greek Mrs. Teacher Room 101 27 1 -Anthropology Mrs. Teacher Room 101 27 1 -Arabic Mrs. Teacher Room 101 27 1 -Basic Chinese (Mandarin) Mrs. Teacher Room 101 27 1 -Body Conditioning Mrs. Teacher Room 101 15 1 -Can’t Cook, Won’t Cook Mrs. Teacher Room 101 30 1 -Chess Mrs. Teacher Room 101 27 1 -Community Art Mrs. Teacher Room 101 12 1 -First Aid – saving lives Mrs. Teacher Room 101 27 1 -French Revolutions 1789-1870 Mrs. Teacher Room 101 27 1 -German Language and Culture Mrs. Teacher Room 101 27 5 -Going Green – Beekeeping Club Mrs. Teacher Room 101 27 1 -Golf Mrs. Teacher Room 101 20 1 -Historical Model Building Mrs. Teacher Room 101 12 1 -Iceland Pupils for Iceland trip, but other pupils welcome Mrs. Teacher Room 101 27 1 -Indoor Sports and Games Mrs. Teacher Room 101 26 1 -Italian Extravaganza Mrs. Teacher Room 101 27 1 -Loops, Riffs and Beats Mrs. Teacher Room 101 16 1 -Magazine Journalism Mrs. Teacher Room 101 27 1 -Make It Work Mrs. Teacher Room 101 10 1 -Media – Who? What? Why? Mrs. Teacher Room 101 27 1 -Meditation Mrs. Teacher Room 101 20 1 -Money Management Mrs. Teacher Room 101 27 1 -Origami Mrs. Teacher Room 101 27 1 -Programming and Web Design Mrs. Teacher Room 101 25 1 -Quilt Making Mrs. Teacher Room 101 26 1 -Science investigations and ‘myth busters’ Mrs. Teacher Room 101 27 1 -Spanish Language and Culture Mrs. Teacher Room 101 27 1 -Stage Combat (Introduction) Mrs. Teacher Room 101 14 1 -Stage Combat (Advanced) Mrs. Teacher Room 101 14 1 -Table Tennis Mrs. Teacher Room 101 16 1 -The Space Race Mrs. Teacher Room 101 27 1 -Trampolining for beginners Mrs. Teacher Room 101 16 1 -What the Papers Say Mrs. Teacher Room 101 27 1 -Wimborne House Voluntary Service Placement Sixth Form Only Mrs. Teacher Room 101 27 1 diff --git a/db_schema/Form.tsv b/db_schema/Form.tsv deleted file mode 100644 index a2aa843..0000000 --- a/db_schema/Form.tsv +++ /dev/null @@ -1,24 +0,0 @@ -name year_id -Upper 3F 1 -Upper 3K 1 -Upper 3S 1 -Lower 4F 2 -Lower 4K 2 -Lower 4S 2 -Upper 4F 3 -Upper 4K 3 -Upper 4S 3 -Lower 5F 4 -Lower 5K 4 -Lower 5S 4 -Upper 5F 5 -Upper 5K 5 -Upper 5S 5 -Lower 6P 6 -Lower 6Q 6 -Lower 6R 6 -Lower 6S 6 -Upper 6A 7 -Upper 6B 7 -Upper 6C 7 -Upper 6D 7 diff --git a/db_schema/Presentation.tsv b/db_schema/Presentation.tsv deleted file mode 100644 index 03c6fff..0000000 --- a/db_schema/Presentation.tsv +++ /dev/null @@ -1,138 +0,0 @@ -course_id term_id -1 1 -1 2 -1 3 -1 4 -2 1 -2 2 -2 3 -2 4 -3 1 -3 2 -3 3 -3 4 -4 1 -4 2 -4 3 -4 4 -5 1 -5 2 -5 3 -5 4 -6 3 -6 4 -7 1 -7 2 -7 3 -7 4 -8 1 -8 2 -8 3 -8 4 -9 1 -9 2 -9 3 -9 4 -10 1 -10 2 -10 3 -10 4 -11 1 -11 2 -11 3 -11 4 -12 1 -12 2 -12 3 -12 4 -13 1 -13 2 -13 3 -13 4 -14 1 -14 2 -14 3 -14 4 -15 1 -15 2 -15 3 -15 4 -16 1 -17 1 -17 2 -17 3 -17 4 -18 1 -18 2 -18 3 -18 4 -19 1 -19 2 -19 3 -19 4 -20 1 -20 2 -20 3 -20 4 -21 1 -21 2 -21 3 -21 4 -22 1 -22 2 -22 3 -22 4 -23 1 -23 2 -23 3 -23 4 -24 1 -24 2 -24 3 -24 4 -25 1 -25 2 -26 1 -26 2 -26 3 -26 4 -27 1 -27 2 -27 3 -27 4 -28 1 -28 2 -28 3 -28 4 -29 1 -29 2 -29 3 -29 4 -30 1 -30 2 -30 3 -30 4 -31 1 -31 2 -31 3 -31 4 -32 1 -32 2 -32 3 -32 4 -33 1 -33 2 -33 3 -33 4 -34 1 -34 2 -34 3 -34 4 -35 1 -35 2 -35 3 -35 4 -36 1 -36 2 -36 3 -36 4 diff --git a/db_schema/Year.tsv b/db_schema/Year.tsv deleted file mode 100644 index 98f5049..0000000 --- a/db_schema/Year.tsv +++ /dev/null @@ -1,8 +0,0 @@ -name -Upper 3 -Lower 4 -Upper 4 -Lower 5 -Upper 5 -Lower 6 -Upper 6 From 4ecf48efcfb2e201db880cb8b0938656f6820524 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 6 Sep 2015 12:53:13 +0100 Subject: [PATCH 29/62] Adde sequence to years --- Kinza/lib/Kinza/Schema/Result/Year.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Kinza/lib/Kinza/Schema/Result/Year.pm b/Kinza/lib/Kinza/Schema/Result/Year.pm index 5825af6..67975c1 100644 --- a/Kinza/lib/Kinza/Schema/Result/Year.pm +++ b/Kinza/lib/Kinza/Schema/Result/Year.pm @@ -52,6 +52,12 @@ __PACKAGE__->table("year"); is_nullable: 1 size: 255 +=head2 seq + + data_type: 'integer' + default_value: 0 + is_nullable: 0 + =cut __PACKAGE__->add_columns( @@ -59,6 +65,8 @@ __PACKAGE__->add_columns( { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "name", { data_type => "varchar", is_nullable => 1, size => 255 }, + "seq", + { data_type => "integer", default_value => 0, is_nullable => 0 }, ); =head1 PRIMARY KEY @@ -106,8 +114,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-08-06 20:26:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Voy/j4F8FWlKmxxjtu7vwg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-09-06 12:52:50 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cPiWh4/c7g5f4JaSmlGc6g __PACKAGE__->many_to_many( 'allowed_courses', From d10bb4a8906e5f4798caa66806b2bf951d761648 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 6 Sep 2015 15:03:17 +0100 Subject: [PATCH 30/62] Added /years report to show what is missing and who has registered, etc. --- Kinza/lib/Kinza.pm | 6 +++++- Kinza/views/years.tt | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 Kinza/views/years.tt diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 2ac787e..868ff0b 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -26,7 +26,7 @@ $cfg->{DBIC}{default}{password} = $ENV{KZ_PASS}; my %rs = map { $_ => schema()->resultset($_) -} qw[Student Term Course Presentation PasswordReset]; +} qw[Year Student Term Course Presentation PasswordReset]; my $dt_p = DateTime::Format::Strptime->new( pattern => '%Y-%m-%dT%H:%M', @@ -439,6 +439,10 @@ post '/passreset' => sub { template 'passdone'; }; +get '/years' => sub { + template 'years', { years => $rs{Year} }; +}; + sub send_verify { my ($student) = @_; diff --git a/Kinza/views/years.tt b/Kinza/views/years.tt new file mode 100644 index 0000000..cc56bdd --- /dev/null +++ b/Kinza/views/years.tt @@ -0,0 +1,23 @@ +[% MACRO ok(val) BLOCK; +IF val; + SET icon="glyphicon-ok"; +ELSE; + SET icon="glyphicon-remove"; +END; +''; +END -%] + +
+[% FOREACH year IN years.all.sort('seq') -%] + +[% FOREACH form IN year.forms.sort('name') -%] + + +[% FOREACH student IN form.students.sort('name') -%] + + + +[% END -%] +[% END -%] +[% END -%] +

[% year.name %]

[% form.name %]

NameEmailRegisteredSelected
[% student.name %][% student.email %][% ok(student.password) %][% ok(student.locked) %]
From be64f5930112978b90d82512713214218dfcf956 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 6 Sep 2015 15:07:15 +0100 Subject: [PATCH 31/62] Added year.seq to the definitive DDL. --- db_schema/kinza.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db_schema/kinza.sql b/db_schema/kinza.sql index 2780f9b..2756130 100644 --- a/db_schema/kinza.sql +++ b/db_schema/kinza.sql @@ -1,6 +1,7 @@ CREATE TABLE year ( id INTEGER PRIMARY KEY AUTO_INCREMENT, -name VARCHAR(255) +name VARCHAR(255), +seq INTEGER NOT NULL DEFAULT 0 ) ENGINE=InnoDB; CREATE TABLE form ( From 956eb5398d97fe290e53a02a4d0f3da0c74bd1be Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 6 Sep 2015 15:14:20 +0100 Subject: [PATCH 32/62] Allow people to see the reports pages before the site opens --- Kinza/lib/Kinza.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 868ff0b..ab8fde8 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -37,7 +37,7 @@ my $now = DateTime->now(time_zone => 'Europe/London'); my $live = $dt_p->parse_datetime($ENV{KZ_OPEN}); my %private = map { $_ => 1 } qw[/submit]; -my %open = map { $_ => 1 } qw[/closed]; +my %open = map { $_ => 1 } qw[/closed /years /reports]; hook before => sub { if (! $open{request->path_info} and $now < $live) { From 351c11edcd4ec2173e820fa9e4053586397c372e Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 8 Sep 2015 21:02:35 +0100 Subject: [PATCH 33/62] Remove csv file --- db_schema/forms.csv | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/db_schema/forms.csv b/db_schema/forms.csv index 607cdf2..7987a57 100644 --- a/db_schema/forms.csv +++ b/db_schema/forms.csv @@ -1,3 +1,41 @@ +L6A,1,,,,,Megan Aeron-Thomas,m.aeron-thomas@schs.gdst.net +L6A,2,,,,,Hannah Ali,h.ali@schs.gdst.net +L6A,3,,,,,Francesca Anthony,f.anthony@schs.gdst.net +L6A,4,,,,,Anna Bains,a.bains@schs.gdst.net +L6A,5,,,,,Kidist Beyene,k.beyene@schs.gdst.net +L6A,6,,,,,Marianne Bostock,m.bostock@schs.gdst.net +L6A,7,,,,,Charlotte Brand,l.brand@schs.gdst.net +L6A,8,,,,,Jiaying Chen,j.chen@schs.gdst.net +L6A,9,,,,,Charlotte Cole-Hossain,c.cole-hossain@schs.gdst.net +L6A,10,,,,,Kaylin Crossdale,k.crossdale@schs.gdst.net +L6B,1,,,,,Alexandra Downing,a.downing@schs.gdst.net +L6B,2,,,,,Louisa Duck,l.duck@schs.gdst.net +L6B,3,,,,,Martha Fox,m.fox@schs.gdst.net +L6B,4,,,,,Ginger Frame,g.frame@schs.gdst.net +L6B,5,,,,,Claudia Gilbert-Allen,c.gilbert-allen@schs.gdst.net +L6B,6,,,,,Ruby Gil-Rodriguez,r.gil-rodriguez@schs.gdst.net +L6B,7,,,,,Joanna Harland,j.harland@schs.gdst.net +L6B,8,,,,,Holly Jackson,h.jackson@schs.gdst.net +L6B,9,,,,,Gabrielle Jenkins,e.jenkins@schs.gdst.net +L6C,1,,,,,Alice Karslake,a.karslake@schs.gdst.net +L6C,2,,,,,Aysha Khan,a.khan@schs.gdst.net +L6C,3,,,,,Sofia Khan,s.khan3@schs.gdst.net +L6C,4,,,,,Madison Lee,m.lee2@schs.gdst.net +L6C,5,,,,,Kitty Lower,k.lower@schs.gdst.net +L6C,6,,,,,Elizabeth MacNamara,e.macnamara@schs.gdst.net +L6C,7,,,,,Imogen Marriott,i.marriott@schs.gdst.net +L6C,8,,,,,Elizabeth Parke,e.parke@schs.gdst.net +L6C,9,,,,,Nicole Samuels,n.samuels@schs.gdst.net +L6D,1,,,,,Olivia Setna,o.setna@schs.gdst.net +L6D,2,,,,,Alexa Seward,a.seward@schs.gdst.net +L6D,3,,,,,India Sheta,i.sheta@schs.gdst.net +L6D,4,,,,,Mei Silvio,m.silvio@schs.gdst.net +L6D,5,,,,,Georgia Stopford,g.stopford@schs.gdst.net +L6D,6,,,,,Aoife Tierney,a.tierney@schs.gdst.net +L6D,7,,,,,Sonia Wadhwani,s.wadhwani@schs.gdst.net +L6D,8,,,,,Ruobing Wang,c.wang@schs.gdst.net +L6D,9,,,,,Han Yan,y.han@schs.gdst.net +L6D,10,,,,,Alexandra Zmuda,a.zmuda@schs.gdst.net L4F,1,Baker,Pollyanna,TBAK02,St Georges,Polly Baker L4F,2,Berruti,Maria,TBER12,St Davids, L4F,3,Disley,Amy,TDIS01,St Andrews, From 55c8d8c47c7f637f67e353928fcfd446fd214014 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 8 Sep 2015 21:03:08 +0100 Subject: [PATCH 34/62] Ignore csv files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index e4292b8..03b267b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ kinza.dump */kinza.dump db_schema/*.tsv +*.csv +db_schema/*.csv From 1ad2b40cc68d0a892f2654727939ca65689c31f2 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 8 Sep 2015 21:03:22 +0100 Subject: [PATCH 35/62] Changes to load utilities --- util/load_email | 34 ++++++++++++++++++++++++++++++++++ util/load_students | 8 ++++---- 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100755 util/load_email diff --git a/util/load_email b/util/load_email new file mode 100755 index 0000000..227a390 --- /dev/null +++ b/util/load_email @@ -0,0 +1,34 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use 5.010; + +use FindBin '$Bin'; +use lib "$Bin/../Kinza/lib"; +use Kinza::Schema; + +my $sch = Kinza::Schema->get_schema; +my $st_rs = $sch->resultset('Student'); + +my ($looked, $found); +while (<>) { + chomp; + my ($name, $email) = (split /\s*,\s*/)[0, 2]; + + my $st = $st_rs->find({ + name => $name, + }); + + $looked++; + unless ($st) { + say "Can't find $name"; + next; + } + + $found++; + say "Found $name"; + $st->update({ email => $email }); +} + +say "Looked for $looked. Found $found"; diff --git a/util/load_students b/util/load_students index fd8fd2a..f7cd8ce 100755 --- a/util/load_students +++ b/util/load_students @@ -20,13 +20,13 @@ while (<>) { push @{$year{$year}{$form}}, $name; } -$sch->resultset('Student')->delete; -$sch->resultset('Form')->delete; +#$sch->resultset('Student')->delete; +#$sch->resultset('Form')->delete; my $year_rs = $sch->resultset('Year'); -$year_rs->delete; +#$year_rs->delete; foreach my $year (keys %year) { - my $yr_db = $year_rs->create({ name => $year }); + my $yr_db = $year_rs->find_or_create({ name => $year }); foreach my $form (keys %{$year{$year}}) { my $fm_db = $yr_db->add_to_forms({ name => $form }); foreach my $stud (@{$year{$year}{$form}}) { From a97aac95f3ae1666807a15ad8a5ffde9deb2da12 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 11 Sep 2015 11:55:59 +0100 Subject: [PATCH 36/62] Seperate registration go-live from selection go-live. --- Kinza/lib/Kinza.pm | 16 +++++++++++----- Kinza/views/comingsoon.tt | 2 +- Kinza/views/sel_closed.tt | 4 ++++ 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 Kinza/views/sel_closed.tt diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index ab8fde8..9f48173 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -13,7 +13,8 @@ our $VERSION = '0.1'; prefix undef; -my @envs = qw[ KZ_USER KZ_PASS KZ_HOST KZ_DOMAIN KZ_OPEN ]; +my @envs = qw[ KZ_USER KZ_PASS KZ_HOST + KZ_DOMAIN KZ_REG_OPEN KZ_SEL_OPEN ]; if (my @missing = grep { ! defined $ENV{$_} } @envs) { die 'You must set ', join(', ', @missing[0 .. $#missing - 1]), @@ -33,14 +34,15 @@ my $dt_p = DateTime::Format::Strptime->new( time_zone => 'Europe/London', on_error => 'croak', ); -my $now = DateTime->now(time_zone => 'Europe/London'); -my $live = $dt_p->parse_datetime($ENV{KZ_OPEN}); +my $now = DateTime->now(time_zone => 'Europe/London'); +my $reg_live = $dt_p->parse_datetime($ENV{KZ_REG_OPEN}); +my $sel_live = $dt_p->parse_datetime($ENV{KZ_SEL_OPEN}); my %private = map { $_ => 1 } qw[/submit]; my %open = map { $_ => 1 } qw[/closed /years /reports]; hook before => sub { - if (! $open{request->path_info} and $now < $live) { + if (! $open{request->path_info} and $now < $reg_live) { forward '/closed'; } if ($private{request->path_info} and ! session('user')) { @@ -53,7 +55,8 @@ hook before_template => sub { my $params = shift; $params->{email} = session('email'); $params->{domain} = $ENV{KZ_DOMAIN}; - $params->{live} = $live; + $params->{reg_live} = $reg_live; + $params->{sel_live} = $sel_live; }; get '/closed' => sub { @@ -61,6 +64,9 @@ get '/closed' => sub { }; get '/' => sub { + if ($now < $sel_live) { + return template 'sel_closed'; + } my $error = session('error'); session 'error' => undef; my $choices = session('choices'); diff --git a/Kinza/views/comingsoon.tt b/Kinza/views/comingsoon.tt index 472d79d..d49d32a 100644 --- a/Kinza/views/comingsoon.tt +++ b/Kinza/views/comingsoon.tt @@ -1,3 +1,3 @@

SCHS Kinza 2015/16

Please come back later to register.

-

We open on [% live.strftime('%A %d %B %Y, at %H:%M') %].

+

We open on [% reg_live.strftime('%A %d %B %Y, at %H:%M') %].

diff --git a/Kinza/views/sel_closed.tt b/Kinza/views/sel_closed.tt new file mode 100644 index 0000000..0ea3b6d --- /dev/null +++ b/Kinza/views/sel_closed.tt @@ -0,0 +1,4 @@ +

SCHS Kinza 2015/16

+

Please come back later to make your selections.

+

We open for selections on +[% sel_live.strftime('%A %d %B %Y, at %H:%M') %].

From db21b306ab9d450aaeab727f657e7b5687ea0ad4 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 12 Sep 2015 08:53:38 +0100 Subject: [PATCH 37/62] Remove csv --- db_schema/forms.csv | 457 -------------------------------------------- 1 file changed, 457 deletions(-) delete mode 100644 db_schema/forms.csv diff --git a/db_schema/forms.csv b/db_schema/forms.csv deleted file mode 100644 index 7987a57..0000000 --- a/db_schema/forms.csv +++ /dev/null @@ -1,457 +0,0 @@ -L6A,1,,,,,Megan Aeron-Thomas,m.aeron-thomas@schs.gdst.net -L6A,2,,,,,Hannah Ali,h.ali@schs.gdst.net -L6A,3,,,,,Francesca Anthony,f.anthony@schs.gdst.net -L6A,4,,,,,Anna Bains,a.bains@schs.gdst.net -L6A,5,,,,,Kidist Beyene,k.beyene@schs.gdst.net -L6A,6,,,,,Marianne Bostock,m.bostock@schs.gdst.net -L6A,7,,,,,Charlotte Brand,l.brand@schs.gdst.net -L6A,8,,,,,Jiaying Chen,j.chen@schs.gdst.net -L6A,9,,,,,Charlotte Cole-Hossain,c.cole-hossain@schs.gdst.net -L6A,10,,,,,Kaylin Crossdale,k.crossdale@schs.gdst.net -L6B,1,,,,,Alexandra Downing,a.downing@schs.gdst.net -L6B,2,,,,,Louisa Duck,l.duck@schs.gdst.net -L6B,3,,,,,Martha Fox,m.fox@schs.gdst.net -L6B,4,,,,,Ginger Frame,g.frame@schs.gdst.net -L6B,5,,,,,Claudia Gilbert-Allen,c.gilbert-allen@schs.gdst.net -L6B,6,,,,,Ruby Gil-Rodriguez,r.gil-rodriguez@schs.gdst.net -L6B,7,,,,,Joanna Harland,j.harland@schs.gdst.net -L6B,8,,,,,Holly Jackson,h.jackson@schs.gdst.net -L6B,9,,,,,Gabrielle Jenkins,e.jenkins@schs.gdst.net -L6C,1,,,,,Alice Karslake,a.karslake@schs.gdst.net -L6C,2,,,,,Aysha Khan,a.khan@schs.gdst.net -L6C,3,,,,,Sofia Khan,s.khan3@schs.gdst.net -L6C,4,,,,,Madison Lee,m.lee2@schs.gdst.net -L6C,5,,,,,Kitty Lower,k.lower@schs.gdst.net -L6C,6,,,,,Elizabeth MacNamara,e.macnamara@schs.gdst.net -L6C,7,,,,,Imogen Marriott,i.marriott@schs.gdst.net -L6C,8,,,,,Elizabeth Parke,e.parke@schs.gdst.net -L6C,9,,,,,Nicole Samuels,n.samuels@schs.gdst.net -L6D,1,,,,,Olivia Setna,o.setna@schs.gdst.net -L6D,2,,,,,Alexa Seward,a.seward@schs.gdst.net -L6D,3,,,,,India Sheta,i.sheta@schs.gdst.net -L6D,4,,,,,Mei Silvio,m.silvio@schs.gdst.net -L6D,5,,,,,Georgia Stopford,g.stopford@schs.gdst.net -L6D,6,,,,,Aoife Tierney,a.tierney@schs.gdst.net -L6D,7,,,,,Sonia Wadhwani,s.wadhwani@schs.gdst.net -L6D,8,,,,,Ruobing Wang,c.wang@schs.gdst.net -L6D,9,,,,,Han Yan,y.han@schs.gdst.net -L6D,10,,,,,Alexandra Zmuda,a.zmuda@schs.gdst.net -L4F,1,Baker,Pollyanna,TBAK02,St Georges,Polly Baker -L4F,2,Berruti,Maria,TBER12,St Davids, -L4F,3,Disley,Amy,TDIS01,St Andrews, -L4F,4,Dower,Olivia,TDOW09,St Georges, -L4F,5,Edwards,Erin,TEDW06,St Georges, -L4F,6,Gadian,Georgina,TGAD01,St Georges, -L4F,7,Ganesh,Athena,TGAN03,St Andrews, -L4F,8,Goldman,Maria,TGOL05,St Georges, -L4F,9,Gómez-Lang,Sophia,TGOM03,St Patricks, -L4F,10,Hart,Emilie,THAR29,St Andrews, -L4F,11,Kebbie,Sierra,TKEB01,St Andrews, -L4F,12,Lane,Isobel,TLAN07,St Davids, -L4F,13,Leadbetter,Isabella,TLEA06,St Georges, -L4F,14,Marin-Curtoud,Isabelle,TMAR26,St Patricks, -L4F,15,McDowell,Olivia,TMCD03,St Georges, -L4F,16,McFall,Sorcha,TMCF01,St Andrews, -L4F,17,Overy,Ani,TOVE02,St Patricks, -L4F,18,Pasqua,Isabella,TPAS01,St Andrews, -L4F,19,Phillips,Georgia,TPHI04,St Georges,Georgie Phillips -L4F,20,Pool,Lillan,TPOO01,St Georges, -L4F,21,Redway,Hannah,TRED05,St Georges, -L4F,22,Robinson,Katherine,TROB17,St Patricks,Katie Robinson -L4F,23,Saka,Zeinab,TSAK01,St Georges, -L4F,24,Trumper,Holly,TTRU01,St Patricks, -L4F,25,Whant,Isabella,TWHA04,St Georges, -L4F,26,Wickenden,Margaret,TWIC02,St Patricks, -L4F,27,Wilson,Isabel,TWIL38,St Georges, -L4F,28,Zohidova,Malika,TZOH01,St Andrews, -L4K,1,Acratopulo,Grace,TACR01,St Davids, -L4K,2,Ali,Sahra,TALI05,St Davids, -L4K,3,Ayub,Haleema,TAYU01,St Davids, -L4K,4,Buchanan,Claudia,TBUC01,St Patricks, -L4K,5,Camilleri,Megan,TCAM12,St Davids, -L4K,6,De Polla,Sienna,TDEP01,St Georges, -L4K,7,Deacon,Holly,TDEA01,St Andrews, -L4K,8,Devitt,Chloe,TDEV01,St Davids, -L4K,9,Hooper,Evie,THOO01,St Patricks, -L4K,10,Hoyle,Clarissa,THOY01,St Georges, -L4K,11,Ironmonger,Rosa,TIRO01,St Andrews, -L4K,12,Kefford-Joyce,Madeline,TKEF01,St Georges,Maddie Kefford-Joyce -L4K,13,Knight-Palmer,Keira,TKNI03,St Patricks, -L4K,14,Mullins-Haeri,Natalie,TMUL02,St Davids, -L4K,15,Murphy,Isobel,TMUR19,St Davids, -L4K,16,Mussa,Aisha,TMUS04,St Davids, -L4K,17,Oakley,Alexia,TOAK01,St Davids, -L4K,18,Olinze Shote,Regina Amina,TOLI01,St Andrews,Amina Olinze Shote -L4K,19,Packard,Olivia,TPAC02,St Andrews, -L4K,20,Preen,Scarlett,TPRE04,St Andrews, -L4K,21,Rashid,Sarah,TRAS03,St Davids, -L4K,22,Rebora,Chiara,TREB01,St Georges, -L4K,23,Robinson,Isabella,TROB20,, -L4K,24,Scattergood,Zoe,TSCA05,St Davids, -L4K,25,Stearns,Hester,TSTE24,St Patricks, -L4K,26,Taylor,Cassia,TTAY15,St Andrews, -L4K,27,Telling,Jessica,TTEL01,St Georges, -L4K,28,Tokaya,Jasmine,TTOK01,St Andrews, -L4K,29,Valle,Alicia,TVAL03,St Patricks, -L4S,1,Atakelt Wubneh,Leah,TATA02,St Georges,Leah Wubneh -L4S,2,Auricchio,Catherine,TAUR01,St Andrews, -L4S,3,Bexley,Ella,TBEX01,St Patricks, -L4S,4,Bose,Lara,TBOS03,St Davids, -L4S,5,Christophilopoulos,Lily,TCHR02,St Andrews, -L4S,6,Cooper,Arabella,TCOO11,St Patricks,Bella Cooper -L4S,7,Darko,Shannon,TDAR05,St Davids, -L4S,8,Fitzsimons,Eve,TFIT03,St Andrews, -L4S,9,Gant,Abigail,TGAN01,St Patricks, -L4S,10,Goetz,Amelia,TGOE01,St Davids, -L4S,11,Gollop,Lauren,TGOL07,St Patricks, -L4S,12,Gore,Amelia,TGOR07,St Patricks, -L4S,13,Hollis,Poppy,THOL04,St Davids, -L4S,14,Hopson,Romilly,THOP06,St Georges, -L4S,15,Jackson,Elissa,TJAC10,St Georges, -L4S,16,Jones,Flora,TJON03,St Davids, -L4S,17,Marriott,Beatrice,TMAR19,St Andrews, -L4S,18,McCollum,Eleanor,TMCC01,St Patricks,Ellie McCollum -L4S,19,Moseley,Eleanor,TMOS07,St Georges, -L4S,20,Mukadam,Hafsah,TMUK04,St Georges, -L4S,21,Ofuyaekpone-Shombe,Ujanah,TOFU01,St Patricks, -L4S,22,Smith,Faith,TSMI08,St Davids, -L4S,23,Tanju,Mercedes,TTAN01,St Davids, -L4S,24,Thompson,Emily,TTHO24,St Patricks, -L4S,25,To,Joely,TTOO03,St Andrews, -L4S,26,Tomlinson,Anais,TTOM04,St Georges, -L4S,27,Van Den Berg,Amber,TVAN01,St Davids, -L4S,28,Waldeck-Evans,Lily,TWAL21,St Davids, -L5S,1,Ahmad,Madhihah,TAHM08,St Davids, -L5S,2,Blane,Charlotte,TBLA14,St Andrews, -L5S,3,Brown,Florence,TBRO30,St Patricks,Florrie Brown -L5S,4,Ellis,Jasmine,TELL05,St Georges, -L5S,5,Ferreira,Elena,TFER04,St Georges, -L5S,6,Fitzsimons,Mia,TFIT02,St Georges, -L5S,7,Goodman,Sabrina,TGOO01,St Georges, -L5S,8,Hopson,Hermione,THOP07,St Andrews, -L5S,9,Irwin,Kachanda,TIRW02,St Patricks, -L5S,10,Lawless-Gill,Jean Mei,TLAW05,St Davids, -L5S,11,Mullins-Haeri,Isabella,TMUL01,St Davids, -L5S,12,Pearce,Freya,TPEA08,St Georges, -L5S,13,Potter,Imogen,TPOT02,St Andrews, -L5S,14,Robinson,Amelia,TROB12,St Davids, -L5S,15,Saroochi,Reema,TSAR04,St Andrews, -L5S,16,Scott,Ashleigh,TSCO04,St Georges, -L5S,17,Talbot,Tabitha,TTAL01,St Patricks, -L5S,18,Temple-Morris,Poppy,TTEM01,St Andrews, -L5S,19,Wade,Anna,TWAD03,St Davids, -L5F,1,Atkinson,Lucy,TATK08,St Andrews, -L5F,2,Bateman,Abigail,TBAT11,St Patricks,Abbie Bateman -L5F,3,Bower,Isabella,TBOW02,St Andrews,Ellie Bower -L5F,4,Cannon,Violet,TCAN04,St Davids, -L5F,5,Cayol,Leah,TCAY01,St Davids, -L5F,6,Chambers,Imogen,TCHA24,St Davids,Immie Chambers -L5F,7,Frame,Jemima,TFRA19,St Davids, -L5F,8,Garran,Georgia,TGAR03,St Davids, -L5F,9,Hulett,Toscanie,THUL01,St Davids, -L5F,10,Jenkins,Mali,TJEN06,St Georges, -L5F,11,Kerwin,Alice,TKER01,St Patricks, -L5F,12,Packard,Madeleine,TPAC01,St Georges,Maddie Packard -L5F,13,Robertson,Isobel,TROB14,St Davids,Issy Robertson -L5F,14,Rosselli,Sarah,TROS04,St Andrews, -L5F,15,Shi,Yiqi,,, -L5F,16,Turay,Similda,TTUR08,St Georges, -L5F,17,Walker,Maya,TWAL20,St Georges, -L5F,18,Wu,Yunhan,,, -L5F,19,Yong,Diwen,TYON01,St Davids,Coraline Yong -L5K,1,Awoye,Elliekem,TAWO01,St Andrews,Ellie Awoye -L5K,2,Bailey,Mary,TBAI05,St Andrews, -L5K,3,Betley Waugh,Rhianna,TBET01,St Andrews, -L5K,4,Blake McGrath,Elizabeth,TBLA13,St Patricks, -L5K,5,Bonnet,Emily,TBON01,St Andrews, -L5K,6,Burge-Thomas,Grace,TBUR10,St Andrews, -L5K,7,Burke,Jemima,TBUR09,St Andrews, -L5K,8,Dennis,Alanah,TDEN07,St Georges, -L5K,9,Gill,Charlotte,TGIL05,St Georges, -L5K,10,Gupta,Prachi,TGUP02,St Andrews, -L5K,11,Herz,Alice,THER01,St Georges, -L5K,12,Keeling,Rosanna,TKEE04,St Georges,Rosie Keeling -L5K,13,Kehase,Luwam,TKEH02,St Georges, -L5K,14,Khan,Nur,TKHA14,St Patricks, -L5K,15,Lamond-Warner,Philippa,TLAM04,St Patricks,Pip Lamond-Warner -L5K,16,Linwood,Ella,TLIN08,St Andrews, -L5K,17,Moss,Caitlin,TMOS06,St Andrews, -L5K,18,Ninian,Zoë,TNIN01,St Georges, -L5K,19,Shaw,Lucy,THAS24,St Davids, -L5S,1,Ball,Chiara,TBAL01,St Georges, -L5S,2,Brooks,Ella,TBRO23,St Patricks, -L5S,3,Dunstan,Neisha,TDUN01,St Davids, -L5S,4,Elliott,Mia,TELL03,St Davids, -L5S,5,George,India,TGEO01,St Georges, -L5S,6,Low,Isobel,TLOW02,St Georges,Issy Low -L5S,7,Maher,Beatrice,TMAH04,St Davids,Bea Maher -L5S,8,Morris,Lauren,TMOR20,St Patricks, -L5S,9,Nicolls,Lily,TNIC01,St Patricks, -L5S,10,Pilkington,Octavia,TPIL01,St Davids, -L5S,11,Pym,Lily,TPYM01,St Andrews, -L5S,12,Scoular,Mary,TSCO08,St Patricks, -L5S,13,Sewell,Elysia,TSEW02,St Andrews, -L5S,14,Stopford,Charlotte,TSTO03,St Patricks, -L5S,15,Taft,Saffron,TTAF01,St Georges, -L5S,16,Taylor,Sasha,TTAY14,St Davids, -L5S,17,Terry,Philippa,TTER02,St Patricks,Pippa Terry -L5S,18,Tucker,Rosie,TTUC01,St Patricks, -L5S,19,Williams,Graziela,TBOU01,St Georges,Gracie Boulting-Williams -U3F,1,Angus,Maisie,TANG02,St Patricks, -U3F,2,Arnolin,Emilia,TARN01,St Patricks, -U3F,3,Benjamin,Jada,TBEN12,St Davids, -U3F,4,Bernard,Imogen,,, -U3F,5,Bose,Olive,TBOS04,St Davids, -U3F,6,Burrage,Alice,,, -U3F,7,Chilton,Caitlin,TCHI02,St Georges, -U3F,8,Cosgrove,Lucy,,, -U3F,9,Dunn,Valentina,,, -U3F,10,Fleetwood,Katie,TFLE02,St Patricks, -U3F,11,Hale,Lila,,, -U3F,12,Khan,Amn,TKHA16,St Georges, -U3F,13,Lim,Charlotte,,, -U3F,14,Mann,Madeleine,,, -U3F,15,Masters Dray,Amarna,,, -U3F,16,Morris,Charlotte,,, -U3F,17,Nimmo,Eloise,,, -U3F,18,Papadakis-Taylor,Lucy,TPAP04,St Patricks, -U3F,19,Patel,Krutika,,, -U3F,20,Perry,Lucy,,, -U3F,21,Potter,Daisy Mae,TPOT03,St Davids, -U3F,22,Powell Golding,Zipporah,,, -U3F,23,Prest,Annabelle,TPRE01,St Andrews, -U3F,24,Rashid,Aqsa,,, -U3F,25,Scott,Riva-Bleu,TSCO02,St Davids, -U3F,26,Thomas,Charlotte,,, -U3F,27,Trude,Karina,TIBR01,St Georges, -U3F,28,Tsegay,Wintana,,, -U3F,29,van Roosmalen,Isabella,,, -U3K,1,Arkwright,Sylvie,TARK01,St Georges, -U3K,2,Atakelt Wubneh,Hermela,,, -U3K,3,Bair,Nia,TBAI01,St Andrews, -U3K,4,Carter,Alicia,TCAR23,St Andrews, -U3K,5,Clarke,Scarlett,,, -U3K,6,Cooney,Lily,TCOO10,St Davids, -U3K,7,Cox,Matilda,,, -U3K,8,Cozier,Maya Agnes,TCOZ01,St Davids, -U3K,9,Darkin,Eleanor,,, -U3K,10,Devitt,Melissa,TDEV02,St Davids, -U3K,11,Fraser,Flora,TFRA17,St Patricks, -U3K,12,Gibson,Carmen,TGIB08,St Andrews, -U3K,13,Greig,Martha,,, -U3K,14,Johnson-Ferguson,Daisy,,, -U3K,15,Keith,Abbi,,, -U3K,16,Lawless-Gill,Mary Lou,TLAW06,St Georges, -U3K,17,Line,Sophia,,,Daisy Line -U3K,18,Mickley,Isabel,,, -U3K,19,Nosworthy,Eve,,, -U3K,20,Oakley,Lara,TOAK02,St Patricks, -U3K,21,Pearce,Ayumi,TPEA09,St Patricks, -U3K,22,Potter,Millie Rose,TPOT04,St Patricks, -U3K,23,Raouf-Mairuf,Héma,,, -U3K,24,Reed,Ella,,, -U3K,25,Sullivan-Martin,Isabella,TSUL01,St Davids, -U3K,26,Uddin,Anisa,,, -U3K,27,Vyas,Ella,,, -U3K,28,Ward-Tefft,Tegan,,, -U3K,29,Watson,Monét,TWAT09,St Georges, -U3K,30,Wright,Holly,,, -U3S,1,Ali,Siham,,, -U3S,2,Allen,Millie,TALL07,St Davids, -U3S,3,Anderson,Madeleine,,, -U3S,4,Ashworth,Hannah,TASH05,St Andrews, -U3S,5,Baber,Constance,TBAB02,St Andrews, -U3S,6,Brand,Florence,TBRA13,St Andrews, -U3S,7,Bullock,Alice,,, -U3S,8,Clark,Holly,,, -U3S,9,Cooper,Esmé,,, -U3S,10,Cunningham,Ailbhe,,, -U3S,11,de Alzaga,Camila,,, -U3S,12,Ferney,Blanche,,, -U3S,13,Fraser,Katherine,TFRA18,St Andrews, -U3S,14,Guenancia,Julie,,, -U3S,15,Holland,Eva,,, -U3S,16,Jenkins,Lili,,, -U3S,17,Keegan,Ava-Josephine,,, -U3S,18,Knight Perez,Maya,,, -U3S,19,Langford,Amelia,,, -U3S,20,Lawson,Georgie,TLAW08,St Patricks, -U3S,21,Ospina,Sofia,TOSP01,St Patricks, -U3S,22,Overy,Ella,TOVE03,St Patricks, -U3S,23,Pearce,Talia,TPEA10,St Georges, -U3S,24,Poullis,Florence,TPOU01,St Davids, -U3S,25,Terry,Samantha,TTER03,St Andrews, -U3S,26,Tuaima,Dalia,,, -U3S,27,Turay,Simis,TTUR10,St Georges, -U3S,28,Velarde,Charlotte,,, -U3S,29,Zhang,Yuner,TZHA01,St Andrews, -U3S,30,Zhang,Yunluo,TZHA02,St Georges, -U4F,1,Adarve Counts,Azul,TADA12,St Patricks, -U4F,2,Aikman,Freya,TAIK02,St Andrews, -U4F,3,Barber,Melissa,TBAR21,St Patricks, -U4F,4,Bentley,Johanne,TBEN01,St Davids, -U4F,5,Brent,Lauren,TBRE07,St Andrews, -U4F,6,Burns,Eleanor,TBUR12,St Davids, -U4F,7,Cazenove,Tabitha,TCAZ02,St Georges,Tabby Cazenove -U4F,8,Clemett,Imogen,TCLE02,St Georges, -U4F,9,Dar,Zara,TDAR04,St Davids, -U4F,10,Davis,Carla,TDAV16,St Patricks, -U4F,11,Elliott,Elizabeth,TELL02,St Georges,Libby Elliott -U4F,12,Finnigan,Jacinda,TFIN02,St Georges, -U4F,13,Fitzpatrick,Emma,TFIT04,St Andrews, -U4F,14,Hancox,Poppy,THAN02,St Andrews, -U4F,15,Heenan,Charlotte,THEE01,St Davids, -U4F,16,Henry,Jade,THEN10,St Georges, -U4F,17,McMorrow,Sophie,TMCM01,St Patricks, -U4F,18,Mensah-Kessie,Honey,TMEN02,St Georges, -U4F,19,Menuet,Juliette,TMEN03,St Andrews, -U4F,20,Nunn,Mollie,TNUN02,St Georges, -U4F,21,Olagoke,Adeola,TOLA05,St Davids, -U4F,22,O'Neill,Molly,TONE01,St Patricks, -U4F,23,Springman,Clara,TSPR03,St Patricks, -U4F,24,Storey,Sophie,TSTO05,St Davids, -U4F,25,Thompson,Tess,TTHO23,St Davids, -U4F,26,Wells,Phoebe,TWEL01,St Andrews, -U4K,1,Adamson,Oreoluwa,TADA08,St Patricks,Ore Adamson -U4K,2,Ayivor-Grant,Taren,TAYI01,St Patricks, -U4K,3,Biddulph,Evelyn,TBID01,St Georges, -U4K,4,Boone,Roza,TBOO01,St Georges, -U4K,5,Cluley,Mallory,TCLU01,St Andrews, -U4K,6,Govier,Ellis,TGOV01,St Patricks, -U4K,7,Grant,Jasmine,TGRA12,St Georges, -U4K,8,Hastings,Ella,THAS06,St Georges, -U4K,9,Keegan,Leila,TKEE05,St Andrews, -U4K,10,Keiffer,Cecilia,TKEI02,St Davids,Ceci Keiffer -U4K,11,King,Eve,TKIN01,St Patricks, -U4K,12,Larkin,Emilia,TLAR02,St Georges,Millie Larkin -U4K,13,Lea-Gerrard,Rebecca,TLEA04,St Georges,Becky Lea-Gerrard -U4K,14,Martin,Juliet,TMAR24,St Davids, -U4K,15,Moisley Monsalve,Ana,TMOI01,St Patricks,Gabi Moisley Monsalve -U4K,16,Münt,Anna-Theresa,TMUN01,St Davids,Anna Münt -U4K,17,Popescu-Cirstucescu,Maria,TPOP01,St Georges, -U4K,18,Rostron Smith,Jade,TROS05,, -U4K,19,Salami,Halimah,TSAL02,St Georges, -U4K,20,Sands,Ava,TSAN04,St Georges, -U4K,21,Sesay,Kaliyah-Haja,TSES02,St Patricks,Kaliyah Sesay -U4K,22,Singh,Raina,TSIN10,, -U4K,23,Sutton,Nicole,TSUT04,St Andrews, -U4K,24,Talberg,Liberty,TTAL03,St Georges,Libby Talberg -U4K,25,Webb,Hannah,TWEB01,St Georges, -U4K,26,Wright,Anja,TWRI09,St Andrews, -U4S,1,Alu,Temilola,TALU01,St Davids, -U4S,2,Anderson,Grace,TAND04,St Andrews, -U4S,3,Batha,Zaynah,TBAT08,St Patricks, -U4S,4,Blackden,Faith,TBLA15,St Andrews, -U4S,5,Bohn,Imogen,TBOH03,St Patricks, -U4S,6,Davidson,Isobelle,TDAV19,St Patricks, -U4S,7,Downing,Maya,TDOW08,St Patricks, -U4S,8,Dzyma,Joan,TDZY01,St Davids, -U4S,9,Fleetwood,Emily,TFLE01,St Patricks, -U4S,10,Gil-Rodriguez,Paloma,TGIL03,St Andrews, -U4S,11,Hashmi,Imaan,THAS08,St Davids, -U4S,12,Hayes,Madeleine,THAY10,St Patricks,Maddie Hayes -U4S,13,Jackson,Emily,TJAC09,St Patricks, -U4S,14,Keane,Isobel,TKEA02,St Andrews,Issy Keane -U4S,15,Lee-Leslie,Mia,TLEE08,St Andrews, -U4S,16,Nelson,Thea,TNEL04,St Davids, -U4S,17,Noor,Ruqayyah,TNOO04,St Andrews, -U4S,18,Perham,Alysia,TPER12,St Georges, -U4S,19,Rushton-Smith,Frances,TRUS02,St Georges,Frankie Rushton-Smith -U4S,20,Salisbury,Anya-Rose,TSAL05,St Andrews,Anya Salisbury -U4S,21,Snuggs,Lara,TSNU01,St Davids, -U4S,22,Tartaglia,Fiamma,TTAR01,St Patricks, -U4S,23,Ward,Siobhan,TWAR06,St Davids, -U4S,24,Withers,Gabriella,TWIT01,St Patricks,Gabby Withers -U4S,25,Worling,Skye,TWOR01,St Andrews, -U5F,1,Benavides Clark,Clara,TBEN14,St Andrews, -U5F,2,Cheney,Clara,TCHE08,St Davids, -U5F,3,Clarke,Jessica,TCLA24,St Davids, -U5F,4,Gurney-Champion,Gemma,TGUR03,St Patricks, -U5F,5,Haque,Zainab,THAQ04,St Georges, -U5F,6,Hayes,Madeleine,THAY12,St Davids, -U5F,7,Hussain,Razia,THUS04,St Davids, -U5F,8,Irving,Ayden,TIRV01,St Patricks, -U5F,9,Isaac,Davinia,TISA01,St Georges, -U5F,10,Jones,Alice,TJON02,St Georges, -U5F,11,Kellaghan McGurk,Bethany,TKEL01,St Patricks, -U5F,12,Lea-Gerrard,Hannah,TLEA03,St Georges, -U5F,13,Marie-Gallagher,Sophie,TMAR22,St Patricks, -U5F,14,Nunn,Poppy,TNUN01,St Davids, -U5F,15,Orchard,Aysha,TORC01,St Patricks, -U5F,16,Putley-Hines,Lucy,TPUT01,St Davids, -U5F,17,Redway,Amelia,TRED02,St Georges, -U5F,18,Watson,Anais,TWAT04,St Andrews, -U5K,1,Afandi,Narmin,TAFA01,St Davids, -U5K,2,Cazenove,Pandora,TCAZ01,St Georges, -U5K,3,Cole,Emily,TCOL16,St Davids, -U5K,4,Curry,Lucy,TCUR07,St Davids, -U5K,5,De Bellaigue,Louisa,TDEB01,St Georges, -U5K,6,Griffiths-Clarke,Constance,TGRI05,St Patricks, -U5K,7,Hayes,Kezia,THAY11,St Andrews, -U5K,8,Iliff Lennon,Bunty,TILI01,St Andrews, -U5K,9,Laaouini,Hajar,TLAA02,St Davids, -U5K,10,Leach,Claudia,TLEA05,St Davids, -U5K,11,Martin,Sasha,TMAR25,St Georges, -U5K,12,Minshall,Millie-Rose,TFIE02,St Davids, -U5K,13,Mukasa,Alexandra,TMUK03,St Andrews, -U5K,14,O'Callaghan,Caitlin,TOCA01,St Patricks, -U5K,15,Papachristidis,Eleni,TPAP03,St Georges, -U5K,16,Robineau,Margaux,TROB15,St Georges, -U5K,17,Robins,Erin,TROB18,St Andrews, -U5K,18,Stephenson,Rosie,TSTE15,St Andrews, -U5S,1,Adeyinka,April,TADE04,St Georges, -U5S,2,Celesnik,Rubin,TCEL01,St Andrews, -U5S,3,Clemett,Flora,TCLE01,St Georges, -U5S,4,Coles,Megan,TCOL15,St Davids, -U5S,5,Dodwell,Lucy,TDOD01,St Georges, -U5S,6,Gómez-Lang,Eva,TGOM04,St Georges, -U5S,7,Guimaraes,Macy,TGUI02,St Andrews, -U5S,8,Hayes,Bethany,THAY07,St Andrews, -U5S,9,Hill,Daisy,THIL10,St Patricks, -U5S,10,Knight-Palmer,Maia,TKNI02,St Davids, -U5S,11,Mann,Megan,TMAN11,St Andrews, -U5S,12,McDonald,Anna,TMCD01,St Andrews, -U5S,13,McKenzie,Camara,TMCK03,St Patricks, -U5S,14,Odden,Louise,TODD01,St Georges, -U5S,15,Pinkney,Louisa,TPIN03,St Andrews, -U5S,16,Spencer-Silver,Eleanor,TSPE01,St Patricks, -U5S,17,Warne,Jessica,TWAR07,St Georges, -U5S,18,Zokou,Lucy,TZOK01,St Andrews, -U6P,1,Ashfaq,Madiha,TASH04,St Andrews, -U6P,2,Babalola,Rahimah,TBAB04,St Andrews, -U6P,3,Bainbridge,Marina,TBAI06,St Davids, -U6P,4,Batha,Huma,TBAT06,St Patricks, -U6P,5,Behling,Liberty,TBEH02,St Andrews, -U6P,6,Chaffey,Alexandra,TCHA20,St Patricks, -U6P,7,Chowdhury,Jessica,TCHO01,St Georges, -U6P,8,Dark,Olivia,TDAR02,St Davids, -U6P,9,Fazakerley,Isobel,TFAZ01,St Andrews, -U6Q,1,Franco,Mae,TFRA13,St Andrews, -U6Q,2,Gibson,Christabel,TGIB03,St Georges, -U6Q,3,Hayes,Romy,THAY06,St Andrews, -U6Q,4,Higgins,Sophie,THIG04,St Georges, -U6Q,5,Hinson,Danielle,THIN05,St Patricks, -U6Q,6,Hopson,Raphaela,THOP05,St Davids, -U6Q,7,Hussey,Sharleen,THUS03,St Andrews, -U6Q,8,Lawrence,Alexandra,TLAW07,St Davids, -U6R,1,Lynch,Michaela,TLYN01,St Andrews, -U6R,2,Morgan,Rhiarna,TMOR18,St Davids, -U6R,3,Mukadam,Saudah,TMUK02,St Patricks, -U6R,4,Naveed,Hadiya,TNAV01,St Patricks, -U6R,5,Newton,Isabella,TNEW09,St Davids, -U6R,6,Olubadewo,Deanna,TOLU01,St Georges, -U6R,7,Page,Caitlin,TPAG01,St Davids, -U6R,8,Rotti,Sophie,TROT02,St Davids, -U6R,9,Salami,Faridah,TSAL01,St Georges, -U6R,10,Shaidy,Alina,TSHA21,St Georges, -U6S,1,Shaw,Briony,TSHA23,St Andrews, -U6S,2,Shen,Zhiyi,TSHE10,St Davids, -U6S,3,Sinclair,T'Yahna,TSIN08,St Patricks, -U6S,4,Slatter,Amber-Rose,TSLA01,St Davids, -U6S,5,Tayler,Ophelia,TTAY16,St Patricks, -U6S,6,Taylor,Kalifa,TTAY10,St Davids, -U6S,7,To,Ellen,TTOO01,St Andrews, -U6S,8,Usher,Leila,TUSH01,St Patricks, -U6S,9,Wickes,Elsa,TWIC01,St Georges, -U6S,10,Williams,Alexandra,TWIL35,St Davids, -U6S,11,Willmott,Louise,TWIL19,St Andrews, From 7a30beb38f8858bf9e09be10b151805b086fcbfd Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 12 Sep 2015 09:35:53 +0100 Subject: [PATCH 38/62] Improve registration/selection separation (so it works!) --- Kinza/lib/Kinza.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 9f48173..82a568d 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -57,6 +57,13 @@ hook before_template => sub { $params->{domain} = $ENV{KZ_DOMAIN}; $params->{reg_live} = $reg_live; $params->{sel_live} = $sel_live; + if (session('email')) { + $params->{student} = $rs{Student}->find({ + email => session('email') + }); + } else { + delete $params->{student}; + } }; get '/closed' => sub { @@ -64,7 +71,7 @@ get '/closed' => sub { }; get '/' => sub { - if ($now < $sel_live) { + if (session('name') and $now < $sel_live) { return template 'sel_closed'; } my $error = session('error'); @@ -221,7 +228,8 @@ post '/register' => sub { } if ($user->password) { - session 'error', "email is already registered."; + session 'error', $user->name . ' (' . $user->email . ') is already registered.' + . '
Please log in instead.

'; return redirect '/register'; } From 694f5c7e9c25b3b18421624d50b7f98f01f12c63 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 12 Sep 2015 15:24:51 +0100 Subject: [PATCH 39/62] Add new /courses page. Fix some issues that presented. --- Kinza/lib/Kinza.pm | 8 ++++++++ Kinza/lib/Kinza/Schema/Result/Course.pm | 7 +++++++ Kinza/views/courses.tt | 23 +++++++++++++++++++++++ db_schema/courses.txt | 2 +- util/load_courses | 6 +++++- 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 Kinza/views/courses.tt diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 82a568d..9c62358 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -457,6 +457,14 @@ get '/years' => sub { template 'years', { years => $rs{Year} }; }; +get '/courses' => sub { + template 'courses', { + courses => $rs{Course}, + years => $rs{Year}, + terms => $rs{Term}, + }; +}; + sub send_verify { my ($student) = @_; diff --git a/Kinza/lib/Kinza/Schema/Result/Course.pm b/Kinza/lib/Kinza/Schema/Result/Course.pm index 8a1a5e3..15e3a64 100644 --- a/Kinza/lib/Kinza/Schema/Result/Course.pm +++ b/Kinza/lib/Kinza/Schema/Result/Course.pm @@ -177,3 +177,10 @@ sub in_term { # You can replace this text with custom code or comments, and it will be preserved on regeneration __PACKAGE__->meta->make_immutable; 1; + +sub allowed_for_year { + my $self = shift; + my $year = shift; + + return $self->allowed_years->search({ 'year.name' => $year })->count; +} \ No newline at end of file diff --git a/Kinza/views/courses.tt b/Kinza/views/courses.tt new file mode 100644 index 0000000..e2d3084 --- /dev/null +++ b/Kinza/views/courses.tt @@ -0,0 +1,23 @@ + + +[% FOREACH course IN courses.all.sort('title') -%] + +[% course_years = []; + FOREACH year IN years.all.sort('seq'); + IF course.allowed_for_year(year.name); + course_years.push(year.name); + ELSE; + course_years.push('X'); + END; + END -%] + +[% course_terms = []; + FOREACH term IN terms.all.sort('seq'); + pres = course.in_term(term.id); + IF pres; + course_terms.push(term.name _ ' (' _ (pres.attendances.count || 0) _ ')'); + END; + END -%] + +[% END -%] +
TitleYearsTerms
[% course.title %][% course_years.join(' / ') %][% course_terms.join('
') %]
diff --git a/db_schema/courses.txt b/db_schema/courses.txt index 5c40a50..c9cf2f7 100644 --- a/db_schema/courses.txt +++ b/db_schema/courses.txt @@ -161,7 +161,7 @@ Max 16 Television Sports Broadcasting S -All Ages +All ages Max 16 The Common Room: Magazine Journalism diff --git a/util/load_courses b/util/load_courses index ba140ba..055e4b3 100755 --- a/util/load_courses +++ b/util/load_courses @@ -42,7 +42,11 @@ foreach (@courses) { $_ = \%course; } -my $course_rs = $sch->resultset('Course'); +my $course_rs = $sch->resultset('Course'); +$sch->resultset('AllowedCourseYear')->delete; +$sch->resultset('Attendance')->delete; +$sch->resultset('Presentation')->delete; +$course_rs->delete; foreach (@courses) { my $crs = $course_rs->create({ From a97a401be32484f3fc7a14d4970cc4b343880395 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 12 Sep 2015 17:52:39 +0100 Subject: [PATCH 40/62] Added capacity to /courses page. --- Kinza/views/courses.tt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Kinza/views/courses.tt b/Kinza/views/courses.tt index e2d3084..ffa97d0 100644 --- a/Kinza/views/courses.tt +++ b/Kinza/views/courses.tt @@ -1,7 +1,8 @@ - + [% FOREACH course IN courses.all.sort('title') -%] - + + [% course_years = []; FOREACH year IN years.all.sort('seq'); IF course.allowed_for_year(year.name); From 99a6dd53c4e56ffa9331e542782575c13a0d8b84 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 12 Sep 2015 17:52:53 +0100 Subject: [PATCH 41/62] Typo in courses data --- db_schema/courses.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db_schema/courses.txt b/db_schema/courses.txt index c9cf2f7..4eaa142 100644 --- a/db_schema/courses.txt +++ b/db_schema/courses.txt @@ -151,7 +151,7 @@ Max 12 Stencil and Spray Paint All terms -All ages, +All ages Max 12 Table Tennis From 6ed9d04c2938b70e215d69e71e48d15edbba0a2b Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 14 Sep 2015 09:35:24 +0100 Subject: [PATCH 42/62] Always use lower case version of student's email address. --- Kinza/lib/Kinza.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 9c62358..c71aa69 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -202,7 +202,7 @@ post '/register' => sub { session 'error', undef; - unless ($email = param('email') + unless ($email = lc param('email') and $pass1 = param('password') and $pass2 = param('password2')) { session 'error' => 'You must fill in all values'; return redirect '/register'; @@ -289,7 +289,7 @@ post '/resend' => sub { } $student->update({ - email => param('email'), + email => lc param('email'), }); # reread from database $student->discard_changes; @@ -316,7 +316,7 @@ post '/login' => sub { } my $user = $rs{Student}->find({ - email => params->{email}, + email => lc params->{email}, }); unless ($user) { session 'error' => 'Invalid email or password'; @@ -356,7 +356,7 @@ post '/password' => sub { session 'error' => 'You must give an email address'; return redirect '/password'; } - my $email = params->{email}; + my $email = lc params->{email}; my $student = $rs{Student}->find({ email => $email, }); From ee126a31d8606e9626ed21efcffa8c23122b73fc Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 15 Sep 2015 09:16:54 +0100 Subject: [PATCH 43/62] Added Google Analytics --- Kinza/views/layouts/main.tt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Kinza/views/layouts/main.tt b/Kinza/views/layouts/main.tt index 95ac2ce..bb09718 100644 --- a/Kinza/views/layouts/main.tt +++ b/Kinza/views/layouts/main.tt @@ -58,6 +58,16 @@ + From 8b38bea9bdec191717cc7e5327e163fa5972b089 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 15 Sep 2015 12:20:37 +0100 Subject: [PATCH 44/62] Tweaks to courses --- db_schema/courses.txt | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/db_schema/courses.txt b/db_schema/courses.txt index 4eaa142..9c4072a 100644 --- a/db_schema/courses.txt +++ b/db_schema/courses.txt @@ -41,7 +41,7 @@ Max 30 Ceramic Tea Party All terms All ages -Max 30 +Max 24 Chess All terms @@ -49,20 +49,14 @@ All ages Max 30 Duke of Edinburgh - Bronze -M +M,L L5 -1000 - -Duke of Edinburgh - Silver -L -U5,L6 -1000 +30 Duke of Edinburgh - Gold S -L6 -1000 - +L6,U6 +40 German Language and Culture All terms @@ -90,7 +84,7 @@ L5,U5,L6,U6 Max 30 Loops, Riffs and Beats -All terms +S All ages Max 15 From 67cbbf2cf06bf8cde51ba090a6250d3aa827848d Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 15 Sep 2015 12:52:10 +0100 Subject: [PATCH 45/62] Add 'verified' column. --- Kinza/views/years.tt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kinza/views/years.tt b/Kinza/views/years.tt index cc56bdd..6048d79 100644 --- a/Kinza/views/years.tt +++ b/Kinza/views/years.tt @@ -12,10 +12,11 @@ END -%] [% FOREACH form IN year.forms.sort('name') -%] - + [% FOREACH student IN form.students.sort('name') -%] + [% END -%] [% END -%] From 1f656c7344cd7f30b4eacb2ed06e1952504e01be Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 15 Sep 2015 15:21:41 +0100 Subject: [PATCH 46/62] Add useful is_registered and is_verified methods to student. --- Kinza/lib/Kinza/Schema/Result/Student.pm | 12 ++++++++++++ Kinza/views/years.tt | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Kinza/lib/Kinza/Schema/Result/Student.pm b/Kinza/lib/Kinza/Schema/Result/Student.pm index bcd2624..42293ca 100644 --- a/Kinza/lib/Kinza/Schema/Result/Student.pm +++ b/Kinza/lib/Kinza/Schema/Result/Student.pm @@ -194,6 +194,18 @@ sub allowed_courses { return $self->form->year->allowed_courses; } +sub is_registered { + my $self = shift; + + return length $self->password; +} + +sub is_verified { + my $self = shift; + + return $self->is_registered && ! $self->verify; +} + # You can replace this text with custom code or comments, and it will be preserved on regeneration __PACKAGE__->meta->make_immutable; 1; diff --git a/Kinza/views/years.tt b/Kinza/views/years.tt index 6048d79..aac01af 100644 --- a/Kinza/views/years.tt +++ b/Kinza/views/years.tt @@ -15,8 +15,8 @@ END -%] [% FOREACH student IN form.students.sort('name') -%] - - + + [% END -%] [% END -%] From 1b63a9194dae41da54307b20852557d09ad46bf0 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 15 Sep 2015 16:39:37 +0100 Subject: [PATCH 47/62] Fix colspan to take new column into account --- Kinza/views/years.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kinza/views/years.tt b/Kinza/views/years.tt index aac01af..3e091e6 100644 --- a/Kinza/views/years.tt +++ b/Kinza/views/years.tt @@ -9,9 +9,9 @@ END -%]
TitleYearsTerms
TitlePlacesYearsTerms
[% course.title %]
[% course.title %][% course.capacity %]

[% year.name %]

[% form.name %]

NameEmailRegisteredSelected
NameEmailRegisteredVerifiedSelected
[% student.name %][% student.email %] [% ok(student.password) %][% ok(student.password AND NOT student.verify) %] [% ok(student.locked) %]
NameEmailRegisteredVerifiedSelected
[% student.name %][% student.email %][% ok(student.password) %][% ok(student.password AND NOT student.verify) %][% ok(student.is_registered) %][% ok(student.is_verified) %] [% ok(student.locked) %]
[% FOREACH year IN years.all.sort('seq') -%] - + [% FOREACH form IN year.forms.sort('name') -%] - + [% FOREACH student IN form.students.sort('name') -%] From e835251e6e78bcb7c2ae7226b531356889df933a Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Wed, 16 Sep 2015 17:21:49 +0100 Subject: [PATCH 48/62] Added more help on the login page --- Kinza/views/login.tt | 1 + 1 file changed, 1 insertion(+) diff --git a/Kinza/views/login.tt b/Kinza/views/login.tt index 99ca6d5..4d4509c 100644 --- a/Kinza/views/login.tt +++ b/Kinza/views/login.tt @@ -28,6 +28,7 @@
Forgotten password + Or perhaps you need to register first
From 3cae0fb4caa9264e14fbaf9feb0ae70204775d03 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Wed, 16 Sep 2015 17:23:12 +0100 Subject: [PATCH 49/62] Make it a bit prettier --- Kinza/views/login.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kinza/views/login.tt b/Kinza/views/login.tt index 4d4509c..1cfdd66 100644 --- a/Kinza/views/login.tt +++ b/Kinza/views/login.tt @@ -27,8 +27,8 @@
- Forgotten password - Or perhaps you need to register first + Forgotten password.
+ Or perhaps you need to register first
From 488caf29412f41df8c3656e3ba972c0106aa364c Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Wed, 16 Sep 2015 17:24:30 +0100 Subject: [PATCH 50/62] Another tweak --- Kinza/views/login.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kinza/views/login.tt b/Kinza/views/login.tt index 1cfdd66..19bc2a7 100644 --- a/Kinza/views/login.tt +++ b/Kinza/views/login.tt @@ -26,7 +26,7 @@ -
+
Forgotten password.
Or perhaps you need to register first
From d93a46265ce80721a782f2bf228513b7183c79b9 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Thu, 17 Sep 2015 07:16:16 +0100 Subject: [PATCH 51/62] Live bodge --- Kinza/lib/Kinza.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 9c62358..2657abb 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -42,7 +42,7 @@ my %private = map { $_ => 1 } qw[/submit]; my %open = map { $_ => 1 } qw[/closed /years /reports]; hook before => sub { - if (! $open{request->path_info} and $now < $reg_live) { + if (! $open{request->path_info}) { forward '/closed'; } if ($private{request->path_info} and ! session('user')) { From bdc89006df5f70c4682104fa0254134cda85ff57 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 19 Sep 2015 15:10:57 +0100 Subject: [PATCH 52/62] Fix opening time logic. Cut down on SQL queries to build selection page. --- Kinza/lib/Kinza.pm | 34 ++++++++++++++++++++------- Kinza/lib/Kinza/Schema/Result/Year.pm | 12 ++++++++++ Kinza/views/index.tt | 5 ++-- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 49a2b37..5000c14 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -38,11 +38,15 @@ my $now = DateTime->now(time_zone => 'Europe/London'); my $reg_live = $dt_p->parse_datetime($ENV{KZ_REG_OPEN}); my $sel_live = $dt_p->parse_datetime($ENV{KZ_SEL_OPEN}); -my %private = map { $_ => 1 } qw[/submit]; -my %open = map { $_ => 1 } qw[/closed /years /reports]; +my %private = map { $_ => 1 } qw[/submit]; +my %open = map { $_ => 1 } qw[/closed /years /reports]; +my %reg_open = (%open, map { $_ => 1 } qw[/register]); hook before => sub { - if (! $open{request->path_info}) { + if ($now < $reg_live && ! $open{request->path_info}) { + forward '/closed'; + } + if (session('name') && $now < $sel_live && ! $open{request->path_info}) { forward '/closed'; } if ($private{request->path_info} and ! session('user')) { @@ -67,13 +71,14 @@ hook before_template => sub { }; get '/closed' => sub { - return template 'comingsoon'; + if ($now < $reg_live) { + return template 'comingsoon'; + } else { + return template 'sel_closed'; + } }; get '/' => sub { - if (session('name') and $now < $sel_live) { - return template 'sel_closed'; - } my $error = session('error'); session 'error' => undef; my $choices = session('choices'); @@ -90,12 +95,25 @@ get '/' => sub { $choices = $student->choices; } + my @terms = $rs{Term}->search({}, { + prefetch => { presentations => 'attendances' }, + order_by => 'seq', + })->all; + + my %term_course; + foreach my $t (@terms) { + foreach my $p ($t->presentations) { + $term_course{$t->id}{$p->course_id} = $p; + } + } + template 'index', { error => $error, choices => $choices, student => $student, courses => [ $rs{Course}->all ], - terms => [ $rs{Term}->all ], + terms => \@terms, + term_course => \%term_course, }; }; diff --git a/Kinza/lib/Kinza/Schema/Result/Year.pm b/Kinza/lib/Kinza/Schema/Result/Year.pm index 67975c1..4fd5a1f 100644 --- a/Kinza/lib/Kinza/Schema/Result/Year.pm +++ b/Kinza/lib/Kinza/Schema/Result/Year.pm @@ -123,6 +123,18 @@ __PACKAGE__->many_to_many( 'course', ); +sub get_allowed_courses { + my $self = shift; + + return $self->allowed_courses({}, { + prefetch => { presentations => 'term' }, + join => {presentations => 'attendances' }, + '+select' => { count => 'attendances.id' }, + '+as' => [ 'att_count' ], + group_by => [ 'course.id', 'presentations.id' ], + }); +} + # You can replace this text with custom code or comments, and it will be preserved on regeneration __PACKAGE__->meta->make_immutable; 1; diff --git a/Kinza/views/index.tt b/Kinza/views/index.tt index 0a910d7..e17ca5d 100644 --- a/Kinza/views/index.tt +++ b/Kinza/views/index.tt @@ -32,14 +32,15 @@
[% END -%] -[% FOREACH c IN student.allowed_courses -%] +[% SET year = student.form.year; + FOREACH c IN year.get_allowed_courses -%] [% SET total_terms = terms.size; SET skip_terms = 0; FOREACH t IN terms; IF ! skip_terms; THEN; - SET p = c.in_term(t.id); + SET p = term_course.${t.id}.${c.id}; IF p; THEN -%] [% SET skip_terms = p.number_of_terms - 1; From f415dfc22c096e5e49237b2188cb2bd45c599983 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 19 Sep 2015 16:17:34 +0100 Subject: [PATCH 53/62] Sprinklings of prefetch. Cut down massively on DB queries. --- Kinza/lib/Kinza.pm | 23 +++++++++++++++++------ Kinza/lib/Kinza/Schema/Result/Student.pm | 2 +- Kinza/views/index.tt | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 5000c14..d3c1d85 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -61,11 +61,15 @@ hook before_template => sub { $params->{domain} = $ENV{KZ_DOMAIN}; $params->{reg_live} = $reg_live; $params->{sel_live} = $sel_live; - if (session('email')) { + if (session('email') and ! $params->{student}) { $params->{student} = $rs{Student}->find({ email => session('email') + }, { + prefetch => { form => 'year' }, }); - } else { + } + + if (!session('email')) { delete $params->{student}; } }; @@ -88,6 +92,8 @@ get '/' => sub { if (session('email')) { $student = $rs{Student}->find({ email => session('email'), + }, { + prefetch => [{ attendances => 'presentation' }, { form => 'year' } ], }); } @@ -96,7 +102,7 @@ get '/' => sub { } my @terms = $rs{Term}->search({}, { - prefetch => { presentations => 'attendances' }, + prefetch => { presentations => ['course', 'attendances'] }, order_by => 'seq', })->all; @@ -111,7 +117,6 @@ get '/' => sub { error => $error, choices => $choices, student => $student, - courses => [ $rs{Course}->all ], terms => \@terms, term_course => \%term_course, }; @@ -128,8 +133,14 @@ post '/save' => sub { my $terms = 0; my %courses; my @unavailable; - foreach (keys %params) { - my $pres = $rs{Presentation}->find({ id => $params{$_} }); + + my @pres = $rs{Presentation}->search({ + 'me.id' => [ values %params], + }, { + prefetch => [ 'course', 'term', 'attendances' ], + }); + + foreach my $pres (@pres) { $terms += $pres->number_of_terms; $courses{$pres->course->id} = 1; push @unavailable, $pres->course->title . ' (' . $pres->term->name . ')' diff --git a/Kinza/lib/Kinza/Schema/Result/Student.pm b/Kinza/lib/Kinza/Schema/Result/Student.pm index 42293ca..e779a22 100644 --- a/Kinza/lib/Kinza/Schema/Result/Student.pm +++ b/Kinza/lib/Kinza/Schema/Result/Student.pm @@ -171,7 +171,7 @@ sub sorted_attendances { my $self = shift; return $self->attendances->search({}, { - join => { presentation => 'term' }, + prefetch => { presentation => ['term', 'course'] }, order_by => 'term.seq', }); } diff --git a/Kinza/views/index.tt b/Kinza/views/index.tt index e17ca5d..950c795 100644 --- a/Kinza/views/index.tt +++ b/Kinza/views/index.tt @@ -42,7 +42,7 @@ IF ! skip_terms; THEN; SET p = term_course.${t.id}.${c.id}; IF p; THEN -%] - + [% SET skip_terms = p.number_of_terms - 1; ELSE -%] From 1f31a6517185535688a146ed930a2912f04f9420 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 20 Sep 2015 20:24:47 +0100 Subject: [PATCH 54/62] Add warning text about the Microsoft email problems. --- Kinza/views/index.tt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Kinza/views/index.tt b/Kinza/views/index.tt index 950c795..7802bda 100644 --- a/Kinza/views/index.tt +++ b/Kinza/views/index.tt @@ -12,6 +12,9 @@ [% IF student.verify -%]

You need to verify your email address before using this site.

To verify your email address, click the link in the email we sent you.

+

Currently, the school email server is not accepting email from this web +site. If you ask for the email to be resent then you +will be able to change the email address to a non-school one.

If you haven't received your email, please click here and we will resend it.

[% ELSIF student.locked -%] From 07ceb1839343f91bbe1de72335705967bb73547a Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sun, 20 Sep 2015 20:45:10 +0100 Subject: [PATCH 55/62] Fixed the 'courses' report. --- Kinza/lib/Kinza/Schema/Result/Presentation.pm | 7 ++++++- Kinza/views/courses.tt | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Kinza/lib/Kinza/Schema/Result/Presentation.pm b/Kinza/lib/Kinza/Schema/Result/Presentation.pm index d354c1a..2e7d923 100644 --- a/Kinza/lib/Kinza/Schema/Result/Presentation.pm +++ b/Kinza/lib/Kinza/Schema/Result/Presentation.pm @@ -149,7 +149,7 @@ __PACKAGE__->many_to_many( sub spaces { my $self = shift; - return $self->course->capacity - $self->attendances->count; + return $self->course->capacity - $self->number; } sub available { @@ -164,6 +164,11 @@ sub full { return ! $self->available; } +sub number { + my $self = shift; + + return $self->attendances->count; +} # You can replace this text with custom code or comments, and it will be preserved on regeneration __PACKAGE__->meta->make_immutable; diff --git a/Kinza/views/courses.tt b/Kinza/views/courses.tt index ffa97d0..ae36b8c 100644 --- a/Kinza/views/courses.tt +++ b/Kinza/views/courses.tt @@ -16,7 +16,7 @@ FOREACH term IN terms.all.sort('seq'); pres = course.in_term(term.id); IF pres; - course_terms.push(term.name _ ' (' _ (pres.attendances.count || 0) _ ')'); + course_terms.push(term.name _ ' (' _ (pres.number || 0) _ ')'); END; END -%]
From d98bd1fe3048e71ca11134a33a8c1b23d572d20f Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 21 Sep 2015 08:45:12 +0100 Subject: [PATCH 56/62] Addemd more instructions about the verification problems. --- Kinza/views/registered.tt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Kinza/views/registered.tt b/Kinza/views/registered.tt index 0d9483e..b683a2e 100644 --- a/Kinza/views/registered.tt +++ b/Kinza/views/registered.tt @@ -5,3 +5,8 @@

You need to verify your email address before using the system. Please check your inbox and click the link in the email we have just sent you.

+

Note: Currently the SCHS email system is not accepting email +from this web site, therefore verification emails are not getting through to +these addresses. Therefore, you should go to the +resend to get the verification email resent to an +alternative email address.

From 25abf6a0ee4caffa4fbf82133802f39b8b281c41 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 21 Sep 2015 08:47:50 +0100 Subject: [PATCH 57/62] Add more instructions to the resend page. --- Kinza/views/resend.tt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Kinza/views/resend.tt b/Kinza/views/resend.tt index 6b1a4b6..1df1215 100644 --- a/Kinza/views/resend.tt +++ b/Kinza/views/resend.tt @@ -3,6 +3,8 @@

Press the button below to resend the verification email to [% student.email %].

You can change the email address before sending the email.

+

Note: If you change your email address, then you will need to use +this new email address to log in to the site in the future.

@@ -15,4 +17,4 @@
- \ No newline at end of file + From abbb2ff31837f9134a6228433696080832e0aa80 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 21 Sep 2015 09:02:14 +0100 Subject: [PATCH 58/62] Fix grammar :-/ --- Kinza/views/registered.tt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Kinza/views/registered.tt b/Kinza/views/registered.tt index b683a2e..2a9f98b 100644 --- a/Kinza/views/registered.tt +++ b/Kinza/views/registered.tt @@ -6,7 +6,7 @@ Please check your inbox and click the link in the email we have just sent you.

Note: Currently the SCHS email system is not accepting email -from this web site, therefore verification emails are not getting through to -these addresses. Therefore, you should go to the -resend to get the verification email resent to an +from this web site, which meand that verification emails are not getting +through to these addresses. Therefore, you should go to the +resend page to get the verification email resent to an alternative email address.

From 0ba89c9a22af078e1b855dfdf345055003f29cf9 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 21 Sep 2015 20:43:23 +0100 Subject: [PATCH 59/62] Make more stuff open when the site is closed. --- Kinza/lib/Kinza.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index d3c1d85..abdacb4 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -39,7 +39,7 @@ my $reg_live = $dt_p->parse_datetime($ENV{KZ_REG_OPEN}); my $sel_live = $dt_p->parse_datetime($ENV{KZ_SEL_OPEN}); my %private = map { $_ => 1 } qw[/submit]; -my %open = map { $_ => 1 } qw[/closed /years /reports]; +my %open = map { $_ => 1, "$_/" => 1 } qw[/closed /years /reports /courses]; my %reg_open = (%open, map { $_ => 1 } qw[/register]); hook before => sub { From b30281038c4f41824cc3f5320151eb458f2301d2 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 21 Sep 2015 20:46:57 +0100 Subject: [PATCH 60/62] Even more openness --- Kinza/lib/Kinza.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index abdacb4..0710a08 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -39,7 +39,9 @@ my $reg_live = $dt_p->parse_datetime($ENV{KZ_REG_OPEN}); my $sel_live = $dt_p->parse_datetime($ENV{KZ_SEL_OPEN}); my %private = map { $_ => 1 } qw[/submit]; -my %open = map { $_ => 1, "$_/" => 1 } qw[/closed /years /reports /courses]; +my %open = map { $_ => 1, "$_/" => 1 } + qw[/closed /years /reports /courses + /reports/form /reports/course /reports/numbers]; my %reg_open = (%open, map { $_ => 1 } qw[/register]); hook before => sub { From a4954ab9ee57c90968aedefc9aff1acbb6207ded Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 22 Sep 2015 07:01:36 +0100 Subject: [PATCH 61/62] Utility script to add choices from a spreadsheet --- util/load_choices | 62 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 util/load_choices diff --git a/util/load_choices b/util/load_choices new file mode 100755 index 0000000..1607a07 --- /dev/null +++ b/util/load_choices @@ -0,0 +1,62 @@ +#!/usr/bin/perl -CS + +use strict; +use warnings; +use 5.010; + +use FindBin; +use lib "$FindBin::Bin/../Kinza/lib"; +use Kinza::Schema; + +my $sch = Kinza::Schema->get_schema; + +my %rs; +for (qw[Student Course Term]) { + $rs{$_} = $sch->resultset($_); +} + +my $file = shift || 'Kinza-Choices.tsv'; + +open my $fh, '<', $file or die $!; + +my @terms = qw[M L S]; + +while (<$fh>) { + chomp; + my ($name, %c); + ($name, @c{@terms}) = split /\t/; + + my $s = find_in('Student', 'name', $name); + foreach my $t_name (@terms) { + next unless $c{$t_name}; + my $c = find_in('Course', 'title', $c{$t_name}); + next unless $c; + my $t = find_in('Term', 'code', $t_name); + my $p = $c->in_term($t->id); + unless ($p) { + warn "No presentation of $c{$t_name} in $t_name\n"; + next; + } + $s->add_to_attendances({ + presentation_id => $p->id, + }); + } +} + +sub find_in { + my ($rs_name, $column, $val) = @_; + + my $thing_rs = $rs{$rs_name}->search({ $column => { like => "$val%" } }); + + unless ($thing_rs->count) { + warn "Can't find $rs_name with $column $val\n"; + return; + } + + if ($thing_rs->count != 1) { + warn "More than one $rs_name with $column $val\n"; + return; + } + + return $thing_rs->first; +} From 4e4062ce5c80b6854c9058dd0c202ec6e334c9d3 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 29 Dec 2015 16:14:08 +0000 Subject: [PATCH 62/62] Fix display of multi-term presentations in the form CSV --- Kinza/lib/Kinza/Reports.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Kinza/lib/Kinza/Reports.pm b/Kinza/lib/Kinza/Reports.pm index 9d3cdd5..61d48ab 100644 --- a/Kinza/lib/Kinza/Reports.pm +++ b/Kinza/lib/Kinza/Reports.pm @@ -41,7 +41,9 @@ get '/form' => sub { foreach my $s ($f->students->search({}, { order_by => 'name' })) { $csv .= $s->name; foreach my $a ($s->sorted_attendances) { - $csv .= ',"' . $a->presentation->course->title . '"'; + for (1 .. $a->presentation->number_of_terms) { + $csv .= ',"' . $a->presentation->course->title . '"'; + } } $csv .= "\n"; }

[% year.name %]

[% year.name %]

[% form.name %]

[% form.name %]

NameEmailRegisteredVerifiedSelected
[% student.name %][% student.email %][% t.name %]
[% c.title %][% IF c.description %]
[% c.description %][% END %]
1; THEN %] colspan=[% p.number_of_terms; END %] title="[% t.name %]"> 1; THEN %] colspan=[% p.number_of_terms; END %] title="[% t.name %]"> 1; THEN %] colspan=[% p.number_of_terms; END %] title="[% t.name %]"> [% course_terms.join('
') %]