mirror of
				https://gitlab.crans.org/bde/nk20-scripts
				synced 2025-11-04 08:32:10 +01:00 
			
		
		
		
	🐛 Last report date is a datetime, not a date
This commit is contained in:
		@@ -132,7 +132,7 @@ class Command(ImportCommand):
 | 
				
			|||||||
                    "email_confirmed": True,
 | 
					                    "email_confirmed": True,
 | 
				
			||||||
                    "promotion": MAP_IDBDE_PROMOTION[row["idbde"]]["promo"],
 | 
					                    "promotion": MAP_IDBDE_PROMOTION[row["idbde"]]["promo"],
 | 
				
			||||||
                    "report_frequency": row["report_period"],
 | 
					                    "report_frequency": row["report_period"],
 | 
				
			||||||
                    "last_report": make_aware(row["previous_report_date"]).date(),
 | 
					                    "last_report": make_aware(row["previous_report_date"]),
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                note_dict["created_at"] = make_aware(MAP_IDBDE_PROMOTION[row["idbde"]]["created_at"])
 | 
					                note_dict["created_at"] = make_aware(MAP_IDBDE_PROMOTION[row["idbde"]]["created_at"])
 | 
				
			||||||
                note_dict["polymorphic_ctype"] = note_user_type
 | 
					                note_dict["polymorphic_ctype"] = note_user_type
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,10 +23,10 @@ class Command(BaseCommand):
 | 
				
			|||||||
        for note in notes:
 | 
					        for note in notes:
 | 
				
			||||||
            now = timezone.now()
 | 
					            now = timezone.now()
 | 
				
			||||||
            last_report = note.user.profile.last_report
 | 
					            last_report = note.user.profile.last_report
 | 
				
			||||||
            delta = now.date() - last_report
 | 
					            delta = now.date() - last_report.date()
 | 
				
			||||||
            if delta.days < note.user.profile.report_frequency:
 | 
					            if delta.days < note.user.profile.report_frequency:
 | 
				
			||||||
                continue
 | 
					                continue
 | 
				
			||||||
            note.user.profile.last_report = now.date()
 | 
					            note.user.profile.last_report = now
 | 
				
			||||||
            note.user.profile.save()
 | 
					            note.user.profile.save()
 | 
				
			||||||
            last_transactions = Transaction.objects.filter(
 | 
					            last_transactions = Transaction.objects.filter(
 | 
				
			||||||
                Q(source=note) | Q(destination=note),
 | 
					                Q(source=note) | Q(destination=note),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user