Merge pull request #525 from dod-ccpo/fix-task-order-funding-submisssion

Fix task order funding submisssion
This commit is contained in:
patricksmithdds 2019-01-09 09:41:59 -05:00 committed by GitHub
commit 793622b791
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 36 additions and 12 deletions

View File

@ -85,6 +85,11 @@ class UnclassifiedFundingForm(FundingForm):
clin_02 = IntegerField("CLIN 02: Classified (available soon)")
clin_04 = IntegerField("CLIN 04: Classified (available soon)")
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.clin_02.data = "0"
self.clin_04.data = "0"
class OversightForm(CacheableForm):
ko_first_name = StringField("First Name")

View File

@ -1,3 +1,5 @@
from copy import deepcopy
from flask import (
request as http_request,
render_template,
@ -90,7 +92,7 @@ class ShowTaskOrderWorkflow:
@property
def display_screens(self):
screen_info = TASK_ORDER_SECTIONS.copy()
screen_info = deepcopy(TASK_ORDER_SECTIONS)
if self.task_order:
for section in screen_info:
@ -108,10 +110,11 @@ class UpdateTaskOrderWorkflow(ShowTaskOrderWorkflow):
self.task_order_id = task_order_id
self._task_order = None
self._section = TASK_ORDER_SECTIONS[screen - 1]
self._form = self._section["form"](self.form_data)
@property
def form(self):
return self._section["form"](self.form_data)
return self._form
@property
def workspace(self):

View File

@ -37,8 +37,10 @@
<span class='usa-input__help'>{{ description | safe }}</span>
{% endif %}
<span v-show='showError'>{{ Icon('alert',classes="icon-validation") }}</span>
<span v-show='showValid'>{{ Icon('ok',classes="icon-validation") }}</span>
{% if not disabled %}
<span v-show='showError'>{{ Icon('alert',classes="icon-validation") }}</span>
<span v-show='showValid'>{{ Icon('ok',classes="icon-validation") }}</span>
{% endif %}
</label>

View File

@ -11,8 +11,6 @@
{% block form %}
{% include "fragments/flash.html" %}
<h3>Basic Information</h3>
{{ TextInput(form.portfolio_name, placeholder="The name of your office or organization") }}
{{ TextInput(form.scope, paragraph=True) }}

View File

@ -10,8 +10,6 @@
{% block form %}
{% include "fragments/flash.html" %}
<funding inline-template v-bind:initial-data='{{ form.data|tojson }}'>
<div>
<!-- Get Funding Section -->

View File

@ -9,8 +9,6 @@
{% block form %}
{% include "fragments/flash.html" %}
<!-- Oversight Section -->
<h3>Contracting Officer (KO) Information</h3>
{{ UserInfo(form.ko_first_name, form.ko_last_name, form.ko_email, form.ko_dod_id) }}

View File

@ -10,8 +10,6 @@
{% block form %}
{% include "fragments/flash.html" %}
{% macro TOEditLink(screen=1) %}
{% if task_order %}
{{ EditLink(url_for("task_orders.new", screen=screen, task_order_id=task_order.id)) }}

View File

@ -70,6 +70,28 @@ def test_create_new_task_order(client, user_session):
assert url_for("task_orders.new", screen=4) in response.headers["Location"]
def test_task_order_form_shows_errors(client, user_session):
creator = UserFactory.create()
user_session(creator)
to = TaskOrderFactory.create()
task_order_data = TaskOrderFactory.dictionary()
funding_data = slice_data_for_section(task_order_data, "funding")
funding_data = serialize_dates(funding_data)
funding_data.update({"clin_01": "one milllllion dollars"})
response = client.post(
url_for("task_orders.update", screen=2, task_order_id=to.id),
data=funding_data,
follow_redirects=False,
)
body = response.data.decode()
assert "There were some errors" in body
assert "Not a valid integer" in body
def test_show_task_order():
workflow = ShowTaskOrderWorkflow()
assert workflow.task_order is None