fixed too small fractions dissappearing
This commit is contained in:
parent
0a0c0b069f
commit
2ce06a8154
@ -170,6 +170,10 @@ export function calculateAmount(amount, factor) {
|
|||||||
let return_string = ""
|
let return_string = ""
|
||||||
let fraction = frac(amount * factor, 10, true)
|
let fraction = frac(amount * factor, 10, true)
|
||||||
|
|
||||||
|
if (fraction[0] === 0 && fraction[1] === 0 && fraction[2] === 1) {
|
||||||
|
return roundDecimals(amount * factor)
|
||||||
|
}
|
||||||
|
|
||||||
if (fraction[0] > 0) {
|
if (fraction[0] > 0) {
|
||||||
return_string += fraction[0]
|
return_string += fraction[0]
|
||||||
}
|
}
|
||||||
@ -288,6 +292,7 @@ function formatParam(config, value, options) {
|
|||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildParams(options, setup) {
|
function buildParams(options, setup) {
|
||||||
let config = setup?.config ?? {}
|
let config = setup?.config ?? {}
|
||||||
let params = setup?.params ?? []
|
let params = setup?.params ?? []
|
||||||
@ -315,6 +320,7 @@ function buildParams(options, setup) {
|
|||||||
})
|
})
|
||||||
return parameters
|
return parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDefault(config, options) {
|
function getDefault(config, options) {
|
||||||
let value = undefined
|
let value = undefined
|
||||||
value = config?.default ?? undefined
|
value = config?.default ?? undefined
|
||||||
@ -342,6 +348,7 @@ function getDefault(config, options) {
|
|||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getConfig(model, action) {
|
export function getConfig(model, action) {
|
||||||
let f = action.function
|
let f = action.function
|
||||||
// if not defined partialUpdate will use params from create
|
// if not defined partialUpdate will use params from create
|
||||||
@ -411,6 +418,7 @@ export function getForm(model, action, item1, item2) {
|
|||||||
}
|
}
|
||||||
return form
|
return form
|
||||||
}
|
}
|
||||||
|
|
||||||
function formTranslate(translate, model, item1, item2) {
|
function formTranslate(translate, model, item1, item2) {
|
||||||
if (typeof translate !== "object") {
|
if (typeof translate !== "object") {
|
||||||
return i18n.t(translate)
|
return i18n.t(translate)
|
||||||
|
Loading…
Reference in New Issue
Block a user