Skip to content

Commit d741efb

Browse files
committed
fixed bug where sometimes translated language of options array did not match query language, fixed #10
1 parent a873282 commit d741efb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/api/api/MissionTypeLoader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import api.models
22
import logging
3+
4+
import copy
35
from i18n import I18n
46
import traceback
57

@@ -44,7 +46,7 @@ def get_input_type(self, lang, type_id, input_type_name, re_description, re, low
4446
'lowerBound': lower_bound or '',
4547
'upperBound': upper_bound or ''
4648
},
47-
'options': locale.translate_list(lang, self.options.get(type_id, [])),
49+
'options': locale.translate_list(lang, copy.deepcopy(self.options.get(type_id, []))),
4850
'values': self.values.get(type_id, []),
4951
'name': locale.translate(lang, input_type_name)
5052
}

src/api/api/models.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env python3
22
import logging
3+
4+
import copy
35
from sqlalchemy import Column, DateTime, String, Integer, BigInteger, Boolean, create_engine, UniqueConstraint, Numeric
46
from sqlalchemy import ForeignKey
57
from sqlalchemy import PrimaryKeyConstraint
@@ -114,9 +116,9 @@ def dump(self, language):
114116
d['title'] = locale.translate(lang, d['title'])
115117

116118
input_type = MissionTypeLoader()
117-
d['inputType'] = input_type.get_input_type(lang=lang, type_id=d['error_type'], input_type_name= d.pop('view_type'),
119+
d['inputType'] = copy.deepcopy(input_type.get_input_type(lang=lang, type_id=d['error_type'], input_type_name= d.pop('view_type'),
118120
re_description=d.pop('constraint_re_description'), re=d.pop('constraint_re'),
119-
lower_bound=d.pop('constraint_lower_bound'), upper_bound=d.pop('constraint_upper_bound'))
121+
lower_bound=d.pop('constraint_lower_bound'), upper_bound=d.pop('constraint_upper_bound')))
120122
return d
121123

122124

0 commit comments

Comments
 (0)