From 42b84a2070fe6f5172891c029fd3467870b6fdec Mon Sep 17 00:00:00 2001 From: Jesse Zong Date: Sun, 17 Nov 2024 13:09:34 -0500 Subject: [PATCH] Squash migrations --- .../management/commands/update_laundry_rooms.py | 11 ++--------- ...name_hall_id_laundryroom_room_id_and_more.py | 7 +------ .../0004_alter_laundryroom_room_id.py | 2 +- .../migrations/0005_remove_laundryroom_new.py | 17 ----------------- 4 files changed, 4 insertions(+), 33 deletions(-) delete mode 100644 backend/laundry/migrations/0005_remove_laundryroom_new.py diff --git a/backend/laundry/management/commands/update_laundry_rooms.py b/backend/laundry/management/commands/update_laundry_rooms.py index 70abcb3b..193f1100 100644 --- a/backend/laundry/management/commands/update_laundry_rooms.py +++ b/backend/laundry/management/commands/update_laundry_rooms.py @@ -45,14 +45,7 @@ def handle(self, *args, **kwargs): if room_request_json is None: return # count washers and dryers - count_washers = 0 - count_dryers = 0 - for machine in room_request_json: - if machine["isWasher"]: - count_washers += 1 - if machine["isDryer"]: - count_dryers += 1 - room["count_washers"] = count_washers - room["count_dryers"] = count_dryers + room["count_washers"] = len([machine for machine in room_request_json if machine["isWasher"]]) + room["count_dryers"] = len([machine for machine in room_request_json if machine["isDryer"]]) write_file(laundry_rooms) diff --git a/backend/laundry/migrations/0003_rename_hall_id_laundryroom_room_id_and_more.py b/backend/laundry/migrations/0003_rename_hall_id_laundryroom_room_id_and_more.py index de0baf42..522066ad 100644 --- a/backend/laundry/migrations/0003_rename_hall_id_laundryroom_room_id_and_more.py +++ b/backend/laundry/migrations/0003_rename_hall_id_laundryroom_room_id_and_more.py @@ -1,4 +1,4 @@ -# Generated by Django 5.0.2 on 2024-09-29 06:49 +# Generated by Django 5.0.2 on 2024-11-17 18:04 from django.db import migrations, models @@ -24,9 +24,4 @@ class Migration(migrations.Migration): name="location_id", field=models.IntegerField(default=0), ), - migrations.AddField( - model_name="laundryroom", - name="new", - field=models.BooleanField(default=False), - ), ] diff --git a/backend/laundry/migrations/0004_alter_laundryroom_room_id.py b/backend/laundry/migrations/0004_alter_laundryroom_room_id.py index 5ddb2df5..93e950c4 100644 --- a/backend/laundry/migrations/0004_alter_laundryroom_room_id.py +++ b/backend/laundry/migrations/0004_alter_laundryroom_room_id.py @@ -1,4 +1,4 @@ -# Generated by Django 5.0.2 on 2024-11-17 01:04 +# Generated by Django 5.0.2 on 2024-11-17 18:04 from django.db import migrations, models diff --git a/backend/laundry/migrations/0005_remove_laundryroom_new.py b/backend/laundry/migrations/0005_remove_laundryroom_new.py deleted file mode 100644 index 699e3786..00000000 --- a/backend/laundry/migrations/0005_remove_laundryroom_new.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 5.0.2 on 2024-11-17 09:12 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ("laundry", "0004_alter_laundryroom_room_id"), - ] - - operations = [ - migrations.RemoveField( - model_name="laundryroom", - name="new", - ), - ]