aboutsummaryrefslogtreecommitdiffstats
path: root/notes/states.txt
blob: 2b204cd4a8a79456a83b8be451df4e634222991d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Problems exist in four broad state categories:
    unconfirmed - the report has been made but the user hasn't clicked
the confirmation link.
    open - the report has been confirmed
    fixed - exactly what it says
    closed - a registered user from a council has marked the problem as
closed

When a problem is created it will be unconfirmed, The problem
becomes confirmed when the user clicks on the link sent to them in
the confirmation email. 

If a problem is uploaded from a mobile app then it is initally 
created with a state of partial.

If a user is logged in then any problem they create is confirmed
automatically.

If a council user is logged in then they can change the state of the 
problem to one of the following provifing they are from the council that
the problem has been reported to:
    Open ( a synonym for confirmed )
    Investigating
    Planned
    In Progress
    Fixed
    Closed

Updates from council users will have the name of the council they
are from included in the meta information for that update.

Any user of the sytem can mark a problem as fixed.

If a problem has been marked as fixed then the user who created the
problem can reopen the problem by checking the 'This problem has not
been fixed' checkbox when submitting an update.

If a problem has been closed it may only be re-opened by a council
user although it can still be updated.

Internally there are three states for fixed problems:
    fixed : problems marked as fixed before the addition of extra states
    fixed - user : marked as fixed by a standard site user
    fixed - council : marked as fixed by a council user

At the moment there is no visible difference between these fixed states.

If you need to check the state of a problem then there are a set of
utility functions in DB/Result/Problem.pm to do that. If you have a
problem object then these can be called directly on it:

    $problem->is_visible
    $problem->is_fixed
    $problem->is_open
    $problem->is_closed

The is_visible method returns true if a problem should be displayed
on the site - i.e it has been confirmed.

You can also get a list of the states in a particular category by 
calling one of the following class methods:

    visible_states
    open_states
    closed_states
    fixed_states

Which will return a list of state strings in list context or a 
hash reference in scalar context which you can use like this:

    if ( FixMyStreet::App->model('DB::Problem')->open_states->{$state}
) {
        print "$state is open\n";
    }