Skip to content
Snippets Groups Projects
Commit b67e508f authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

filter for pubs in compounds list is >cutoff value, not <

cf #67


Former-commit-id: b28c53e4ac700a6b5ec0c9b2c6e8bf263f4cd24a
parent 406b6242
No related branches found
No related tags found
No related merge requests found
......@@ -137,13 +137,13 @@ class IppiWizard(NamedUrlSessionWizardView):
})
def process_cutoff_value(name, context, request, annotation=None):
def process_cutoff_value(name, context, request, cutoff_dir='l'):
c = context['compounds']
context[name+'_max'] = str(int(math.ceil(float(c.aggregate(Max(name))[name + '__max']))))
context[name+'_min'] = str(int(math.floor(float(c.aggregate(Min(name))[name + '__min']))))
if request.GET.get(name):
context[name] = request.GET.get(name)
filter_dict = {name + '__lte': context[name]}
filter_dict = {name + '__' + cutoff_dir + 'te': context[name]}
context['compounds'] = context['compounds'].filter(**filter_dict)
else:
context[name] = context[name+'_max']
......@@ -170,7 +170,7 @@ def compound_list(request):
context = process_cutoff_value('molecular_weight', context, request)
context = process_cutoff_value('a_log_p', context, request)
context = process_cutoff_value('nb_donor_h', context, request)
context = process_cutoff_value('pubs', context, request)
context = process_cutoff_value('pubs', context, request, 'g')
selected_families = PpiFamily.objects.filter(id__in=request.GET.getlist('family'))
families = PpiFamily.objects.exclude(id__in=request.GET.getlist('family'))
selected_ppis = Ppi.objects.filter(id__in=request.GET.getlist('ppi'))
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment