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:
Lance Edgar 2022-03-15 11:34:37 -05:00
parent 90cb4cf028
commit 8daec28faf
3 changed files with 37 additions and 1 deletions

View file

@ -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']

View file

@ -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')

View file

@ -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)