Skip to content

Switch exercise DB to gfauredev fork, add immutable defaults with Clone & Edit, periodic refresh, and Wake Lock - #28

Merged
gfauredev merged 5 commits into
mainfrom
copilot/enhance-exercise-database-functionality
Feb 20, 2026
Merged

Switch exercise DB to gfauredev fork, add immutable defaults with Clone & Edit, periodic refresh, and Wake Lock#28
gfauredev merged 5 commits into
mainfrom
copilot/enhance-exercise-database-functionality

Conversation

Copilot AI commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Addresses several improvements to the exercise database and app behavior: switch data source to the gfauredev fork, make DB exercises read-only via clone-based editing, auto-refresh stale data, and prevent the device from sleeping during workouts.

Exercise DB URL — Single Source of Truth

  • Added EXERCISE_DB_BASE_URL in utils.rs as the sole constant pointing to https://raw.githubusercontent.com/gfauredev/free-exercise-db/main/
  • Both the JSON catalog URL (dist/exercises.json) and image base path (exercises/) are derived from it — no more two places to update on fork changes

Immutable Default Exercises

  • ExerciseCard gains an is_custom: bool prop
  • DB exercises show "✏️ Clone & Edit" instead of "✏️ Edit": clones the exercise with a fresh custom_{timestamp} ID, persists it, and navigates directly to its edit form
  • ExerciseListPage tracks (Exercise, is_custom) pairs and passes the flag down

Periodic Exercise Refresh

  • On launch, if exercises are cached in IndexedDB but exercise_db_last_fetch (localStorage) is older than 7 days, cached data is served immediately and a background re-download is triggered
  • record_fetch_timestamp() writes the Unix timestamp after each successful download

Wake Lock — Inhibit Idle

New services/wake_lock.rs requests navigator.wakeLock.request("screen") via js_sys::Reflect (no new web-sys WakeLock feature flags needed). Re-acquires on visibilitychange to survive tab switches. Progressive enhancement — silently no-ops on unsupported browsers.

// main()
services::wake_lock::enable_wake_lock();

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…xercises with Clone & Edit, Wake Lock API

Co-authored-by: gfauredev <19304085+gfauredev@users.noreply.github.com>
Copilot AI changed the title [WIP] Enhance exercise database functionality and app behavior Switch exercise DB to gfauredev fork, add immutable defaults with Clone & Edit, periodic refresh, and Wake Lock Feb 20, 2026
Copilot AI requested a review from gfauredev February 20, 2026 00:18
@gfauredev
gfauredev marked this pull request as ready for review February 20, 2026 00:27
@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown

🧪 Unit Tests & Coverage

Test Results

