Skip to content

Commit

Permalink
[SSE] Fix list of recent functions
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Apr 11, 2024
1 parent 30b446f commit 8ffe79d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions apps/spreadsheeteditor/main/app/controller/FormulaDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,24 @@ define([
loadingLast10Formulas: function(descrarr) {
var arr = (Common.Utils.InternalSettings.get("sse-settings-func-last") || 'SUM;AVERAGE;IF;HYPERLINK;COUNT;MAX;SIN;SUMIF;PMT;STDEV').split(';'),
separator = this.api.asc_getFunctionArgumentSeparator(),
functions = [];
functions = [],
allFunctionsGroup = this.formulasGroups ? this.formulasGroups.findWhere({name : 'All'}) : null,
allFunctions = allFunctionsGroup ? allFunctionsGroup.get('functions') : null;

for (var j = 0; j < arr.length; j++) {
var funcname = arr[j],
custom = descrarr && descrarr[funcname] ? null : this.api.asc_getCustomFunctionInfo(funcname),
name = this.api.asc_getFormulaLocaleName(funcname);
name && functions.push(new SSE.Models.FormulaModel({
desc = (descrarr && descrarr[funcname]) ? descrarr[funcname].d : custom ? custom.asc_getDescription() || '' : '';

if (!desc && allFunctions && !_.find(allFunctions, function(item){ return item.get('origin')===funcname; }))
continue;
functions.push(new SSE.Models.FormulaModel({
index : j,
group : 'Last10',
name : name,
name : this.api.asc_getFormulaLocaleName(funcname),
origin: funcname,
args : ((descrarr && descrarr[funcname]) ? descrarr[funcname].a : '').replace(/[,;]/g, separator),
desc : (descrarr && descrarr[funcname]) ? descrarr[funcname].d : custom ? custom.asc_getDescription() || '' : ''
desc : desc
}));
}
return functions;
Expand Down Expand Up @@ -349,7 +355,6 @@ define([
caption : this['sCategory' + ascGroupName] || ascGroupName
});
if (last10FunctionsGroup) {
last10FunctionsGroup.set('functions', this.loadingLast10Formulas(descrarr));
store.push(last10FunctionsGroup);
index += 1;
}
Expand Down Expand Up @@ -408,6 +413,8 @@ define([

allFunctionsGroup.set('functions',
_.sortBy(allFunctions, function (model) {return model.get('name'); }));

last10FunctionsGroup && last10FunctionsGroup.set('functions', this.loadingLast10Formulas(descrarr));
}
}
(!suppressEvent || this._formulasInited) && this.formulaTab && this.formulaTab.fillFunctions();
Expand Down

0 comments on commit 8ffe79d

Please sign in to comment.