Code review comment for lp:~doanac/lava-scheduler/failure-reporting

Revision history for this message
Andy Doan (doanac) wrote :

All comments addressed in latest push.

On 01/02/2013 07:46 PM, Michael Hudson-Doyle wrote:
>> + dt = request.GET.get('device_type', None)
>> >+ if dt:
>> >+ jobs = jobs.filter(actual_device__device_type=dt)
> Does this work? I'd have thought that dt would need to be an actual
> DeviceType object here. Or that you'd have to say
> actual_device__device_type__name=dt or something.

It did actually work, but I went ahead and fixed it. I guess django did
some coercion for me, but making this explicit is best.

>> >+ device = request.GET.get('device', None)
>> >+ if device:
>> >+ jobs = jobs.filter(actual_device__hostname=device)
>> >+
>> >+ start = request.GET.get('start', None)
>> >+ if start:
>> >+ now = datetime.datetime.now()
>> >+ start = now + datetime.timedelta(int(start))
>> >+
>> >+ end = request.GET.get('end', None)
>> >+ if end:
>> >+ end = now + datetime.timedelta(int(end))
>> >+ jobs = jobs.filter(start_time__range=(start, end))
> So if you specify start but not end, there is no filtering? I guess
> that's OK.

Yeah - that sucks. I thought about making the parameter be "range", but
then you wind up with some odd syntax requirement in a URL.

« Back to merge proposal