info: cargo-llvm-cov currently setting cfg(coverage); you can opt-out it by passing --no-cfg-coverage
�[1m�[92m    Updating�[0m crates.io index
�[1m�[92m   Compiling�[0m log-workout v0.1.0 (/home/runner/work/LogOut/LogOut)
�[1m�[92m    Finished�[0m `test` profile [unoptimized + debuginfo] target(s) in 21.37s
�[1m�[92m     Running�[0m unittests src/main.rs (target/llvm-cov-target/debug/deps/log_workout-400ed1bd472c7a92)

running 98 tests
test models::tests::all_categories_serde_round_trip ... ok
test models::tests::all_equipment_serde_round_trip ... ok
test models::tests::all_forces_serde_round_trip ... ok
test models::tests::category_all_contains_every_variant ... ok
test models::tests::category_round_trip ... ok
test models::tests::category_display_all_variants ... ok
test models::tests::distance_display_fractional_km ... ok
test models::tests::all_muscles_serde_round_trip ... ok
test models::tests::distance_display_metres ... ok
test models::tests::distance_display_whole_km ... ok
test models::tests::equipment_all_contains_every_variant ... ok
test models::tests::equipment_display_all_variants ... ok
test models::tests::equipment_round_trip ... ok
test models::tests::exercise_backward_compat_missing_optional_fields ... ok
test models::tests::exercise_full_json_deserialization ... ok
test models::tests::exercise_get_first_image_url_none ... ok
test models::tests::exercise_get_first_image_url_some ... ok
test models::tests::exercise_get_image_url_by_index ... ok
test models::tests::exercise_get_image_url_full_url_passthrough ... ok
test models::tests::exercise_level_none_when_missing_from_json ... ok
test models::tests::exercise_level_some_when_present_in_json ... ok
test models::tests::exercise_log_duration_seconds ... ok
test models::tests::exercise_log_duration_saturates_on_underflow ... ok
test models::tests::exercise_log_duration_seconds_none_when_incomplete ... ok
test models::tests::exercise_log_force_none_is_omitted_in_json ... ok
test models::tests::exercise_log_is_complete ... ok
test models::tests::exercise_log_serde_round_trip_with_all_fields ... ok
test models::tests::find_active_session_returns_first_without_end_time ... ok
test models::tests::exercise_optional_fields_none ... ok
test models::tests::exercise_minimal ... ok
test models::tests::find_active_session_returns_none_for_empty_list ... ok
test models::tests::find_active_session_returns_none_when_all_finished ... ok
test models::tests::finish_session_cancelled_session_is_not_stored ... ok
test models::tests::finish_session_with_exercises_is_stored ... ok
test models::tests::force_all_contains_every_variant ... ok
test models::tests::force_display_all_variants ... ok
test models::tests::force_has_reps ... ok
test models::tests::format_time_boundary_values ... ok
test models::tests::format_time_hours ... ok
test models::tests::format_time_minutes_seconds ... ok
test models::tests::get_current_timestamp_returns_reasonable_value ... ok
test models::tests::level_display_all_variants ... ok
test models::tests::level_serde_round_trip ... ok
test models::tests::mechanic_display_all_variants ... ok
test models::tests::mechanic_serde_round_trip ... ok
test models::tests::muscle_all_contains_every_variant ... ok
test models::tests::muscle_display_all_variants ... ok
test models::tests::muscle_round_trip ... ok
test models::tests::parse_distance_km_invalid ... ok
test models::tests::parse_distance_km_large_value_clamped ... ok
test models::tests::parse_distance_km_nan_and_infinity ... ok
test models::tests::parse_distance_km_valid ... ok
test models::tests::parse_weight_kg_invalid ... ok
test models::tests::parse_weight_kg_large_value_clamped ... ok
test models::tests::parse_weight_kg_nan_and_infinity ... ok
test models::tests::parse_weight_kg_valid ... ok
test models::tests::session_with_only_pending_exercises_is_cancelled ... ok
test models::tests::weight_display_fractional_kg ... ok
test models::tests::user_exercise_serialization_with_all_fields ... ok
test models::tests::weight_display_whole_kg ... ok
test models::tests::workout_exercise_serde_round_trip ... ok
test models::tests::workout_serde_round_trip ... ok
test models::tests::weight_display_zero ... ok
test models::tests::workout_session_is_active ... ok
test models::tests::workout_session_backward_compat_missing_pending_ids ... ok
test models::tests::workout_session_is_cancelled_when_no_exercises ... ok
test models::tests::workout_session_is_not_cancelled_when_has_exercises ... ok
test models::tests::workout_session_new_has_empty_pending_ids ... ok
test models::tests::workout_session_new_has_no_end_time ... ok
test models::tests::workout_session_pending_ids_serialization_round_trip ... ok
test models::tests::workout_set_serde_round_trip ... ok
test models::tests::workout_session_with_exercise_logs_serde ... ok
test models::tests::workout_set_without_optionals ... ok
test services::exercise_db::tests::exercises_json_url_uses_fork ... ok
test services::exercise_db::tests::get_equipment_types_deduplicates ... ok
test services::exercise_db::tests::get_exercise_by_id_found ... ok
test services::exercise_db::tests::get_exercise_by_id_not_found ... ok
test services::exercise_db::tests::get_muscle_groups_deduplicates ... ok
test services::exercise_db::tests::search_by_category ... ok
test services::exercise_db::tests::search_by_force ... ok
test services::exercise_db::tests::search_by_equipment ... ok
test services::exercise_db::tests::search_by_level ... ok
test services::exercise_db::tests::search_by_muscle ... ok
test services::exercise_db::tests::search_by_name ... ok
test services::exercise_db::tests::search_by_secondary_muscle_biceps ... ok
test services::exercise_db::tests::search_by_secondary_muscle ... ok
test services::exercise_db::tests::search_empty_query_returns_all ... ok
test services::exercise_db::tests::search_case_insensitive ... ok
test services::exercise_db::tests::search_no_match ... ok
test services::exercise_db::tests::search_with_none_equipment_does_not_match_equipment_query ... ok
test services::exercise_db::tests::search_with_none_force_does_not_match_force_query ... ok
test services::service_worker::tests::register_service_worker_noop_on_native ... ok
test services::wake_lock::tests::enable_wake_lock_noop_on_native ... ok
test utils::tests::format_session_date_beginning_of_today ... ok
test utils::tests::format_session_date_days_ago ... ok
test utils::tests::format_session_date_end_of_yesterday ... ok
test utils::tests::format_session_date_today ... ok
test utils::tests::format_session_date_yesterday ... ok

test result: ok. 98 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s


    Finished report saved to lcov.info

Coverage Summary

Filename                                 Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
components/active_session.rs                 364               364     0.00%          32                32     0.00%         180               180     0.00%           0                 0         -
components/add_custom_exercise.rs             30                30     0.00%           3                 3     0.00%          24                24     0.00%           0                 0         -
components/analytics.rs                        1                 1     0.00%           1                 1     0.00%           1                 1     0.00%           0                 0         -
components/analytics_panel.rs                182               182     0.00%          32                32     0.00%         111               111     0.00%           0                 0         -
components/bottom_nav.rs                       1                 1     0.00%           1                 1     0.00%           1                 1     0.00%           0                 0         -
components/completed_exercise_log.rs          92                92     0.00%          13                13     0.00%          47                47     0.00%           0                 0         -
components/credits.rs                          1                 1     0.00%           1                 1     0.00%           1                 1     0.00%           0                 0         -
components/edit_custom_exercise.rs            47                47     0.00%          12                12     0.00%          32                32     0.00%           0                 0         -
components/exercise_card.rs                   44                44     0.00%           4                 4     0.00%          31                31     0.00%           0                 0         -
components/exercise_form_fields.rs           190               190     0.00%          24                24     0.00%         104               104     0.00%           0                 0         -
components/exercise_list.rs                   64                64     0.00%           3                 3     0.00%          27                27     0.00%           0                 0         -
components/home.rs                            62                62     0.00%          16                16     0.00%          39                39     0.00%           0                 0         -
components/workout_log.rs                     96                96     0.00%          14                14     0.00%          60                60     0.00%           0                 0         -
main.rs                                       11                11     0.00%           3                 3     0.00%           8                 8     0.00%           0                 0         -
models/mod.rs                               1389                 2    99.86%          98                 1    98.98%         886                 1    99.89%           0                 0         -
services/exercise_db.rs                      357                19    94.68%          39                 6    84.62%         214                15    92.99%           0                 0         -
services/service_worker.rs                     6                 0   100.00%           2                 0   100.00%           6                 0   100.00%           0                 0         -
services/storage.rs                          116               116     0.00%          22                22     0.00%          73                73     0.00%           0                 0         -
services/wake_lock.rs                          5                 0   100.00%           2                 0   100.00%           5                 0   100.00%           0                 0         -
utils.rs                                      62                 0   100.00%           8                 0   100.00%          43                 0   100.00%           0                 0         -
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                       3120              1322    57.63%         330               188    43.03%        1893               755    60.12%           0                 0         -

Coverage Gate ✅ PASSED — all tested files have ≥ 90% coverage

File Lines Hit/Total Coverage Status
src/models/mod.rs 885/886 99%
src/services/exercise_db.rs 199/214 92%
src/services/service_worker.rs 6/6 100%
src/services/wake_lock.rs 5/5 100%
src/utils.rs 43/43 100%

@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown

🚀 PageSpeed Insights (Lighthouse)

Category Score
⚡ Performance 🟡 63
♿ Accessibility 🟡 79
🛡️ Best Practices 🟢 96
🔍 SEO 🟢 91
📱 PWA 🔴 0

🟢 ≥ 90 · 🟡 50–89 · 🔴 < 50

📄 Full Lighthouse HTML report

@github-actions

Copy link
Copy Markdown

🔍 PR Preview Build

A preview build of this PR is available as a workflow artifact.
👉 Download preview build

To view locally, download and serve the artifact with any static file server.

@gfauredev
gfauredev merged commit 8135f4c into main Feb 20, 2026
6 checks passed
@gfauredev
gfauredev deleted the copilot/enhance-exercise-database-functionality branch February 20, 2026 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants