Add "raw" card number value to CORE Member Import batch
b/c source file may not have it, or may not be numeric
This commit is contained in:
parent
90cb4cf028
commit
8daec28faf
|
@ -106,7 +106,9 @@ class CoreMemberBatchHandler(BatchHandler):
|
||||||
|
|
||||||
def append(csvrow, i):
|
def append(csvrow, i):
|
||||||
row = self.make_row()
|
row = self.make_row()
|
||||||
row.card_number = int(csvrow['external_id'])
|
row.card_number_raw = csvrow['external_id']
|
||||||
|
if csvrow['external_id'].isdigit():
|
||||||
|
row.card_number = int(csvrow['external_id'])
|
||||||
row.first_name = csvrow['first_name']
|
row.first_name = csvrow['first_name']
|
||||||
row.last_name = csvrow['last_name']
|
row.last_name = csvrow['last_name']
|
||||||
row.street = csvrow['primary_address1']
|
row.street = csvrow['primary_address1']
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
# -*- coding: utf-8; -*-
|
||||||
|
"""add card_number_raw for member import
|
||||||
|
|
||||||
|
Revision ID: d6a0f21a6a94
|
||||||
|
Revises: 50961b4b854a
|
||||||
|
Create Date: 2022-03-15 11:24:41.764317
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'd6a0f21a6a94'
|
||||||
|
down_revision = '50961b4b854a'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
import rattail.db.types
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
|
||||||
|
# batch_corepos_member_row
|
||||||
|
op.add_column('batch_corepos_member_row', sa.Column('card_number_raw', sa.String(length=20), nullable=True))
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
|
||||||
|
# batch_corepos_member_row
|
||||||
|
op.drop_column('batch_corepos_member_row', 'card_number_raw')
|
|
@ -70,6 +70,7 @@ class CoreMemberBatchRow(model.BatchRowMixin, model.Base):
|
||||||
STATUS_FIELDS_CHANGED : "update member",
|
STATUS_FIELDS_CHANGED : "update member",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
card_number_raw = sa.Column(sa.String(length=20), nullable=True)
|
||||||
card_number = sa.Column(sa.Integer(), nullable=True)
|
card_number = sa.Column(sa.Integer(), nullable=True)
|
||||||
|
|
||||||
first_name = sa.Column(sa.String(length=30), nullable=True)
|
first_name = sa.Column(sa.String(length=30), nullable=True)
|
||||||
|
|
Loading…
Reference in a new issue