hasadna / Open-Knesset

A project aimed at making the Israeli Knesset more transparent. Python and Django based
http://oknesset.org/
BSD 3-Clause "New" or "Revised" License
106 stars 175 forks source link

שגיאה בהזנת קריא שלישית להצ"ח #799

Closed maryLoi closed 7 years ago

maryLoi commented 7 years ago

מנסה להזין קריאה שלישית ומקבלת שגיאה. משתחזר כל פעם. לא קורה אם אני מזינה הצבעה אחרת חוק חובת המכרזים תיקון - העדפה במכרזים לעסקים קטנים ובינוניים

image


עמוד שגיאה image

OriHoch commented 7 years ago

I'm working on it

OriHoch commented 7 years ago

The relevant error -

IntegrityError: duplicate key value violates unique constraint "laws_bill_approval_vote_id_key"
DETAIL:  Key (approval_vote_id)=(10449) already exists.
OriHoch commented 7 years ago

the exception is from bill.update stage

/oknesset_data/oknesset/Open-Knesset/laws/models/bill.pyc in update_stage(self, force_update)
    323                 self.stage = BillStages.FAILED_APPROVAL
    324             self.stage_date = self.approval_vote.time.date()
--> 325             self.save()
    326             return
    327         for cm in self.second_committee_meetings.all():

/oknesset_data/oknesset/Open-Knesset/laws/models/bill.pyc in save(self, **kwargs)
    179         else:
    180             self.full_title = self.title
--> 181         super(Bill, self).save(**kwargs)
    182         for mk in self.proposers.all():
    183             mk.recalc_bill_statistics()
OriHoch commented 7 years ago

but it happens also when just manually setting approvel_vote and saving the bill

In [8]: bill
Out[8]: <Bill: חוק חובת המכרזים תיקון - העדפה במכרזים לעסקים קטנים ובינוניים (First Vote)>

In [9]: vote
Out[9]: <Vote: אישור החוק - הצעת חוק חובת המכרזים (תיקון מס` 25), התשע"ו-2016 (יום חמישי 04 אוגוסט 2016  02:18)>

In [10]: bill.approval_vote = vote
In [12]: bill.save()
---------------------------------------------------------------------------
IntegrityError                            Traceback (most recent call last)
OriHoch commented 7 years ago

@maryLoi - The specific problem in this case is that the vote is already attached to another bill: https://www.oknesset.org/bill/3003/

Currently we have a constraint that an approval vote must be attached to exactly one bill

If you delete this vote from the other bill you will be able to add it to this bill..

I opened a follow-up issue to make the error page more user friendly - #805