This is a Fitness Tracker canister deployed on the Internet Computer network. It allows you to track your workouts, manage exercise categories, set fitness goals, and retrieve workout statistics. This readme provides instructions on deploying and interacting with the canister.
- DFINITY SDK installed.
- Basic familiarity with the DFINITY Internet Computer.
IMPORTANT: In an update to fix recurring bugs, I renamed the project to the default tutorial canister "message_board"
- Start the local Internet Computer replica by running the following command in your terminal:
dfx start --background
- Deploy the canister by executing the following command:
dfx deploy
- Upon successful deployment, you'll receive URLs for interacting with the canister via the Candid interface.
- Add a new exercise category:
dfx canister call fitness_tracker addExerciseCategory (<category-id>, { name: <Category Name>, description: <Category Description> })
- Retrieve all exercise categories:
dfx canister call fitness_tracker getExerciseCategories
- Add a new fitness goal:
dfx canister call fitness_tracker addGoal '("<goal-id>", { "target": "<Target Description>", "value": <Target Value> })'
- Retrieve all fitness goals:
dfx canister call fitness_tracker getGoals
- Add a new workout:
dfx canister call fitness_tracker addWorkout '({ "date": "<Date>", "exercise": "<Exercise Name>", "duration": <Duration in Minutes>, "caloriesBurned": <Calories Burned> })'
- Retrieve all workouts:
dfx canister call fitness_tracker getWorkout '("<Workout ID>")'
- Update a workout:
dfx canister call fitness_tracker updateWorkout '("<Workout ID>", { "date": "<New Date>", "exercise": "<New Exercise Name>", "duration": <New Duration>, "caloriesBurned": <New Calories Burned> })'
- Delete a workout:
dfx canister call fitness_tracker deleteWorkout '("<Workout ID>")'
- Calculate total calories burned from all workouts:
dfx canister call fitness_tracker calculateTotalCaloriesBurned
- Calculate average workout duration:
dfx canister call fitness_tracker calculateAverageDuration
- Canister Name:
fitness_tracker
- Candid Interface URL: Canister Interface URL
This Fitness Tracker canister allows you to conveniently track your workouts, manage exercise categories, set fitness goals, and monitor workout statistics. To get started, follow the deployment and interaction steps provided above.
- The canister uses a StableBTreeMap data structure for workout storage. Be aware that once initialized, its configuration becomes immutable. Restart the local replica with the
--clean
flag if you make changes to its configuration. - Customize the provided function calls with appropriate values according to your use case.
Feel free to explore the various functions offered by the canister to enhance your fitness tracking experience.
For additional details and customization, refer to the official DFINITY SDK Documentation.