Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase config: add workoutId in documents returned from getWorkoutOnDate #198

Closed
mfederowicz opened this issue Sep 19, 2022 · 2 comments
Closed
Labels

Comments

@mfederowicz
Copy link
Contributor

Steps to reproduce

When main calendar widget is builded we use function getWorkoutOnDate on every element(day) of calendar, That function returns snapshots with workout documents, but without id field. It is not a problem with define id field in Workout object, but with data returned from Firebase (maybe problem with proper configuration of collection or something)

Expected behavior

WorkoutId field is required to proper workout remove process

void deleteWorkout(Workout workout) async {

  for (Exercise exercise in workout.exercises) {
    deleteExercise(exercise);
  }
  await firestoreInstance
      .collection('users')
      .doc(SharedPref.getStringAsync(USER_UID))
      .collection('workouts')
      .doc(workout.id)
      .delete();
}

Actual behavior

Currently we collect workout data like this:

return FirebaseFirestore.instance
      .collection('users')
      .doc(SharedPref.getStringAsync(USER_UID))
      .collection('workouts')
      .where('date', isLessThan: after)
      .where('date', isGreaterThan: before)
      .snapshots();

we get last document from collection

workout.docs.last

the actual returned workout document/object looks like this:

{date: Timestamp(seconds=1663612760, nanoseconds=669000000), template: false, total_reps: 6, notes: , exercises: [Ohf06H1McAhQ9eqQON5o], name: w2, total_sets: 2, rating: , time: 0.0, type: , total_weight: 0.0}

so there is no id or workoutId field in above example :(

@mfederowicz
Copy link
Contributor Author

@KalleHallden can you take a look on this please?

@stale
Copy link

stale bot commented Oct 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Thank you for your contributions.

@stale stale bot added the stale label Oct 12, 2022
@stale stale bot closed this as completed Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant