add expiration_date to manual task order form
This commit is contained in:
dandds 2018-09-18 08:56:58 -04:00 committed by GitHub
commit 955a735f96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 62 additions and 4 deletions

View File

@ -0,0 +1,28 @@
"""add expiration date to task order
Revision ID: 4f4defb7b440
Revises: 4c425f17bfe8
Create Date: 2018-09-17 15:22:33.240310
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4f4defb7b440'
down_revision = '4c425f17bfe8'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('task_order', sa.Column('expiration_date', sa.Date(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('task_order', 'expiration_date')
# ### end Alembic commands ###

View File

@ -1,5 +1,6 @@
import re
from wtforms.fields.html5 import EmailField
import pendulum
from wtforms.fields.html5 import DateField, EmailField
from wtforms.fields import StringField, FileField
from wtforms.validators import InputRequired, Required, Email, Regexp
from flask_wtf.file import FileAllowed
@ -11,6 +12,7 @@ from atst.domain.task_orders import TaskOrders
from .fields import NewlineListField, SelectField
from .forms import ValidatedForm
from .data import FUNDING_TYPES
from .validators import DateRange
PE_REGEX = re.compile(
@ -166,6 +168,20 @@ class ExtendedFinancialForm(BaseFinancialForm):
funding_type_other = StringField("If other, please specify")
expiration_date = DateField(
"Task Order Expiration Date",
description="Please enter the expiration date for the Task Order",
validators=[
Required(),
DateRange(
lower_bound=pendulum.duration(days=0),
upper_bound=pendulum.duration(years=100),
message="Must be a date in the future.",
),
],
format="%m/%d/%Y",
)
clin_0001 = StringField(
"<dl><dt>CLIN 0001</dt> - <dd>Unclassified IaaS and PaaS Amount</dd></dl>",
validators=[InputRequired()],

View File

@ -35,7 +35,7 @@ class RequestRevision(Base, TimestampsMixin):
# details_of_use
jedi_usage = Column(String)
start_date = Column(Date())
start_date = Column(Date)
cloud_native = Column(String)
dollar_value = Column(Integer)
dod_component = Column(String)
@ -60,7 +60,7 @@ class RequestRevision(Base, TimestampsMixin):
fname_request = Column(String)
lname_request = Column(String)
service_branch = Column(String)
date_latest_training = Column(Date())
date_latest_training = Column(Date)
# financial_verification
pe_id = Column(String)

View File

@ -1,6 +1,6 @@
from enum import Enum
from sqlalchemy import Column, Integer, String, ForeignKey, Enum as SQLAEnum
from sqlalchemy import Column, Integer, String, ForeignKey, Enum as SQLAEnum, Date
from sqlalchemy.orm import relationship
from atst.models import Base
@ -32,6 +32,7 @@ class TaskOrder(Base):
clin_1003 = Column(Integer)
clin_2001 = Column(Integer)
clin_2003 = Column(Integer)
expiration_date = Column(Date)
attachment_id = Column(ForeignKey("attachments.id"))
pdf = relationship("Attachment")

View File

@ -146,5 +146,6 @@ def view_request_details(request_id=None):
"requests/details.html",
data=data,
request=request,
financial_review=financial_review,
requires_fv_action=requires_fv_action,
)

View File

@ -155,6 +155,8 @@
{{ DefinitionReviewField("If other, please specify", "task_order", "funding_type_other") }}
{% endif %}
{{ DefinitionReviewField("Task Order Expiration Date", "task_order", "expiration_date") }}
{{ DefinitionReviewField("<dl><dt>CLIN 0001</dt> - <dd>Unclassified IaaS and PaaS Amount</dd></dl>", "task_order", "clin_0001", filter="dollars") }}
{{ DefinitionReviewField("<dl><dt>CLIN 0003</dt> - <dd>Unclassified Cloud Support Package</dd></dl>", "task_order", "clin_0003", filter="dollars") }}

View File

@ -3,6 +3,7 @@
{% from "components/alert.html" import Alert %}
{% from "components/text_input.html" import TextInput %}
{% from "components/options_input.html" import OptionsInput %}
{% from "components/date_input.html" import DateInput %}
{% block content %}
@ -72,6 +73,8 @@
{{ TextInput(f.funding_type_other) }}
</template>
{{ DateInput(f.expiration_date, placeholder='MM / DD / YYYY', validation='date', tooltip='Please enter the expiration date for the task order only and do not include options that you may choose to exercise in the future.') }}
{{ TextInput(
f.clin_0001,
validation='dollars'

View File

@ -1,4 +1,5 @@
import os
import datetime
import pytest
import alembic.config
import alembic.command
@ -124,6 +125,7 @@ def extended_financial_verification_data(pdf_upload):
return {
"funding_type": "RDTE",
"funding_type_other": "other",
"expiration_date": "1/1/{}".format(datetime.date.today().year + 1),
"clin_0001": "50000",
"clin_0003": "13000",
"clin_1001": "30000",

View File

@ -170,6 +170,11 @@ class TaskOrderFactory(Base):
funding_type = FundingType.PROC
funding_type_other = None
number = "toABC123"
expiration_date = factory.LazyFunction(
lambda: datetime.date(
datetime.date.today().year + random.randrange(1, 15), 1, 1
)
)
clin_0001 = random.randrange(100, 100000)
clin_0003 = random.randrange(100, 100000)
clin_1001 = random.randrange(100, 100000)