Add columns relating to Funding and Oversight sections to TaskOrder model

This commit is contained in:
leigh-mil 2019-01-10 14:32:15 -05:00
parent 74ab102891
commit b18e3a9e10
11 changed files with 125 additions and 33 deletions

View File

@ -0,0 +1,32 @@
"""add funding columns to task order
Revision ID: 4536f50b25bc
Revises: 71cbe76c3b87
Create Date: 2019-01-10 14:24:03.101309
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '4536f50b25bc'
down_revision = '71cbe76c3b87'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('task_orders', sa.Column('attachment_id', postgresql.UUID(as_uuid=True), nullable=True))
op.add_column('task_orders', sa.Column('performance_length', sa.Integer(), nullable=True))
op.create_foreign_key(None, 'task_orders', 'attachments', ['attachment_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'task_orders', type_='foreignkey')
op.drop_column('task_orders', 'performance_length')
op.drop_column('task_orders', 'attachment_id')
# ### end Alembic commands ###

View File

@ -0,0 +1,32 @@
"""add oversight columns to task order
Revision ID: 7f2040715b0d
Revises: 4536f50b25bc
Create Date: 2019-01-10 16:34:20.185768
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7f2040715b0d'
down_revision = '4536f50b25bc'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('task_orders', sa.Column('cor_phone_number', sa.String(), nullable=True))
op.add_column('task_orders', sa.Column('ko_phone_number', sa.String(), nullable=True))
op.add_column('task_orders', sa.Column('so_phone_number', sa.String(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('task_orders', 'so_phone_number')
op.drop_column('task_orders', 'ko_phone_number')
op.drop_column('task_orders', 'cor_phone_number')
# ### end Alembic commands ###

View File

@ -37,14 +37,17 @@ class TaskOrders(object):
"ko_first_name", "ko_first_name",
"ko_last_name", "ko_last_name",
"ko_email", "ko_email",
"ko_phone_number",
"ko_dod_id", "ko_dod_id",
"cor_first_name", "cor_first_name",
"cor_last_name", "cor_last_name",
"cor_email", "cor_email",
"cor_phone_number",
"cor_dod_id", "cor_dod_id",
"so_first_name", "so_first_name",
"so_last_name", "so_last_name",
"so_email", "so_email",
"so_phone_number",
"so_dod_id", "so_dod_id",
], ],
} }

View File

@ -215,28 +215,28 @@ TEAM_EXPERIENCE = [
] ]
PERIOD_OF_PERFORMANCE_LENGTH = [ PERIOD_OF_PERFORMANCE_LENGTH = [
("1_month", "1 Month"), ("1", "1 Month"),
("2_months", "2 Months"), ("2", "2 Months"),
("3_months", "3 Months"), ("3", "3 Months"),
("4_months", "4 Months"), ("4", "4 Months"),
("5_months", "5 Months"), ("5", "5 Months"),
("6_months", "6 Months"), ("6", "6 Months"),
("7_months", "7 Months"), ("7", "7 Months"),
("8_months", "8 Months"), ("8", "8 Months"),
("9_months", "9 Months"), ("9", "9 Months"),
("10_months", "10 Months"), ("10", "10 Months"),
("11_months", "11 Months"), ("11", "11 Months"),
("1_year", "1 Year"), ("12", "1 Year"),
("1_year_1_month", "1 Year, 1 Month"), ("13", "1 Year, 1 Month"),
("1_year_2_months", "1 Year, 2 Months"), ("14", "1 Year, 2 Months"),
("1_year_3_months", "1 Year, 3 Months"), ("15", "1 Year, 3 Months"),
("1_year_4_months", "1 Year, 4 Months"), ("16", "1 Year, 4 Months"),
("1_year_5_months", "1 Year, 5 Months"), ("17", "1 Year, 5 Months"),
("1_year_6_months", "1 Year, 6 Months"), ("18", "1 Year, 6 Months"),
("1_year_7_months", "1 Year, 7 Months"), ("19", "1 Year, 7 Months"),
("1_hyear_8_months", "1 Year, 8 Months"), ("20", "1 Year, 8 Months"),
("1_year_9_months", "1 Year, 9 Months"), ("21", "1 Year, 9 Months"),
("1_year_10_months", "1 Year, 10 Months"), ("22", "1 Year, 10 Months"),
("1_year_11_months", "1 Year, 11 Months"), ("23", "1 Year, 11 Months"),
("2_years", "2 Years"), ("24", "2 Years"),
] ]

View File

