Pārlūkot izejas kodu

Fixed problem with MvC: group_kick and group_join were on self instead of other user

Yentl Van Tendeloo 8 gadi atpakaļ
vecāks
revīzija
217ed7c27f
1 mainītis faili ar 9 papildinājumiem un 5 dzēšanām
  1. 9 5
      core/core_algorithm.alc

+ 9 - 5
core/core_algorithm.alc

@@ -68,7 +68,6 @@ Void function main():
 		if (password == hash(input())):
 			output("Passwords match!")
 			instantiate_attribute(core, admin_user, "password", password)
-			log("BREAK")
 			break!
 		else:
 			output("Not the same password, please try again!")
@@ -111,6 +110,7 @@ Void function main():
 	instantiate_link(core, "owner", "", core_model, admin_user)
 
 	// Call this for ourselves as well
+	log("MvC is ready!")
 	user_function_skip_init(admin_user)
 
 	// Done, so finish up
@@ -1074,9 +1074,13 @@ Void function user_function_skip_init(user_id : String):
 					if (other_user_id != ""):
 						Element overlap
 
-						overlap = set_overlap(allOutgoingAssociationInstances(core, user_id, "belongsTo"), allIncomingAssociationInstances(core, group_id, "belongsTo"))
+						overlap = set_overlap(allOutgoingAssociationInstances(core, other_user_id, "belongsTo"), allIncomingAssociationInstances(core, group_id, "belongsTo"))
+
+						log("Size of overlap: " + cast_v2s(read_nr_out(overlap)))
+						log("Overlap: " + set_to_string(overlap))
+
 						if (read_nr_out(overlap) == 0):
-							instantiate_link(core, "belongsTo", "", user_id, group_id)
+							instantiate_link(core, "belongsTo", "", other_user_id, group_id)
 							output("User added to the group!")
 						else:
 							output("User is already a member of the group!")
@@ -1101,12 +1105,12 @@ Void function user_function_skip_init(user_id : String):
 					if (other_user_id != ""):
 						Element overlap
 
-						overlap = set_overlap(allOutgoingAssociationInstances(core, user_id, "belongsTo"), allIncomingAssociationInstances(core, group_id, "belongsTo"))
+						overlap = set_overlap(allOutgoingAssociationInstances(core, other_user_id, "belongsTo"), allIncomingAssociationInstances(core, group_id, "belongsTo"))
 						if (read_nr_out(overlap) > 0):
 							model_delete_element(core, set_pop(overlap))
 
 							// Check if user was an owner as well
-							overlap = set_overlap(allIncomingAssociationInstances(core, user_id, "owner"), allOutgoingAssociationInstances(core, group_id, "owner"))
+							overlap = set_overlap(allIncomingAssociationInstances(core, other_user_id, "owner"), allOutgoingAssociationInstances(core, group_id, "owner"))
 							if (read_nr_out(overlap) > 0):
 								model_delete_element(core, set_pop(overlap))