mysociety / pombola

GNU Affero General Public License v3.0
65 stars 41 forks source link

KE: Member of Parliament at an Organisation other than Parliament #2064

Closed tmtmtmtm closed 8 years ago

tmtmtmtm commented 8 years ago
  id  |            legal_name            |                  organisation                  |              role              
------+----------------------------------+------------------------------------------------+--------------------------------
  240 | Onesmus Kihara Mwangi            | Democratic Party                               | Member of Parliament
  284 | Richard Maoka Maore              | Democratic Party                               | Member of Parliament
  484 | Augustine Chemonges Loile Lotodo | East Africa Legislative Assembly (EALA), Kenya | Member of Parliament
   93 | Kiraitu Murungi                  | Forum For The Restoration Of Democracy         | Member of Parliament
  180 | James Omingo Magara              | Forum For The Restoration Of Democracy - Kenya | Member of Parliament
  180 | James Omingo Magara              | Forum for Restoration and Democracy- People    | Member of Parliament
  223 | Mwangi Kirika Waithaka           | Forum for Restoration and Democracy- People    | Member of Parliament
  255 | Boniface Mganga                  | Kenya African National Union                   | Member of Parliament
  281 | John Mutua Katuku                | Kenya African National Union                   | Member of Parliament
  312 | Musa Cherutich Sirma             | Kenya African National Union                   | Member of Parliament
  342 | Simeon Nyachae                   | Kenya African National Union                   | Member of Parliament
 2069 | Shaaban Ali Isaack               | Mandera East Constituency                      | Member of Parliament
  194 | Oburu Ngona Odinga               | National Development Party (NDP)               | Member of Parliament
  347 | Ochilo George Mbogo Ayacko       | National Development Party (NDP)               | Member of Parliament
    9 | Najib Mohamed Balala             | National Rainbow Coalition                     | Member of Parliament
  194 | Oburu Ngona Odinga               | National Rainbow Coalition                     | Member of Parliament
  196 | Sospeter Odeke Ojaamongson       | National Rainbow Coalition                     | Member of Parliament
  247 | Morris Mwachondo Dzoro           | National Rainbow Coalition                     | Member of Parliament
  360 | Adelina Ndeto Mwau               | REPUBLIC OF KENYA                              | Member of Parliament
  758 | Boy Juma Boy                     | REPUBLIC OF KENYA                              | Member of Parliament
  147 | Ferdinand Ndung'u Waititu        | The National Alliance (TNA)                    | Member of Parliament
  380 | Shakila Abdalla                  | REPUBLIC OF KENYA                              | Nominated Member of Parliament

via

SELECT mp.id, mp.legal_name, o.name AS organisation, t.name AS role
  FROM core_person mp
  LEFT JOIN core_position p ON mp.id = p.person_id
  LEFT JOIN core_positiontitle t ON p.title_id = t.id
  LEFT JOIN core_organisation o ON p.organisation_id = o.id
 WHERE t.name ILIKE '%Member of Parliament%'
   AND o.name != 'Parliament'
 ORDER BY t.name, o.name, mp.id
duncanparkes commented 8 years ago

Really don't run the following in python manage.py shell:


from pombola.core.models import Position
from pombola.core.models import Organisation

parliament = Organisation.objects.get(name='Parliament')

mps = Position.objects.filter(title__name__icontains='member of parliament').exclude(organisation__name='Parliament')
for mp in mps:
    mp.organisation = parliament
    mp.save()
mhl commented 8 years ago

The current examples of this problem have been fixed, and this check is now being done every night in kenya_check_for_recurring_problems.