Update migration order and change loa to loas
This commit is contained in:
parent
68ab32d1d1
commit
f1b9bf19a7
@ -1,7 +1,7 @@
|
|||||||
"""Update LOA to Array Type
|
"""Update LOA to Array Type
|
||||||
|
|
||||||
Revision ID: db161adbafdf
|
Revision ID: db161adbafdf
|
||||||
Revises: b3a1a07cf30b
|
Revises: fa3ba4049218
|
||||||
Create Date: 2019-02-15 14:28:33.181136
|
Create Date: 2019-02-15 14:28:33.181136
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -11,7 +11,7 @@ import sqlalchemy as sa
|
|||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = 'db161adbafdf'
|
revision = 'db161adbafdf'
|
||||||
down_revision = 'b3a1a07cf30b'
|
down_revision = 'fa3ba4049218'
|
||||||
branch_labels = None
|
branch_labels = None
|
||||||
depends_on = None
|
depends_on = None
|
||||||
|
|
||||||
@ -19,10 +19,12 @@ depends_on = None
|
|||||||
def upgrade():
|
def upgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
op.execute("ALTER TABLE task_orders ALTER COLUMN loa TYPE varchar[] USING array[loa]")
|
op.execute("ALTER TABLE task_orders ALTER COLUMN loa TYPE varchar[] USING array[loa]")
|
||||||
|
op.alter_column('task_orders', 'loa', new_column_name='loas')
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
op.execute("ALTER TABLE task_orders ALTER COLUMN loa TYPE varchar USING loa[1]")
|
op.execute("ALTER TABLE task_orders ALTER COLUMN loa TYPE varchar USING loa[1]")
|
||||||
|
op.alter_column('task_orders', 'loas', new_column_name='loa')
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
|
@ -29,7 +29,7 @@ class KOReviewForm(CacheableForm):
|
|||||||
number = StringField(
|
number = StringField(
|
||||||
translate("forms.ko_review.to_number"), validators=[Length(min=10)]
|
translate("forms.ko_review.to_number"), validators=[Length(min=10)]
|
||||||
)
|
)
|
||||||
loa = FieldList(
|
loas = FieldList(
|
||||||
StringField(
|
StringField(
|
||||||
translate("forms.ko_review.loa"), validators=[Length(min=10), IsNumber()]
|
translate("forms.ko_review.loa"), validators=[Length(min=10), IsNumber()]
|
||||||
)
|
)
|
||||||
@ -43,5 +43,5 @@ class KOReviewForm(CacheableForm):
|
|||||||
@property
|
@property
|
||||||
def data(self):
|
def data(self):
|
||||||
_data = super(FlaskForm, self).data
|
_data = super(FlaskForm, self).data
|
||||||
_data["loa"] = [n for n in _data["loa"] if n not in self.EMPTY_LOA]
|
_data["loas"] = [n for n in _data["loas"] if n not in self.EMPTY_LOA]
|
||||||
return _data
|
return _data
|
||||||
|
@ -90,7 +90,7 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
|||||||
pdf_attachment_id = Column(ForeignKey("attachments.id"))
|
pdf_attachment_id = Column(ForeignKey("attachments.id"))
|
||||||
_pdf = relationship("Attachment", foreign_keys=[pdf_attachment_id])
|
_pdf = relationship("Attachment", foreign_keys=[pdf_attachment_id])
|
||||||
number = Column(String, unique=True) # Task Order Number
|
number = Column(String, unique=True) # Task Order Number
|
||||||
loa = Column(ARRAY(String)) # Line of Accounting (LOA)
|
loas = Column(ARRAY(String)) # Line of Accounting (LOA)
|
||||||
custom_clauses = Column(String) # Custom Clauses
|
custom_clauses = Column(String) # Custom Clauses
|
||||||
signer_dod_id = Column(String)
|
signer_dod_id = Column(String)
|
||||||
signed_at = Column(DateTime)
|
signed_at = Column(DateTime)
|
||||||
|
@ -26,7 +26,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
data: function() {
|
data: function() {
|
||||||
const loa_list = this.initialData['loa']
|
const loa_list = this.initialData['loas']
|
||||||
const loas = (loa_list.length > 0 ? loa_list : ['']).map(createLOA)
|
const loas = (loa_list.length > 0 ? loa_list : ['']).map(createLOA)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -98,11 +98,11 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li v-for="(loa, i) in loas" class="task-order__loa-list-item">
|
<li v-for="(loa, i) in loas" class="task-order__loa-list-item">
|
||||||
<div class="usa-input usa-input--validation--anything">
|
<div class="usa-input usa-input--validation--anything">
|
||||||
<label :for="'loa-' + i">
|
<label :for="'loas-' + i">
|
||||||
<div class="usa-input__title">Line of Accounting (LOA) #</div>
|
<div class="usa-input__title">Line of Accounting (LOA) #</div>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" v-model='loa.number' :id="'loa-' + i" placeholder="1234567890"/>
|
<input type="text" v-model='loa.number' :id="'loas-' + i" placeholder="1234567890"/>
|
||||||
<input type="hidden" :name="'loa-' + i" v-model='loa.number'/>
|
<input type="hidden" :name="'loas-' + i" v-model='loa.number'/>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -358,7 +358,7 @@ def test_submit_completed_ko_review_page_as_cor(client, user_session, pdf_upload
|
|||||||
"start_date": "02/10/2019",
|
"start_date": "02/10/2019",
|
||||||
"end_date": "03/10/2019",
|
"end_date": "03/10/2019",
|
||||||
"number": "1938745981",
|
"number": "1938745981",
|
||||||
"loa": ["0813458013405"],
|
"loas": ["0813458013405"],
|
||||||
"custom_clauses": "hi im a custom clause",
|
"custom_clauses": "hi im a custom clause",
|
||||||
"pdf": pdf_upload,
|
"pdf": pdf_upload,
|
||||||
}
|
}
|
||||||
@ -393,7 +393,7 @@ def test_submit_to_with_multiple_loas(client, user_session, pdf_upload):
|
|||||||
"start_date": "02/10/2019",
|
"start_date": "02/10/2019",
|
||||||
"end_date": "03/10/2019",
|
"end_date": "03/10/2019",
|
||||||
"number": "1938745981",
|
"number": "1938745981",
|
||||||
"loa": ["0813458013405", "1234567890", "5678901234"],
|
"loas": ["0813458013405", "1234567890", "5678901234"],
|
||||||
"custom_clauses": "hi im a custom clause",
|
"custom_clauses": "hi im a custom clause",
|
||||||
"pdf": pdf_upload,
|
"pdf": pdf_upload,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user