all tests pass
This commit is contained in:
parent
5b59a4d39b
commit
1b191e3d90
1 changed files with 27 additions and 4 deletions
|
@ -2,6 +2,7 @@ package OOPerlTest::Personal::Person::Employee::Manager;
|
||||||
|
|
||||||
use Moose;
|
use Moose;
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
|
use Data::Dumper;
|
||||||
|
|
||||||
extends 'OOPerlTest::Personal::Person::Employee';
|
extends 'OOPerlTest::Personal::Person::Employee';
|
||||||
|
|
||||||
|
@ -27,14 +28,26 @@ sub Hire {
|
||||||
return $empl;
|
return $empl;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub Fire {}
|
sub Fire {
|
||||||
|
my ($self, $empl) = @_;
|
||||||
|
|
||||||
|
# get rid of the employee from the list
|
||||||
|
my @empls = grep {$_ ne $empl} @{$self->employees};
|
||||||
|
$self->employees(\@empls);
|
||||||
|
|
||||||
|
my $person = OOPerlTest::Personal::Person->new({
|
||||||
|
name => $empl->name(),
|
||||||
|
($empl->alias() ? (alias => $empl->alias()) : ()),
|
||||||
|
dateOfBirth => $empl->dateOfBirth(),
|
||||||
|
});
|
||||||
|
return $person;
|
||||||
|
}
|
||||||
|
|
||||||
sub Work {
|
sub Work {
|
||||||
my ($self, $work) = @_;
|
my ($self, $work) = @_;
|
||||||
|
|
||||||
# don't work if it's already done
|
# don't work if it's already done
|
||||||
return $work if ($work->status() eq "NotStarted" || $work->status() eq "Started");
|
return $work if ($work->status() eq "Completed" || $work->status() eq "Rejected");
|
||||||
|
|
||||||
|
|
||||||
# this will naively pick the first person always to work. any real system should distrubute the work
|
# this will naively pick the first person always to work. any real system should distrubute the work
|
||||||
if (@{$self->employees()} >= 1) {
|
if (@{$self->employees()} >= 1) {
|
||||||
|
@ -55,7 +68,17 @@ sub Work {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub Quit {}
|
sub Quit {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
my $empl = OOPerlTest::Personal::Person::Employee->new({
|
||||||
|
name => $self->name(),
|
||||||
|
($self->alias() ? (alias => $self->alias()) : ()),
|
||||||
|
dateOfBirth => $self->dateOfBirth(),
|
||||||
|
hireDate => $self->hireDate(),
|
||||||
|
});
|
||||||
|
return $empl;
|
||||||
|
}
|
||||||
|
|
||||||
sub WorkUnitsProcessed {
|
sub WorkUnitsProcessed {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
Loading…
Add table
Reference in a new issue