File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
care/facility/api/viewsets Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -177,13 +177,18 @@ def list(self, request):
177
177
from care .facility .static_data .medibase import MedibaseMedicineTable
178
178
179
179
queryset = MedibaseMedicineTable
180
- try :
181
- limit = min (int (request .query_params .get ("limit" , 30 )), 100 )
182
- except ValueError :
183
- limit = 30
180
+
181
+ if type := request .query_params .get ("type" ):
182
+ queryset = [x for x in queryset if x [2 ] == type ]
184
183
185
184
if query := request .query_params .get ("query" ):
186
185
query = query .strip ().lower ()
187
186
queryset = [x for x in queryset if query in f"{ x [1 ]} { x [3 ]} { x [4 ]} " .lower ()]
188
187
queryset = self .sort (query , queryset )
188
+
189
+ try :
190
+ limit = min (int (request .query_params .get ("limit" , 30 )), 100 )
191
+ except ValueError :
192
+ limit = 30
193
+
189
194
return Response (self .serailize_data (queryset [:limit ]))
You can’t perform that action at this time.
0 commit comments