@ -112,7 +112,7 @@ class OversightForm(CacheableForm):
) )
ko_last_name = StringField(translate("forms.task_order.oversight_last_name_label")) ko_last_name = StringField(translate("forms.task_order.oversight_last_name_label"))
ko_email = StringField(translate("forms.task_order.oversight_email_label")) ko_email = StringField(translate("forms.task_order.oversight_email_label"))
ko_phone = TelField( ko_phone_number = TelField(
translate("forms.task_order.oversight_phone_label"), validators=[PhoneNumber()] translate("forms.task_order.oversight_phone_label"), validators=[PhoneNumber()]
) )
ko_dod_id = StringField( ko_dod_id = StringField(
@ -125,7 +125,7 @@ class OversightForm(CacheableForm):
) )
cor_last_name = StringField(translate("forms.task_order.oversight_last_name_label")) cor_last_name = StringField(translate("forms.task_order.oversight_last_name_label"))
cor_email = StringField(translate("forms.task_order.oversight_email_label")) cor_email = StringField(translate("forms.task_order.oversight_email_label"))
cor_phone = TelField( cor_phone_number = TelField(
translate("forms.task_order.oversight_phone_label"), validators=[PhoneNumber()] translate("forms.task_order.oversight_phone_label"), validators=[PhoneNumber()]
) )
cor_dod_id = StringField( cor_dod_id = StringField(
@ -138,7 +138,7 @@ class OversightForm(CacheableForm):
) )
so_last_name = StringField(translate("forms.task_order.oversight_last_name_label")) so_last_name = StringField(translate("forms.task_order.oversight_last_name_label"))
so_email = StringField(translate("forms.task_order.oversight_email_label")) so_email = StringField(translate("forms.task_order.oversight_email_label"))
so_phone = TelField( so_phone_number = TelField(
translate("forms.task_order.oversight_phone_label"), validators=[PhoneNumber()] translate("forms.task_order.oversight_phone_label"), validators=[PhoneNumber()]
) )
so_dod_id = StringField( so_dod_id = StringField(

View File

@ -1,6 +1,6 @@
from enum import Enum from enum import Enum
from sqlalchemy import Column, Enum as SQLAEnum, Numeric, String, ForeignKey, Date from sqlalchemy import Column, Enum as SQLAEnum, Numeric, String, ForeignKey, Date, Integer
from sqlalchemy.types import ARRAY from sqlalchemy.types import ARRAY
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
@ -46,6 +46,9 @@ class TaskOrder(Base, mixins.TimestampsMixin):
team_experience = Column(String) # Team Experience team_experience = Column(String) # Team Experience
start_date = Column(Date) # Period of Performance start_date = Column(Date) # Period of Performance
end_date = Column(Date) end_date = Column(Date)
performance_length = Column(Integer)
attachment_id = Column(ForeignKey("attachments.id"))
pdf = relationship("Attachment")
clin_01 = Column(Numeric(scale=2)) clin_01 = Column(Numeric(scale=2))
clin_02 = Column(Numeric(scale=2)) clin_02 = Column(Numeric(scale=2))
clin_03 = Column(Numeric(scale=2)) clin_03 = Column(Numeric(scale=2))
@ -53,14 +56,17 @@ class TaskOrder(Base, mixins.TimestampsMixin):
ko_first_name = Column(String) # First Name ko_first_name = Column(String) # First Name
ko_last_name = Column(String) # Last Name ko_last_name = Column(String) # Last Name
ko_email = Column(String) # Email ko_email = Column(String) # Email
ko_phone_number = Column(String) # Phone Number
ko_dod_id = Column(String) # DOD ID ko_dod_id = Column(String) # DOD ID
cor_first_name = Column(String) # First Name cor_first_name = Column(String) # First Name
cor_last_name = Column(String) # Last Name cor_last_name = Column(String) # Last Name
cor_email = Column(String) # Email cor_email = Column(String) # Email
cor_phone_number = Column(String) # Phone Number
cor_dod_id = Column(String) # DOD ID cor_dod_id = Column(String) # DOD ID
so_first_name = Column(String) # First Name so_first_name = Column(String) # First Name
so_last_name = Column(String) # Last Name so_last_name = Column(String) # Last Name
so_email = Column(String) # Email so_email = Column(String) # Email
so_phone_number = Column(String) # Phone Number
so_dod_id = Column(String) # DOD ID so_dod_id = Column(String) # DOD 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) loa = Column(ARRAY(String)) # Line of Accounting (LOA)

View File

@ -167,7 +167,13 @@ class UpdateTaskOrderWorkflow(ShowTaskOrderWorkflow):
prefix = officer_type["prefix"] prefix = officer_type["prefix"]
officer_data = { officer_data = {
field: getattr(self.task_order, prefix + "_" + field) field: getattr(self.task_order, prefix + "_" + field)
for field in ["first_name", "last_name", "email", "dod_id"] for field in [
"first_name",
"last_name",
"email",
"phone_number",
"dod_id",
]
} }
officer = TaskOrders.add_officer( officer = TaskOrders.add_officer(
self.user, self.task_order, officer_type["role"], officer_data self.user, self.task_order, officer_type["role"], officer_data

View File

@ -21,7 +21,7 @@
</legend> </legend>
</fieldset> </fieldset>
</div> </div>
{{ UserInfo(form.ko_first_name, form.ko_last_name, form.ko_email, form.ko_phone) }} {{ UserInfo(form.ko_first_name, form.ko_last_name, form.ko_email, form.ko_phone_number) }}
{{ CheckboxInput(form.ko_invite) }} {{ CheckboxInput(form.ko_invite) }}
{{ TextInput(form.ko_dod_id, placeholder="1234567890", tooltip="Why", tooltip_title='Why')}} {{ TextInput(form.ko_dod_id, placeholder="1234567890", tooltip="Why", tooltip_title='Why')}}
@ -37,7 +37,7 @@
</legend> </legend>
</fieldset> </fieldset>
</div> </div>
{{ UserInfo(form.cor_first_name, form.cor_last_name, form.cor_email, form.cor_phone) }} {{ UserInfo(form.cor_first_name, form.cor_last_name, form.cor_email, form.cor_phone_number) }}
{{ CheckboxInput(form.cor_invite) }} {{ CheckboxInput(form.cor_invite) }}
{{ TextInput(form.cor_dod_id, placeholder="1234567890", tooltip="Why", tooltip_title='Why')}} {{ TextInput(form.cor_dod_id, placeholder="1234567890", tooltip="Why", tooltip_title='Why')}}
@ -45,7 +45,7 @@
<h3>{{ "task_orders.new.oversight.so_info_title" | translate }}</h3> <h3>{{ "task_orders.new.oversight.so_info_title" | translate }}</h3>
<p>{{ "task_orders.new.oversight.so_info_paragraph" | translate }}</p> <p>{{ "task_orders.new.oversight.so_info_paragraph" | translate }}</p>
{{ UserInfo(form.so_first_name, form.so_last_name, form.so_email, form.so_phone) }} {{ UserInfo(form.so_first_name, form.so_last_name, form.so_email, form.so_phone_number) }}
{{ CheckboxInput(form.so_invite) }} {{ CheckboxInput(form.so_invite) }}
{{ TextInput(form.so_dod_id, placeholder="1234567890", tooltip="Why", tooltip_title='Why')}} {{ TextInput(form.so_dod_id, placeholder="1234567890", tooltip="Why", tooltip_title='Why')}}

View File

@ -27,7 +27,7 @@
<div class="row"> <div class="row">
<div class="col col--grow"> <div class="col col--grow">
<h3>Period of Performance length {{ TOEditLink(screen=2) }}</h3> <h3>Period of Performance length {{ TOEditLink(screen=2) }}</h3>
{{ task_order.period or RequiredLabel() }} {{ task_order.performance_length or RequiredLabel() }}
</div> </div>
<div class="col col--grow"> <div class="col col--grow">

View File

@ -383,16 +383,26 @@ class TaskOrderFactory(Base):
end_date = factory.LazyFunction( end_date = factory.LazyFunction(
lambda *args: random_future_date(year_min=2, year_max=5) lambda *args: random_future_date(year_min=2, year_max=5)
) )
performance_length = random.randint(1, 24)
ko_first_name = factory.Faker("first_name") ko_first_name = factory.Faker("first_name")
ko_last_name = factory.Faker("last_name") ko_last_name = factory.Faker("last_name")
ko_email = factory.Faker("email") ko_email = factory.Faker("email")
ko_phone_number = factory.LazyFunction(
lambda: "".join(random.choices(string.digits, k=10))
)
ko_dod_id = factory.LazyFunction(random_dod_id) ko_dod_id = factory.LazyFunction(random_dod_id)
cor_first_name = factory.Faker("first_name") cor_first_name = factory.Faker("first_name")
cor_last_name = factory.Faker("last_name") cor_last_name = factory.Faker("last_name")
cor_email = factory.Faker("email") cor_email = factory.Faker("email")
cor_phone_number = factory.LazyFunction(
lambda: "".join(random.choices(string.digits, k=10))
)
cor_dod_id = factory.LazyFunction(random_dod_id) cor_dod_id = factory.LazyFunction(random_dod_id)
so_first_name = factory.Faker("first_name") so_first_name = factory.Faker("first_name")
so_last_name = factory.Faker("last_name") so_last_name = factory.Faker("last_name")
so_email = factory.Faker("email") so_email = factory.Faker("email")
so_phone_number = factory.LazyFunction(
lambda: "".join(random.choices(string.digits, k=10))
)
so_dod_id = factory.LazyFunction(random_dod_id) so_dod_id = factory.LazyFunction(random_dod_id)

View File

@ -224,7 +224,10 @@ def test_task_order_officer_accepts_invite(monkeypatch, client, user_session):
"ko_first_name": user_info["first_name"], "ko_first_name": user_info["first_name"],
"ko_last_name": user_info["last_name"], "ko_last_name": user_info["last_name"],
"ko_email": user_info["email"], "ko_email": user_info["email"],
"ko_phone_number": user_info["phone_number"],
"ko_dod_id": user_info["dod_id"], "ko_dod_id": user_info["dod_id"],
"cor_phone_number": user_info["phone_number"],
"so_phone_number": user_info["phone_number"],
"so_dod_id": task_order.so_dod_id, "so_dod_id": task_order.so_dod_id,
"cor_dod_id": task_order.cor_dod_id, "cor_dod_id": task_order.cor_dod_id,
"ko_invite": True, "ko_invite": True,