daker | mhall119, do you know why this http://pastebin.com/iN59biEq returns MultipleObjectsReturned ? | 12:35 |
---|---|---|
mhall119 | daker: duplicate event titles with the same user attending both | 12:36 |
mhall119 | this is very likely to happen with events like "Ubuntu Hour" | 12:37 |
daker | mhall119, how did you fix it ? | 12:37 |
mhall119 | what are you trying to accomplish? | 12:37 |
daker | well i am trying to use get_or_create, if there is an event it's ok if not create one | 12:39 |
daker | event, created = Event.objects.get_or_create(title=title, attendees__name__in=users) | 12:39 |
mhall119 | you'll need to give enough fields to uniquely identify a record | 12:39 |
mhall119 | if title isn't a unique field, you'll need something else | 12:39 |
mhall119 | you can look at loco_directory/common/management/commands/recoverdata.py to see how I was doing it for the recovery script | 12:41 |
daker | ok | 12:42 |
mhall119 | if you might have more than one match, then you should to an if not Event.objects.filter(foo=bar).exists(): | 12:43 |
mhall119 | and then create one | 12:43 |
daker | the problem is that the sql query return two rows | 12:43 |
mhall119 | right, and .get and .get_or_create will throw an error if it matches more than one | 12:44 |
daker | it returns two rows because of attendees__name__in=users | 12:45 |
mhall119 | hang on, is it returning 2 copies of the same Event recort? | 12:45 |
mhall119 | record | 12:45 |
mhall119 | or 2 different Event records? | 12:45 |
daker | 2 records of the same event | 12:46 |
mhall119 | oh, ok..... | 12:46 |
daker | imagine you an event and daker & mhall119 are attending and | 12:46 |
daker | users = [u'daker', u'mhal119'] | 12:47 |
daker | event, created = Event.objects.get(title=title, attendees__name__in=users) | 12:47 |
daker | this will gives two records of the same events | 12:47 |
daker | -s | 12:47 |
mhall119 | ok, then I'm not sure how to fix that | 12:47 |
mhall119 | probably the ManyToMany relationship is making that do unexpected things | 12:48 |
daker | yeah | 12:49 |
mhall119 | so then you might need to do the filter().exists() check first, and if nothing matches then to an .objects.create() | 12:55 |
daker | ok | 12:56 |
mhall119 | nigelb: ping | 19:04 |
nigelb | pong | 19:04 |
mhall119 | nigelb: I added another test case to https://code.launchpad.net/~mhall119/summit/scheduling-testcase/+merge/73926 | 19:04 |
mhall119 | this one checks that we're not mixing private/public rooms and meetings | 19:05 |
nigelb | man, I wish you pinged this to mee when I wasn't sleepy. | 19:05 |
mhall119 | it's currently failing, because we haven't made the autoscheduler aware of private rooms yet | 19:05 |
mhall119 | you're always sleepy :P | 19:05 |
nigelb | its 0030. I should be sleeping. | 19:05 |
nigelb | But I'm a sysadmin. | 19:05 |
mhall119 | boo | 19:06 |
mhall119 | just mark it approved so it'll land, it's only test cases | 19:06 |
mhall119 | as long as your signature is on it, I'm happy | 19:06 |
nigelb | mhall119: I'd like to run the tests to make sure they pass before I approve. | 19:06 |
nigelb | oh wait. | 19:07 |
mhall119 | I just said they don't pass | 19:07 |
nigelb | it fails. | 19:07 |
nigelb | boo. | 19:07 |
mhall119 | the MP is only to add test cases, not new functionality | 19:07 |
nigelb | go | 19:08 |
nigelb | done | 19:08 |
mhall119 | haha, sucker | 19:08 |
mhall119 | I mean, thanks nigelb | 19:08 |
nigelb | lol | 19:08 |
mhall119 | nigelb or cjohnston: https://code.launchpad.net/~mhall119/summit/fix-etherpad-edit-links/+merge/75061 | 20:03 |
mhall119 | that fixed the annoying reverse lookup errors we'd had | 20:03 |
mhall119 | cjohnston: we need the private scheduling test cases passing before we can deploy what's in trunk | 20:05 |
mhall119 | I'll probably add more to them too | 20:05 |
james_w | that's not idea | 20:08 |
james_w | l | 20:08 |
james_w | can I help in making trunk deployable again? | 20:09 |
james_w | I'm being asked for changes that we would want deployed quickly, and so having that blocked isn't good for us | 20:10 |
mhall119 | james_w: we just need to update the autoschedule/reschedule code to be aware of private rooms and not try to schedule public meetings into them | 20:11 |
james_w | private is a flag? | 20:11 |
mhall119 | for uds-p, I'd be okay if we just plain didn't auto-schedule private meetings or private rooms | 20:11 |
james_w | it's not a type like "openly scheduled"? | 20:11 |
mhall119 | type='private' | 20:11 |
mhall119 | meetings have a private=True field | 20:12 |
nigelb | mhall119: that's like a one-line changing? | 20:12 |
mhall119 | but rooms use a type | 20:12 |
mhall119 | nigelb: possibly | 20:12 |
nigelb | *change | 20:12 |
mhall119 | I just wrote the tests for it | 20:12 |
mhall119 | you're more familiar with the scheduler itself | 20:12 |
james_w | I'll take a look | 20:12 |
mhall119 | TDD | 20:12 |
nigelb | Is the code that got chcked in that UDS? | 20:13 |
nigelb | Or was that rescheduler? :P | 20:13 |
mhall119 | that was reschedule | 20:13 |
james_w | I don't see a test failure on trunk? | 20:15 |
mhall119 | it's not in trunk yet | 20:16 |
mhall119 | wait, yes it is | 20:16 |
mhall119 | you're not seeing a failure? | 20:16 |
james_w | nope | 20:17 |
nigelb | lol. | 20:17 |
nigelb | WIN. | 20:17 |
mhall119 | :( | 20:17 |
mhall119 | james_w: how are you running the tests? | 20:17 |
james_w | def try_schedule(self): | 20:18 |
james_w | """Try to schedule this meeting in a suitable room.""" | 20:18 |
james_w | open_rooms = self.summit.room_set.filter(type__exact='open') | 20:18 |
james_w | ./manage.py test | 20:18 |
james_w | so autoschedule already skips private rooms | 20:18 |
james_w | it does look like it will happily schedule private sessions in to public rooms though | 20:20 |
mhall119 | yeah | 20:20 |
james_w | and I'm not really sure what reschedule should do | 20:20 |
james_w | given that you can only schedule private rooms manually it should never delete an agenda item for one, so I think we're fine there too | 20:21 |
mhall119 | oh, my tests are wrong | 20:21 |
mhall119 | nigelb: I can't believe you approved bad tests | 20:22 |
nigelb | mhall119: under threat and duress | 20:22 |
mhall119 | a likely excuse | 20:24 |
=== Ronnie2 is now known as Ronnie | ||
mhall119 | james_w: can you merge in lp:~mhall119/summit/fixes-to-private-scheduling-tests and see if you get failing tests | 20:38 |
mhall119 | I'm still getting one test that fails, looks like a private meeting is being autoscheduled into an open room | 20:41 |
james_w | still no failure | 20:41 |
mhall119 | are you running in a virtualenv? | 20:41 |
james_w | no | 20:42 |
mhall119 | maybe that's the difference....but they should still fail | 20:42 |
mhall119 | well, the one should | 20:42 |
james_w | seems it's not running these tests? | 20:42 |
mhall119 | try python manage.py test schedule.PrivateSchedulingTestCase | 20:42 |
james_w | ValueError: Test label 'schedule.PrivateSchedulingTestCase' does not refer to a test | 20:43 |
mhall119 | well....that's interesting | 20:43 |
mhall119 | so you see that in summit/schedule/tests.py ? | 20:43 |
=== Ronnie1 is now known as Ronnie | ||
james_w | hmm, looks like it may be a missing dependency | 20:45 |
james_w | model_mommy | 20:45 |
mhall119 | yeah, surprised that didn't throw an error for you though | 20:45 |
james_w | again django's test infrastructure leaves a lot to be desired | 20:46 |
james_w | model_mommy doesn't seem to be packaged? | 20:46 |
mhall119 | you can install it with pip | 20:46 |
mhall119 | best to setup a virtualenv | 20:46 |
mhall119 | then pip install -r requirements.txt from within that | 20:47 |
james_w | getting errors installing the requirements in a virtualenv | 21:09 |
mhall119 | :/ | 21:09 |
mhall119 | on what? | 21:09 |
james_w | first BeautifulSoup | 21:09 |
james_w | which I just deleted from the file | 21:10 |
mhall119 | I don't think we need that anymore | 21:10 |
james_w | no psycopg2 | 21:10 |
mhall119 | no? | 21:10 |
james_w | warning: manifest_maker: standard file '-c' not found | 21:10 |
james_w | error: No such file or directory | 21:10 |
james_w | now, sorry | 21:10 |
mhall119 | oh, I think that needs dev headers installed system-wide | 21:10 |
nigelb | do you have python-dev? | 21:10 |
nigelb | (gah, to slow :P) | 21:11 |
nigelb | *too | 21:11 |
mhall119 | james_w: I think you need libpq-dev | 21:11 |
mhall119 | do compile the postgres driver for the virtualenv | 21:11 |
james_w | pq or pg? | 21:12 |
mhall119 | pq | 21:12 |
mhall119 | weird, I know | 21:12 |
james_w | ok | 21:12 |
james_w | I have to leave now | 21:12 |
mhall119 | ok | 21:12 |
james_w | I'll continue with this tomorrow | 21:12 |
james_w | thanks for the help | 21:12 |
nigelb | james_w: thank you for stopping by :) | 21:13 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!