def RefreshPaymentStateForExternalIDs(self, external_ids):
		from tapiriik.services import Service, ServiceRecord
		external_ids = [str(x) for x in external_ids]
		connections = [ServiceRecord(x) for x in db.connections.find({"Service": "motivato", "ExternalID": {"$in": external_ids}})]
		users = db.users.find({"ConnectedServices.ID": {"$in": [x._id for x in connections]}})
		for user in users:
			my_connection = [x for x in connections if [y["ID"] for y in user["ConnectedServices"]] in x._id][0]
			# Defer to the actual service module, where all the session stuff is set up
			state = Service.FromID("motivato")._getPaymentState(my_connection)
			self.ApplyPaymentState(user, state, my_connection.ExternalID, duration=None)
dataset/ETHPy150Open cpfair/tapiriik/tapiriik/payments/external/motivato.py/MotivatoExternalPaymentProvider.RefreshPaymentStateForExternalIDs/swapped operands of `in`