Skip to content

Commit

Permalink
Add useful is_registered and is_verified methods to student.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Cross committed Sep 15, 2015
1 parent 67cbbf2 commit 1f656c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions Kinza/lib/Kinza/Schema/Result/Student.pm
Expand Up @@ -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;
4 changes: 2 additions & 2 deletions Kinza/views/years.tt
Expand Up @@ -15,8 +15,8 @@ END -%]
<tr><th>Name</th><th>Email</th><th>Registered</th><th>Verified</th><th>Selected</th></td>
[% FOREACH student IN form.students.sort('name') -%]
<tr><td>[% student.name %]</td><td>[% student.email %]</td>
<td>[% ok(student.password) %]</td>
<td>[% ok(student.password AND NOT student.verify) %]</td>
<td>[% ok(student.is_registered) %]</td>
<td>[% ok(student.is_verified) %]</td>
<td>[% ok(student.locked) %]</td></tr>
[% END -%]
[% END -%]
Expand Down

0 comments on commit 1f656c7

Please sign in to comment.