mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 08:22:10 +01:00 
			
		
		
		
	Filter on last name and optionally on first name for Hello Asso
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
		@@ -44,9 +44,15 @@ class Command(BaseCommand):
 | 
			
		||||
 | 
			
		||||
            payer = payment["payer"]
 | 
			
		||||
            email = payer["email"]
 | 
			
		||||
            last_name = payer["lastName"]
 | 
			
		||||
            first_name = payer["firstName"]
 | 
			
		||||
            qs = User.objects.filter(email=email)
 | 
			
		||||
            if not qs.exists():
 | 
			
		||||
                self.stderr.write(f"Warning: a payment was found by the email address {email}, "
 | 
			
		||||
                qs = User.objects.filter(last_name__icontains=last_name)
 | 
			
		||||
                if qs.count() >= 2:
 | 
			
		||||
                    qs = qs.filter(first_name__icontains=first_name)
 | 
			
		||||
            if not qs.exists():
 | 
			
		||||
                self.stderr.write(f"Warning: a payment was found by {first_name} {last_name} ({email}), "
 | 
			
		||||
                                  "but this user is unknown.")
 | 
			
		||||
                continue
 | 
			
		||||
            user = qs.get()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user