From f9db277a72fece83bd9fed77c793a73b7e3d8360 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 1 Jun 2017 09:38:35 +0200 Subject: UNINITIALIZED always has ID 0 --- lib/Kratos/DFADriver/Model.pm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/Kratos/DFADriver/Model.pm') diff --git a/lib/Kratos/DFADriver/Model.pm b/lib/Kratos/DFADriver/Model.pm index aff44cf..216f3b8 100644 --- a/lib/Kratos/DFADriver/Model.pm +++ b/lib/Kratos/DFADriver/Model.pm @@ -144,6 +144,10 @@ sub new_from_repo { @states = uniq @states; @states = sort @states; + # by convention, UNINITIALIZED always has ID 0 + @states = grep { $_ ne 'UNINITIALIZED' } @states; + unshift( @states, 'UNINITIALIZED' ); + for my $i ( 0 .. $#states ) { $self->{state}{ $states[$i] } = { id => $i, -- cgit v1.2.3