Import from other apps: convert weights per row, not per file

The unit was decided once for the whole file: if any row said lb and none
said kg it converted, otherwise it did nothing. FitNotes writes the unit
next to every set, so a history recorded partly in pounds and partly in
kilos hit the 'otherwise' branch — the file was taken over unconverted
and "185 lb" was logged as 185 kg, while the summary claimed the file
does not say which unit it uses.

Each row now carries its own unit through to the conversion (falling back
to the file's, then to the profile's), and a mixed file says so in the
preview.

Also: the "exercises matched" tile counted matched rows, so three
exercises across five sets read as five. It counts distinct exercises
now, which is what the label says.
This commit is contained in:
Duarte Santos committed 2026-07-24 23:45:17 +02:00
1 parent 3d5b00cecd
commit 43d5495007
2 files changed
+31 -13

No files matched your search

+5 -3
View File
@@ -168,10 +168,12 @@ function ImportSummary({ parsed, close }) {
</>}
</div>
{parsed.converted && <div className="small" style={{ color: 'var(--yellow)', marginBottom: 10 }}>
{parsed.mixedUnits ? <div className="small" style={{ color: 'var(--yellow)', marginBottom: 10 }}>
{t('The file mixes kg and lb — each set is converted to {0}.', st.unit)}
</div> : parsed.converted ? <div className="small" style={{ color: 'var(--yellow)', marginBottom: 10 }}>
{t('The file is in {0} and your profile is in {1} — weights will be converted.', parsed.fileUnit, st.unit)}
</div>}
{!isBW && !parsed.fileUnit && <div className="small dim" style={{ marginBottom: 10 }}>
</div> : null}
{!isBW && !parsed.fileUnit && !parsed.mixedUnits && <div className="small dim" style={{ marginBottom: 10 }}>
{t('The file does not say which unit it uses — numbers are imported as they are.')}
</div>}
{have > 0 && <div className="small dim" style={{ marginBottom: 10 }}>