багфиксы: сборка и число с запятыми на некоторых локалях в вебке

This commit is contained in:
Vladislav Ostapov 2025-04-01 17:47:08 +03:00
parent 1b6b8b5329
commit 17110a82e0
5 changed files with 43 additions and 16 deletions

View File

@ -26,9 +26,9 @@
let snr; let snr;
if (isNaN(calcSnr)) { snr = `ОСШ=?` } else { snr=`ОСШ=${calcSnr}` } if (isNaN(calcSnr)) { snr = `ОСШ=?` } else { snr=`ОСШ=${calcSnr}` }
if (result > 1024) { if (result > 1024) {
return (result / 1024).toLocaleString() + ' Мбит/с; ' + snr return toLocaleStringWithSpaces(result / 1024) + ' Мбит/с; ' + snr
} else { } else {
return result.toLocaleString() + ' кбит/с; ' + snr return toLocaleStringWithSpaces(result) + ' кбит/с; ' + snr
} }
}, },
{% endif %} {% endif %}

View File

@ -75,6 +75,18 @@
return availableTabs[0] return availableTabs[0]
} }
function toLocaleStringWithSpaces(num) {
if (typeof num !== 'number') {
if (typeof num === 'string') { return num }
return String(num);
}
const numberString = num.toString()
const [integerPart, fractionalPart] = numberString.split('.')
const spacedIntegerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, " ")
if (fractionalPart) { return `${spacedIntegerPart}.${fractionalPart}` }
else { return spacedIntegerPart }
}
const app = Vue.createApp({ const app = Vue.createApp({
data() { data() {
return { return {
@ -161,7 +173,7 @@
result = Math.round(result / step) * step result = Math.round(result / step) * step
if ('min' in validation) { if (result <= validation['min']) { result = validation['min'] } } if ('min' in validation) { if (result <= validation['min']) { result = validation['min'] } }
if ('max' in validation) { if (result >= validation['max']) { result = validation['max'] } } if ('max' in validation) { if (result >= validation['max']) { result = validation['max'] } }
return result.toLocaleString() return toLocaleStringWithSpaces(result)
}, },
// ========== include from 'common/all-params-methods.js.j2' // ========== include from 'common/all-params-methods.js.j2'

View File

@ -1073,11 +1073,6 @@ std::string api_driver::ApiDriver::loadSettings() const {
result << ",\"dpdiDelay\":" << dpdiSettings.max_delay; result << ",\"dpdiDelay\":" << dpdiSettings.max_delay;
#endif #endif
#ifdef MODEM_IS_TDMA
result << ",\n\"rxTxSatDelay\":" << static_cast<int>(demodSettings.delay_ms);
#endif
result << ",\n\"rxAgcEn\":" << boolAsStr(demodSettings.is_aru_on); result << ",\n\"rxAgcEn\":" << boolAsStr(demodSettings.is_aru_on);
result << ",\"rxSpectrumInversion\":" << boolAsStr(demodSettings.is_rvt_iq); result << ",\"rxSpectrumInversion\":" << boolAsStr(demodSettings.is_rvt_iq);
result << ",\"rxManualGain\":"; writeDouble(result, demodSettings.gain); result << ",\"rxManualGain\":"; writeDouble(result, demodSettings.gain);
@ -1209,10 +1204,6 @@ void api_driver::ApiDriver::setRxTxSettings(boost::property_tree::ptree &pt) {
demod.gold_seq_is_active = pt.get<unsigned int>("rxGoldan"); demod.gold_seq_is_active = pt.get<unsigned int>("rxGoldan");
#endif #endif
#ifdef MODEM_IS_TDMA
demod.delay_ms = pt.get<unsigned int>("rxTxSatDelay");
#endif
#ifdef MODEM_IS_SCPC #ifdef MODEM_IS_SCPC
// ACM // ACM
acm.period_pack_acm = pt.get<uint32_t>("dvbServicePacketPeriod"); acm.period_pack_acm = pt.get<uint32_t>("dvbServicePacketPeriod");

View File

@ -567,6 +567,18 @@
return availableTabs[0] return availableTabs[0]
} }
function toLocaleStringWithSpaces(num) {
if (typeof num !== 'number') {
if (typeof num === 'string') { return num }
return String(num);
}
const numberString = num.toString()
const [integerPart, fractionalPart] = numberString.split('.')
const spacedIntegerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, " ")
if (fractionalPart) { return `${spacedIntegerPart}.${fractionalPart}` }
else { return spacedIntegerPart }
}
const app = Vue.createApp({ const app = Vue.createApp({
data() { data() {
return { return {
@ -768,7 +780,7 @@
result = Math.round(result / step) * step result = Math.round(result / step) * step
if ('min' in validation) { if (result <= validation['min']) { result = validation['min'] } } if ('min' in validation) { if (result <= validation['min']) { result = validation['min'] } }
if ('max' in validation) { if (result >= validation['max']) { result = validation['max'] } } if ('max' in validation) { if (result >= validation['max']) { result = validation['max'] } }
return result.toLocaleString() return toLocaleStringWithSpaces(result)
}, },
// ========== include from 'common/all-params-methods.js.j2' // ========== include from 'common/all-params-methods.js.j2'
@ -1079,9 +1091,9 @@
let snr; let snr;
if (isNaN(calcSnr)) { snr = `ОСШ=?` } else { snr=`ОСШ=${calcSnr}` } if (isNaN(calcSnr)) { snr = `ОСШ=?` } else { snr=`ОСШ=${calcSnr}` }
if (result > 1024) { if (result > 1024) {
return (result / 1024).toLocaleString() + ' Мбит/с; ' + snr return toLocaleStringWithSpaces(result / 1024) + ' Мбит/с; ' + snr
} else { } else {
return result.toLocaleString() + ' кбит/с; ' + snr return toLocaleStringWithSpaces(result) + ' кбит/с; ' + snr
} }
}, },
// ========== include end from 'common/setup-methods.js.j2' // ========== include end from 'common/setup-methods.js.j2'

View File

@ -290,6 +290,18 @@
return availableTabs[0] return availableTabs[0]
} }
function toLocaleStringWithSpaces(num) {
if (typeof num !== 'number') {
if (typeof num === 'string') { return num }
return String(num);
}
const numberString = num.toString()
const [integerPart, fractionalPart] = numberString.split('.')
const spacedIntegerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, " ")
if (fractionalPart) { return `${spacedIntegerPart}.${fractionalPart}` }
else { return spacedIntegerPart }
}
const app = Vue.createApp({ const app = Vue.createApp({
data() { data() {
return { return {
@ -446,7 +458,7 @@
result = Math.round(result / step) * step result = Math.round(result / step) * step
if ('min' in validation) { if (result <= validation['min']) { result = validation['min'] } } if ('min' in validation) { if (result <= validation['min']) { result = validation['min'] } }
if ('max' in validation) { if (result >= validation['max']) { result = validation['max'] } } if ('max' in validation) { if (result >= validation['max']) { result = validation['max'] } }
return result.toLocaleString() return toLocaleStringWithSpaces(result)
}, },
// ========== include from 'common/all-params-methods.js.j2' // ========== include from 'common/all-params-methods.js.j2'