Fix in webmodel and webmodel test
This commit is contained in:
parent
191f373458
commit
2e9fa5fa8d
2 changed files with 11 additions and 5 deletions
|
|
@ -609,8 +609,14 @@ class WebModel:
|
||||||
|
|
||||||
# Array intersect for obtain the valid fields
|
# 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
|
#Creating the fields
|
||||||
arr_repeat_field={}
|
arr_repeat_field={}
|
||||||
|
|
||||||
|
|
@ -758,7 +764,7 @@ class WebModel:
|
||||||
def select_to_array(self, fields_selected=[], raw_query=0):
|
def select_to_array(self, fields_selected=[], raw_query=0):
|
||||||
|
|
||||||
if len(fields_selected)==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):
|
if (self.name_field_id not in fields_selected):
|
||||||
fields_selected.append(self.name_field_id)
|
fields_selected.append(self.name_field_id)
|
||||||
|
|
@ -804,7 +810,7 @@ class WebModel:
|
||||||
return str(index)
|
return str(index)
|
||||||
|
|
||||||
if len(fields_selected)==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):
|
if (self.name_field_id not in fields_selected):
|
||||||
fields_selected.append(self.name_field_id)
|
fields_selected.append(self.name_field_id)
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ class TestWebModelMethods(unittest.TestCase):
|
||||||
|
|
||||||
print('Select a row')
|
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')
|
print('Select a row with different conditions to search id')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue