Fix in webmodel and webmodel test

This commit is contained in:
Antonio de la Rosa 2018-08-30 13:52:13 +02:00
parent 191f373458
commit 2e9fa5fa8d
2 changed files with 11 additions and 5 deletions

View file

@ -609,7 +609,13 @@ class WebModel:
# Array intersect for obtain the valid fields
fields = list(set(keys) & set(arr_select))
#fields = list(set(keys) & set(arr_select))
fields=[ select for select in arr_select if select in keys ]
"""
for select in arr_select:
if select in keys:
fields.append(select)
"""
#Creating the fields
arr_repeat_field={}
@ -758,7 +764,7 @@ class WebModel:
def select_to_array(self, fields_selected=[], raw_query=0):
if len(fields_selected)==0:
fields_selected=self.fields.keys()
fields_selected=list(self.fields.keys())
if (self.name_field_id not in fields_selected):
fields_selected.append(self.name_field_id)
@ -804,7 +810,7 @@ class WebModel:
return str(index)
if len(fields_selected)==0:
fields_selected=self.fields.keys()
fields_selected=list(self.fields.keys())
if (self.name_field_id not in fields_selected):
fields_selected.append(self.name_field_id)

View file

@ -83,7 +83,7 @@ class TestWebModelMethods(unittest.TestCase):
print('Select a row')
self.assertEqual(model.select_a_row(1, ['title']), {'title': 'Example title Updated'})
self.assertEqual(model.select_a_row(1, ['title', 'inexistent_field']), {'title': 'Example title Updated'})
print('Select a row with different conditions to search id')