diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index caf5ae3a5..e3f083904 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -137,7 +137,7 @@ jobs: uses: actions/download-artifact@v8 - name: Make Github release - uses: softprops/action-gh-release@v2 + uses: softprops/action-gh-release@v3 with: generate_release_notes: true tag_name: ${{ inputs.version }} diff --git a/lib/l10n/app_hr.arb b/lib/l10n/app_hr.arb index 1d7c68fee..8eb477401 100644 --- a/lib/l10n/app_hr.arb +++ b/lib/l10n/app_hr.arb @@ -1115,5 +1115,16 @@ } } }, - "searchLanguageAll": "Svi jezici" + "searchLanguageAll": "Svi jezici", + "serverUpdateTitle": "Potrebno je aktualizirati server", + "serverUpdateContent": "Povezani server je prestar za ovu verziju aplikacije. Zamoli administratora servera da ga aktualizira barem na verziju {minVersion}.", + "@serverUpdateContent": { + "description": "Message shown when the server version is too old. minVersion is the minimum required server version string.", + "type": "text", + "placeholders": { + "minVersion": { + "type": "String" + } + } + } } diff --git a/lib/l10n/app_nb.arb b/lib/l10n/app_nb.arb index c39afcc7d..53e37d4f7 100644 --- a/lib/l10n/app_nb.arb +++ b/lib/l10n/app_nb.arb @@ -260,5 +260,24 @@ "success": "Vellykket", "@success": { "description": "Message when an action completed successfully, usually used as a heading" + }, + "exerciseList": "Treningsliste", + "exercises": "Øvelser", + "@exercises": { + "description": "Multiple exercises for a workout" + }, + "exerciseName": "Navn på øvelse", + "@exerciseName": { + "description": "Label for the name of a workout exercise" + }, + "searchExercise": "Søk for å legge til øvelser", + "@searchExercise": { + "description": "Label on set form. Selected exercises are added to the set" + }, + "noIngredientsDefined": "Ingen ingredienser lagt til", + "searchNamesInEnglish": "Søk også etter navn på engelsk", + "muscles": "Muskler", + "@muscles": { + "description": "(main) muscles trained by an exercise" } } diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 25e5e9c08..0a329ad10 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -833,5 +833,10 @@ "darkMode": "Zawsze używaj trybu ciemnego", "lightMode": "Zawsze używaj trybu jasnego", "systemMode": "Ustawienia systemu", - "fitInWeek": "Dopasuj w tygodniu" + "fitInWeek": "Dopasuj w tygodniu", + "dayTypeAmrap": "Tak dużo rund jak to możliwe", + "trophies": "Trofea", + "dashboardWidgets": "Kokpit widgetów", + "dayTypeCustom": "Niestandardowy", + "dayTypeEnom": "Każda minuta w minutę" } diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index 5a77941fa..ba68d4c37 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -282,7 +282,7 @@ }, "repetitionUnit": "Unidade de repetição", "dayDescriptionHelp": "Uma descrição do que é feito neste dia (por exemplo, 'dia de treino') ou quais partes do corpo são treinadas (por exemplo, 'peito e ombros')", - "setNr": "Set {nr}", + "setNr": "Série {nr}", "@setNr": { "description": "Header in form indicating the number of the current set. Can also be translated as something like 'Set Nr. xy'.", "type": "text", diff --git a/lib/l10n/app_pt_BR.arb b/lib/l10n/app_pt_BR.arb index 75cbab620..1f74a3ddb 100644 --- a/lib/l10n/app_pt_BR.arb +++ b/lib/l10n/app_pt_BR.arb @@ -101,7 +101,7 @@ "@close": { "description": "Translation for close" }, - "successfullyDeleted": "Removido com êxito", + "successfullyDeleted": "Excluído com sucesso.", "@successfullyDeleted": { "description": "Message when an item was successfully deleted" }, @@ -167,7 +167,7 @@ "@pause": { "description": "Noun, not an imperative! Label used for the pause when using the gym mode" }, - "success": "Bem-sucedido", + "success": "Bem sucedido", "@success": { "description": "Message when an action completed successfully, usually used as a heading" }, @@ -419,7 +419,7 @@ "@rir": { "description": "Shorthand for Repetitions In Reserve" }, - "setUnitsAndRir": "Unidades e RIR da série", + "setUnitsAndRir": "Definir unidades e RiR", "@setUnitsAndRir": { "description": "Label shown on the slider where the user can toggle showing units and RiR", "type": "text" @@ -905,7 +905,7 @@ "aboutJoinCommunityTitle": "Entre para a comunidade", "aboutDiscordTitle": "Discord", "others": "Outros", - "fitInWeek": "Treino na semana", + "fitInWeek": "Cronograma semanal fixo", "fitInWeekHelp": "Se ligado, os dias vão se repetir semanalmente, caso contrário os dias seguirão sequencialmente se considerar o começo de uma nova semana.", "addSuperset": "Adicionar superséries", "setHasProgression": "Treino tem prograssão", @@ -1064,5 +1064,67 @@ "slotEntryTypeMyo": "Myo", "slotEntryTypeDropset": "Drop set", "trophies": "Troféus", - "noTrophies": "Você ainda não possui troféus" + "noTrophies": "Você ainda não possui troféus", + "dashboardWidgets": "Widgets do painel de controle", + "personalRecords": "Registros pessoais", + "serverUpdateTitle": "Atualização do servidor necessária", + "serverUpdateContent": "O servidor conectado é muito antigo para esta versão do aplicativo. Peça ao administrador do servidor para atualizá-lo para pelo menos a versão {minVersion}.", + "@serverUpdateContent": { + "description": "Message shown when the server version is too old. minVersion is the minimum required server version string.", + "type": "text", + "placeholders": { + "minVersion": { + "type": "String" + } + } + }, + "productNotFoundOpenFoodFacts": "Você pode adicionar este produto ao Open Food Facts para ajudar a comunidade!", + "@productNotFoundOpenFoodFacts": { + "description": "Label shown when product is not found to encourage users to go on Open Food Facts and add it themselves" + }, + "addToOpenFoodFacts": "Adicionar ao Open Food Facts", + "@addToOpenFoodFacts": { + "description": "Label shown as the clickable link to go on Open Food Facts" + }, + "isVegan": "Vegano", + "@isVegan": { + "description": "Label for vegan toggle" + }, + "isVegetarian": "Vegetariano", + "@isVegetarian": { + "description": "Label for vegetarian toggle" + }, + "filter": "Filtro", + "@filter": { + "description": "Label for filter button" + }, + "searchLanguageCurrent": "Somente no idioma atual ({lang})", + "@searchLanguageCurrent": { + "type": "text", + "placeholders": { + "lang": { + "type": "String" + } + } + }, + "searchLanguageEnglish": "Idioma atual ({lang}) e inglês", + "@searchLanguageEnglish": { + "type": "text", + "placeholders": { + "lang": { + "type": "String" + } + } + }, + "searchLanguageAll": "Todos os idiomas", + "topSet": "Série principal: {value}", + "@topSet": { + "description": "Value is a representation of the set, like '10 x 80kg'", + "type": "text", + "placeholders": { + "value": { + "type": "String" + } + } + } } diff --git a/lib/l10n/app_ur.arb b/lib/l10n/app_ur.arb new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/lib/l10n/app_ur.arb @@ -0,0 +1 @@ +{} diff --git a/lib/models/workouts/log.dart b/lib/models/workouts/log.dart index 6559b565e..a5526091b 100644 --- a/lib/models/workouts/log.dart +++ b/lib/models/workouts/log.dart @@ -120,11 +120,13 @@ class Log { weight = setConfig.weight; weightTarget = setConfig.weight; - weightUnit = setConfig.weightUnit; + weightUnitId = setConfig.weightUnitId ?? WEIGHT_UNIT_KG; + weightUnitObj = setConfig.weightUnit; repetitions = setConfig.repetitions; repetitionsTarget = setConfig.repetitions; - repetitionUnit = setConfig.repetitionsUnit; + repetitionsUnitId = setConfig.repetitionsUnitId ?? REP_UNIT_REPETITIONS_ID; + repetitionsUnitObj = setConfig.repetitionsUnit; rir = setConfig.rir; rirTarget = setConfig.rir; diff --git a/pubspec.lock b/pubspec.lock index 7ac0493e3..9cdad7380 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -345,6 +345,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.0" + ffi_leak_tracker: + dependency: transitive + description: + name: ffi_leak_tracker + sha256: "4093d4ef9ca06ffe2786e73bfb25e22aa92112b9bb4ec941f11e3e6b61489a97" + url: "https://pub.dev" + source: hosted + version: "0.1.2" file: dependency: transitive description: @@ -904,18 +912,18 @@ packages: dependency: "direct main" description: name: package_info_plus - sha256: "468c26b4254ab01979fa5e4a98cb343ea3631b9acee6f21028997419a80e1a20" + sha256: c2a4a9404e578d7c69e3cf19f0b057d906bd0b073deedc8006db997a8bfe97ca url: "https://pub.dev" source: hosted - version: "9.0.1" + version: "10.0.0" package_info_plus_platform_interface: dependency: transitive description: name: package_info_plus_platform_interface - sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086" + sha256: "063b21cce7a2e3d902897d6cefc3bd211bb8ea42190698be72219cd5017f1c65" url: "https://pub.dev" source: hosted - version: "3.2.1" + version: "4.0.0" path: dependency: "direct main" description: @@ -1589,10 +1597,10 @@ packages: dependency: transitive description: name: win32 - sha256: d7cb55e04cd34096cd3a79b3330245f54cb96a370a1c27adb3c84b917de8b08e + sha256: "316d813e24518851c2682b1a57bc7e2e54e9c7b81493d48bef502fea0c17f841" url: "https://pub.dev" source: hosted - version: "5.15.0" + version: "6.0.1" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index f15d24049..1b24bddd2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -57,7 +57,7 @@ dependencies: logging: ^1.3.0 markdown: ^7.3.0 multi_select_flutter: ^4.1.3 - package_info_plus: ^9.0.0 + package_info_plus: ^10.0.0 path: ^1.9.0 path_provider: ^2.1.5 provider: ^6.1.5+1 diff --git a/test/routine/models/log_test.dart b/test/routine/models/log_test.dart index ba8f53367..8cf740ede 100644 --- a/test/routine/models/log_test.dart +++ b/test/routine/models/log_test.dart @@ -18,7 +18,9 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:wger/helpers/consts.dart'; +import 'package:wger/models/exercises/exercise.dart'; import 'package:wger/models/workouts/log.dart'; +import 'package:wger/models/workouts/set_config_data.dart'; void main() { group('Log.volume', () { @@ -125,4 +127,70 @@ void main() { expect(log.volume(metric: true), closeTo(31.5, 0.0001)); }); }); + + group('Log.fromSetConfigData', () { + late Exercise exercise; + + setUp(() { + exercise = Exercise(id: 1); + }); + + test('uses default unit IDs when unit objects are not loaded', () { + // Reproduces: "Repetitions unit must be present if repetitions have a value" + // + // When the user taps "+" in gym mode to add an extra exercise, + // addExerciseAfterPage() creates a SetConfigData with only exerciseId and + // slotEntryId — no unit objects. The default constructor sets + // weightUnitId=WEIGHT_UNIT_KG and repetitionsUnitId=REP_UNIT_REPETITIONS_ID, + // but Log.fromSetConfigData was using the object setters which overwrite + // those IDs with null when the objects are null, causing the server to + // reject the request with a 400 ValidationError. + final setConfig = SetConfigData( + exerciseId: 1, + slotEntryId: 1, + exercise: exercise, + // no weightUnit or repetitionsUnit objects — mirrors addExerciseAfterPage() + ); + + final log = Log.fromSetConfigData(setConfig); + + expect(log.weightUnitId, WEIGHT_UNIT_KG); + expect(log.repetitionsUnitId, REP_UNIT_REPETITIONS_ID); + }); + + test('uses custom unit IDs from SetConfigData when set', () { + final setConfig = SetConfigData( + exerciseId: 1, + slotEntryId: 1, + exercise: exercise, + weightUnitId: WEIGHT_UNIT_LB, + repetitionsUnitId: REP_UNIT_TILL_FAILURE_ID, + ); + + final log = Log.fromSetConfigData(setConfig); + + expect(log.weightUnitId, WEIGHT_UNIT_LB); + expect(log.repetitionsUnitId, REP_UNIT_TILL_FAILURE_ID); + }); + + test('copies weight and repetitions values', () { + final setConfig = SetConfigData( + exerciseId: 1, + slotEntryId: 1, + exercise: exercise, + weight: 80, + repetitions: 12, + rir: 2, + ); + + final log = Log.fromSetConfigData(setConfig); + + expect(log.weight, 80); + expect(log.weightTarget, 80); + expect(log.repetitions, 12); + expect(log.repetitionsTarget, 12); + expect(log.rir, 2); + expect(log.rirTarget, 2); + }); + }); }