Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task: Convert GER Columns to Expected Types #298 #302

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions django/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,30 +367,40 @@ class ScrapItColumnMapping(Enum):
class GoElectricRebatesColumns(Enum):
APPROVALS = "Approvals"
DATE = "Date"
FLEET = "Fleet/Individuals"
APPLICANT_NAME = "Applicant Name"
MAX_INCENTIVE_AMOUNT_REQUESTED = "Max Incentive Amount Requested"
CATEGORY = "Category"
APPLICANT_TYPE = "Fleet/Individuals"
INCENTIVE_PAID = "Incentive Paid"
TOTAL_PURCHASE_PRICE_PRE_TAX = "Total Purchase Price (pre-tax)"
MANUFACTURER = "Manufacturer"
MODEL = "Model"
GER_CLASS = "Class"
CITY = "City"
POSTAL_CODE = "Postal Code"
PHONE = "Phone"
EMAIL = "Email"
VIN = "VIN"
VEHICLE_CLASS = "Class"


class GoElectricRebatesColumnMapping(Enum):
approvals = "Approvals"
date = "Date"
fleet = "Fleet/Individuals"
applicant_name = "Applicant Name"
max_incentive_amount_requested = "Max Incentive Amount Requested"
category = "Category"
applicant_type = "Applicant Type"
applicant_type = "Fleet/Individuals"
incentive_paid = "Incentive Paid"
total_purchase_price = "Total Purchase Price (pre-tax)"
manufacturer = "Manufacturer"
model = "Model"
ger_class = "Class"
city = "City"
postal_code = "Postal Code"
phone = "Phone"
email = "Email"
vin = "VIN"
vehicle_class = "Class"



FIELD_TYPES = {
Expand Down Expand Up @@ -552,7 +562,6 @@ class GoElectricRebatesColumnMapping(Enum):
"Go Electric Rebates Program": {
"approvals": str,
"date": datetime.date,
"fleet": str,
"applicant_name": str,
"max_incentive_amount_requested": int,
"category": str,
Expand All @@ -561,8 +570,14 @@ class GoElectricRebatesColumnMapping(Enum):
"total_purchase_price": int,
"manufacturer": str,
"model": str,
"ger_class": str
"city": str,
"postal_code": str,
"phone": str,
"email": str,
"vin": str,
"vehicle_class": str,
},

}

DATASET_CONFIG = {
Expand Down
100 changes: 100 additions & 0 deletions django/api/migrations/0024_auto_20240516_2114.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Generated by Django 3.2.25 on 2024-05-16 21:14

from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

dependencies = [
('api', '0023_auto_20240514_1721'),
]

operations = [
migrations.RenameField(
model_name='goelectricrebates',
old_name='ger_class',
new_name='vehicle_class',
),
migrations.AddField(
model_name='goelectricrebates',
name='city',
field=models.CharField(default=django.utils.timezone.now, max_length=250),
preserve_default=False,
),
migrations.AddField(
model_name='goelectricrebates',
name='email',
field=models.CharField(default='a', max_length=50),
preserve_default=False,
),
migrations.AddField(
model_name='goelectricrebates',
name='flagged',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AddField(
model_name='goelectricrebates',
name='phone',
field=models.CharField(default='123', max_length=20),
preserve_default=False,
),
migrations.AddField(
model_name='goelectricrebates',
name='postal_code',
field=models.CharField(blank=True, max_length=250, null=True),
),
migrations.AddField(
model_name='goelectricrebates',
name='vin',
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='goelectricrebates',
name='applicant_name',
field=models.CharField(default='a', max_length=250),
preserve_default=False,
),
migrations.AlterField(
model_name='goelectricrebates',
name='approvals',
field=models.CharField(default='a', max_length=20),
preserve_default=False,
),
migrations.AlterField(
model_name='goelectricrebates',
name='category',
field=models.CharField(default='a', max_length=250),
preserve_default=False,
),
migrations.AlterField(
model_name='goelectricrebates',
name='date',
field=models.DateField(default=django.utils.timezone.now, max_length=20),
preserve_default=False,
),
migrations.AlterField(
model_name='goelectricrebates',
name='incentive_paid',
field=models.IntegerField(default=1),
preserve_default=False,
),
migrations.AlterField(
model_name='goelectricrebates',
name='manufacturer',
field=models.CharField(default='a', max_length=250),
preserve_default=False,
),
migrations.AlterField(
model_name='goelectricrebates',
name='model',
field=models.CharField(default='a', max_length=250),
preserve_default=False,
),
migrations.AlterField(
model_name='goelectricrebates',
name='total_purchase_price',
field=models.IntegerField(default=1),
preserve_default=False,
),
]
21 changes: 21 additions & 0 deletions django/api/migrations/0025_auto_20240516_2248.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.25 on 2024-05-16 22:48

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('api', '0024_auto_20240516_2114'),
]

operations = [
migrations.RemoveField(
model_name='goelectricrebates',
name='flagged',
),
migrations.RemoveField(
model_name='goelectricrebates',
name='fleet',
),
]
28 changes: 16 additions & 12 deletions django/api/models/go_electric_rebates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,31 @@


class GoElectricRebates(Auditable):
approvals = models.CharField(blank=True, null=True, max_length=20)
date = models.DateField(max_length=20, null=True, blank=True)
fleet = models.CharField(max_length=20)
applicant_name = models.CharField(blank=True, null=True, max_length=250)
approvals = models.CharField(blank=False, null=False, max_length=20)
date = models.DateField(max_length=20, null=False, blank=False)
applicant_name = models.CharField(blank=False, null=False, max_length=250)
max_incentive_amount_requested = models.IntegerField(
null=True,
blank=True,
)
category = models.CharField(blank=True, max_length=250, null=True)
category = models.CharField(blank=False, max_length=250, null=False)
applicant_type = models.CharField(blank=True, max_length=50, null=True)
incentive_paid = models.IntegerField(
null=True,
blank=True,
null=False,
blank=False,
)
total_purchase_price = models.IntegerField(
null=True,
blank=True,
null=False,
blank=False,
)
manufacturer = models.CharField(blank=True, max_length=250, null=True)
model = models.CharField(blank=True, max_length=250, null=True)
ger_class = models.CharField(blank=True, null=True, max_length=50)
manufacturer = models.CharField(blank=False, max_length=250, null=False)
model = models.CharField(blank=False, max_length=250, null=False)
city = models.CharField(blank=False, max_length=250, null=False)
postal_code = models.CharField(blank=True, max_length=250, null=True)
phone = models.CharField(blank=False, max_length=20, null=False)
email = models.CharField(blank=False, max_length=50, null=False)
vin = models.CharField(blank=True, max_length=100, null=True)
vehicle_class = models.CharField(blank=True, null=True, max_length=50)

class Meta:
db_table = "go_electric_rebates"
Loading