Skip to content

Commit ea4a50c

Browse files
committed
bug: associated posts were not being removed from database
1 parent aec8177 commit ea4a50c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

client/lib/views/users_page.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ class _UsersPageState extends State<UsersPage> {
134134
hobbiesIDsToDelete.add(user["hobbies"][i]["id"]);
135135
}
136136
for (var i = 0; i < user["posts"].length; i++){
137-
postsIDsToDelete.add(user["hobbies"][i]["id"]);
137+
postsIDsToDelete.add(user["posts"][i]["id"]);
138138
}
139-
// debugPrint("+++${user["name"]} Hobbies to delete ${hobbiesIDsToDelete.toString()}");
140-
// debugPrint("+++${user["name"]} Posts to delete ${postsIDsToDelete.toString()}");
139+
debugPrint("+++${user["name"]} Hobbies to delete ${hobbiesIDsToDelete.toString()}");
140+
debugPrint("+++${user["name"]} Posts to delete ${postsIDsToDelete.toString()}");
141141

142142
setState((){
143143
_isRemoveHobbies = true;
@@ -164,7 +164,7 @@ class _UsersPageState extends State<UsersPage> {
164164
),
165165
builder: (runMutation, result) {
166166
if(hobbiesIDsToDelete.isNotEmpty){
167-
debugPrint("Calling deleteHobbies");
167+
debugPrint("Calling removeHobbies");
168168
runMutation({
169169
'ids': hobbiesIDsToDelete
170170
});
@@ -180,6 +180,7 @@ class _UsersPageState extends State<UsersPage> {
180180
),
181181
builder: (runMutation, result){
182182
if(postsIDsToDelete.isNotEmpty){
183+
debugPrint("Calling removePosts");
183184
runMutation({
184185
"ids": postsIDsToDelete
185186
});
@@ -241,7 +242,6 @@ class _UsersPageState extends State<UsersPage> {
241242
return """
242243
mutation RemoveHobbies(\$ids: [String]){
243244
RemoveHobbies(ids: \$ids){
244-
245245
}
246246
}
247247
""";
@@ -251,7 +251,6 @@ class _UsersPageState extends State<UsersPage> {
251251
return """
252252
mutation RemovePosts(\$ids: [String]){
253253
RemovePosts(ids: \$ids){
254-
255254
}
256255
}
257256
""";

0 commit comments

Comments
 (0)