Tauri 2 + pure JS + SQLite personal health tracking app. Nutrition module: - 9299 products in DB (Magnit SSR scraping + KDV) - Product search with case-insensitive Cyrillic (name_lower column) - Food logging from product DB or manual entry - Supplement tracking with per-pill micronutrients - Micronutrient % strip on Today screen Fitness/GPS module: - FitoTrack .ftb and GPX import with seq-based ordering - Session detail view: map, speed/elevation charts (Chart.js) - Offline tile caching (IndexedDB) with region download - Track rendering with colored time-gradient points UI: - Fullscreen modals with back-button (history API) - Dark theme, desktop-responsive layout - 5 tabs: Today, Products, Track, Supplements, Profile Tools: - Magnit/KDV HTML parsers - Dedup import with discrepancy detection - FitoTrack backup analysis
14 lines
434 B
JavaScript
14 lines
434 B
JavaScript
// Mifflin-St Jeor BMR formula.
|
|
// Males: BMR = 10*weight + 6.25*height - 5*age - 5
|
|
// Females: BMR = 10*weight + 6.25*height - 5*age + 161
|
|
|
|
function calculateBmr(weightKg, heightCm, age, sex) {
|
|
const base = 10 * weightKg + 6.25 * heightCm - 5 * age;
|
|
return Math.round(sex === "m" ? base - 5 : base + 161);
|
|
}
|
|
|
|
function getAge(birthYear) {
|
|
return new Date().getFullYear() - birthYear;
|
|
}
|
|
|
|
window.BMR = { calculateBmr, getAge };
|