const.py 3.19 KB
Newer Older
1
from collections import namedtuple
2
from django.utils.translation import gettext_lazy as _
3

Chris Lamb's avatar
Chris Lamb committed
4
Status = namedtuple("Status", ("code", "tag", "sdesc", "pronoun", "ldesc"))
Enrico Zini's avatar
Enrico Zini committed
5
Progress = namedtuple("Progress", ("code", "tag", "sdesc", "ldesc"))
6

7
8
9
10
g = globals()

# Status of a person in Debian
ALL_STATUS = (
11
12
13
14
15
16
17
18
    Status("STATUS_DC",            "dc",      "DC",            _("a"), _("Debian Contributor")),
    Status("STATUS_DC_GA",         "dc_ga",   "DC+account",    _("a"), _("Debian Contributor, with guest account")),
    Status("STATUS_DM",            "dm",      "DM",            _("a"), _("Debian Maintainer")),
    Status("STATUS_DM_GA",         "dm_ga",   "DM+account",    _("a"), _("Debian Maintainer, with guest account")),
    Status("STATUS_DD_U",          "dd_u",    "DD, upl.",      _("a"), _("Debian Developer, uploading")),
    Status("STATUS_DD_NU",         "dd_nu",   "DD, non-upl.",  _("a"), _("Debian Developer, non-uploading")),
    Status("STATUS_EMERITUS_DD",   "dd_e",    "DD, emeritus",  _("a"), _("Debian Developer, emeritus")),
    Status("STATUS_REMOVED_DD",    "dd_r",    "DD, removed",   _("a"), _("Debian Developer, removed")),
19
)
20
ALL_STATUS_DESCS = dict((x.tag, x.ldesc) for x in ALL_STATUS)
Chris Lamb's avatar
Chris Lamb committed
21
22
ALL_STATUS_DESCS_WITH_PRONOUN = dict(
    (x.tag, '{} {}'.format(x.pronoun, x.ldesc)) for x in ALL_STATUS)
Enrico Zini's avatar
Enrico Zini committed
23
ALL_STATUS_BYTAG = dict((x.tag, x) for x in ALL_STATUS)
24
25
for s in ALL_STATUS:
    g[s.code] = s.tag
26

27
SEQ_STATUS = dict(((y.tag, x) for x, y in enumerate(ALL_STATUS)))
Enrico Zini's avatar
Enrico Zini committed
28

29
30
# Progress of a person in a process
ALL_PROGRESS = (
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
    Progress("PROGRESS_APP_NEW",   "app_new",   _("Applied"),     _("Applicant asked to enter the process")),
    Progress("PROGRESS_APP_RCVD",  "app_rcvd",  _("Validated"),   _("Applicant replied to initial mail")),
    Progress("PROGRESS_APP_HOLD",  "app_hold",  _("App hold"),    _("On hold before entering the queue")),
    Progress("PROGRESS_ADV_RCVD",  "adv_rcvd",  _("Adv ok"),      _("Received enough advocacies")),
    Progress("PROGRESS_POLL_SENT", "poll_sent", _("Poll sent"),   _("Activity poll sent")),
    Progress("PROGRESS_APP_OK",    "app_ok",    _("App ok"),      _("Advocacies have been approved")),
    Progress("PROGRESS_AM_RCVD",   "am_rcvd",   _("AM assigned"), _("Waiting for AM to confirm")),
    Progress("PROGRESS_AM",        "am",        _("AM"),          _("Interacting with an AM")),
    Progress("PROGRESS_AM_HOLD",   "am_hold",   _("AM hold"),     _("AM hold")),
    Progress("PROGRESS_AM_OK",     "am_ok",     _("AM ok"),       _("AM approved")),
    Progress("PROGRESS_FD_HOLD",   "fd_hold",   _("FD hold"),     _("FD hold")),
    Progress("PROGRESS_FD_OK",     "fd_ok",     _("FD ok"),       _("FD approved")),
    Progress("PROGRESS_DAM_HOLD",  "dam_hold",  _("DAM hold"),    _("DAM hold")),
    Progress("PROGRESS_DAM_OK",    "dam_ok",    _("DAM ok"),      _("DAM approved")),
    Progress("PROGRESS_DONE",      "done",      _("Done"),        _("Completed")),
    Progress("PROGRESS_CANCELLED", "cancelled", _("Cancelled"),   _("Cancelled")),
47
)
48
ALL_PROGRESS_DESCS = dict((x.tag, x.ldesc) for x in ALL_PROGRESS)
Enrico Zini's avatar
Enrico Zini committed
49
ALL_PROGRESS_BYTAG = dict((x.tag, x) for x in ALL_PROGRESS)
50
51
for p in ALL_PROGRESS:
    g[p.code] = p.tag
52

53
SEQ_PROGRESS = dict(((y.tag, x) for x, y in enumerate(ALL_PROGRESS)))