Refactor medication model to use blisters and pills instead of strips and tabs
- Updated medication schema to replace stripsPerPack and tabsPerStrip with blistersPerPack and pillsPerBlister. - Adjusted medication routes to handle new blister and pill structure, including calculations for total pills. - Modified frontend components to reflect changes in medication data structure and ensure compatibility with new backend logic. - Updated reminder scheduler and share routes to utilize the new medication model. - Enhanced Docker configuration for better permissions handling during development.
This commit is contained in:
@@ -237,13 +237,14 @@ async function getMedicationsNeedingReminder(userId: number, reminderDaysBefore:
|
||||
|
||||
for (const row of rows) {
|
||||
const blisters = parseBlisters(row);
|
||||
const { daysLeft, depletionDate } = calculateDepletionInfo({ count: row.count, blisters }, language);
|
||||
const totalPills = row.packCount * row.blistersPerPack * row.pillsPerBlister + row.looseTablets;
|
||||
const { daysLeft, depletionDate } = calculateDepletionInfo({ count: totalPills, blisters }, language);
|
||||
|
||||
// Check if medication runs out within reminderDaysBefore days
|
||||
if (daysLeft !== null && daysLeft <= reminderDaysBefore) {
|
||||
lowStock.push({
|
||||
name: row.name,
|
||||
medsLeft: row.count,
|
||||
medsLeft: totalPills,
|
||||
daysLeft,
|
||||
depletionDate,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user