use old system to define frontend settings
This commit is contained in:
@ -148,20 +148,15 @@ export function resolveDjangoUrl(url, params = null) {
|
|||||||
/*
|
/*
|
||||||
* other utilities
|
* other utilities
|
||||||
* */
|
* */
|
||||||
export function getUserPreference(pref = undefined) {
|
export function getUserPreference(pref) {
|
||||||
let user_preference
|
if (window.USER_PREF === undefined) {
|
||||||
if (document.getElementById("user_preference")) {
|
|
||||||
user_preference = JSON.parse(document.getElementById("user_preference").textContent)
|
|
||||||
} else {
|
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
if (pref) {
|
return window.USER_PREF[pref]
|
||||||
return user_preference[pref]
|
|
||||||
}
|
|
||||||
return user_preference
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculateAmount(amount, factor) {
|
export function calculateAmount(amount, factor) {
|
||||||
|
console.log('converting, getting pref' , getUserPreference("use_fractions"))
|
||||||
if (getUserPreference("use_fractions")) {
|
if (getUserPreference("use_fractions")) {
|
||||||
let return_string = ""
|
let return_string = ""
|
||||||
let fraction = frac(amount * factor, 10, true)
|
let fraction = frac(amount * factor, 10, true)
|
||||||
|
Reference in New Issue
Block a user