Update worker ID numbers from Workers Info xlsx
Replace placeholder ID numbers with real 13-digit SA ID numbers for 12 of 14 workers. Brian and Jerry still have placeholders (no ID info on file). Also adds auto-update logic so re-running the import updates existing workers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
aaf86c2513
commit
1681ed26a2
@ -69,23 +69,25 @@ class Command(BaseCommand):
|
||||
# if needed.
|
||||
|
||||
worker_data = [
|
||||
# (name, monthly_salary, id_placeholder)
|
||||
('Soldier Aphiwe Dobe', Decimal('5000.00'), '0000000000001'),
|
||||
# (name, monthly_salary, id_number)
|
||||
# Real SA ID numbers from Workers Info xlsx (13-digit format)
|
||||
# Brian and Jerry don't have ID info on file yet — using placeholders
|
||||
('Soldier Aphiwe Dobe', Decimal('5000.00'), '9212236112084'),
|
||||
('Brian', Decimal('6000.00'), '0000000000002'),
|
||||
('Jerry', Decimal('5200.00'), '0000000000003'),
|
||||
('Tshepo Isrom Moganedi', Decimal('5200.00'), '0000000000004'),
|
||||
('Richard Moleko', Decimal('7000.00'), '0000000000005'),
|
||||
('Fikile Oupa Masimula', Decimal('7000.00'), '0000000000006'),
|
||||
('Mpho Gift Nkoana', Decimal('7000.00'), '0000000000007'),
|
||||
('Tshepo Isrom Moganedi', Decimal('5200.00'), '8112175417083'),
|
||||
('Richard Moleko', Decimal('7000.00'), '0003185071085'),
|
||||
('Fikile Oupa Masimula', Decimal('7000.00'), '8606305407088'),
|
||||
('Mpho Gift Nkoana', Decimal('7000.00'), '9811125984089'),
|
||||
# 4 at R300/day = R6,000/month
|
||||
('Clifford Jan Bobby Selemela', Decimal('6000.00'), '0000000000008'),
|
||||
('Goitsimang Rasta Moleko', Decimal('6000.00'), '0000000000009'),
|
||||
('Jimmy Moleko', Decimal('6000.00'), '0000000000010'),
|
||||
('Johannes Laka', Decimal('6000.00'), '0000000000011'),
|
||||
('Clifford Jan Bobby Selemela', Decimal('6000.00'), '0104205798085'),
|
||||
('Goitsimang Rasta Moleko', Decimal('6000.00'), '0403135542068'),
|
||||
('Jimmy Moleko', Decimal('6000.00'), '0101176105084'),
|
||||
('Johannes Laka', Decimal('6000.00'), '9809066044087'),
|
||||
# 3 at R250/day = R5,000/month
|
||||
('Shane Malobela', Decimal('5000.00'), '0000000000012'),
|
||||
('Sello Lloyed Matloa', Decimal('5000.00'), '0000000000013'),
|
||||
('Tumelo Faith Sinugo', Decimal('5000.00'), '0000000000014'),
|
||||
('Shane Malobela', Decimal('5000.00'), '9807046054085'),
|
||||
('Sello Lloyed Matloa', Decimal('5000.00'), '0407046184088'),
|
||||
('Tumelo Faith Sinugo', Decimal('5000.00'), '9009055943080'),
|
||||
]
|
||||
|
||||
worker_map = {}
|
||||
@ -99,6 +101,12 @@ class Command(BaseCommand):
|
||||
'employment_date': datetime.date(2024, 1, 15),
|
||||
}
|
||||
)
|
||||
# Always update ID number in case worker was created with placeholder
|
||||
if worker.id_number != id_num:
|
||||
old_id = worker.id_number
|
||||
worker.id_number = id_num
|
||||
worker.save(update_fields=['id_number'])
|
||||
self.stdout.write(f' Updated ID for {name}: {old_id} → {id_num}')
|
||||
worker_map[name] = worker
|
||||
if created:
|
||||
self.stdout.write(f' Created worker: {name} (R{salary}/month, R{worker.daily_rate}/day)')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user