Skip to content

Commit

Permalink
renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
vokimon committed Jan 25, 2022
1 parent 9997d51 commit 600314d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions tomatic/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,12 @@ def yamlinfoerror(code, message, *args, **kwds):

@app.get('/api/info/{field}/{value}')
def getInfoPersonBy(field, value):
decoded_field = urllib.parse.unquote(value)
decoded_value = urllib.parse.unquote(value)
data = None
with erp() as O:
callinfo = CallInfo(O)
try:
data = callinfo.getByField(field, decoded_field, shallow=True)
data = callinfo.getByField(field, decoded_value, shallow=True)
except ValueError:
return yamlinfoerror('error_getBy'+field.title(),
"Getting information searching {}='{}'.", field, value)
Expand Down
21 changes: 11 additions & 10 deletions tomatic/static/components/callinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,23 +190,24 @@ CallInfo.getExtras = function (extras) {
};

CallInfo.filteredTopics = function(filter) {
var call_reasons = CallInfo.call_reasons;
function contains(value) {
var contains = value.toLowerCase().includes(filter.toLowerCase());
return contains;
function matches_search(value) {
return value.toLowerCase().includes(filter.toLowerCase());
}
var list_reasons = [].concat(
var call_reasons = CallInfo.call_reasons;
var topics = [].concat(
call_reasons.infos,
call_reasons.general,
);

if (filter === "") {
return list_reasons
return topics
}
var filtered_regular = list_reasons.filter(contains);
var filtered_extras = call_reasons.extras.filter(contains);
var extras = CallInfo.getExtras(filtered_extras);
return filtered_regular.concat(extras);
var topics_by_name = topics.filter(matches_search);
var filtered_keywords = call_reasons.extras.filter(matches_search);
var topics_by_keyword = filtered_keywords.map(function(keyword) {
return CallInfo.extras_dict[keyword];
})
return topics_by_name.concat(topics_by_keyword);
};

function isEmpty(obj) {
Expand Down
4 changes: 2 additions & 2 deletions tomatic/static/components/callinfopage.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ var responsesMessage = function(info) {
);
}

var atencionsLog = function() {
var attendedCallList = function() {
var aux = [];
if (CallInfo.callLog.length === 0) {
return m(".attended-calls-list", m(List, {
Expand Down Expand Up @@ -276,7 +276,7 @@ var attendedCalls = function() {
}},{
text: {
content: (CallInfo.callLog[0] === "lookingfor" ?
m('center', m(Spinner, { show: "true" } )) : atencionsLog())
m('center', m(Spinner, { show: "true" } )) : attendedCallList())
}},
]
});
Expand Down

0 comments on commit 600314d

Please sign in to comment.