Merge pull request #1051 from dod-ccpo/remove-loas

Remove LOAs
This commit is contained in:
graham-dds 2019-08-30 11:52:52 -04:00 committed by GitHub
commit a512a47a48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 32 additions and 127 deletions

View File

@ -0,0 +1,32 @@
"""Remove LOAs
Revision ID: 4a3122ffe898
Revises: fda6bd7e1b65
Create Date: 2019-08-29 16:28:45.017550
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '4a3122ffe898' # pragma: allowlist secret
down_revision = 'fda6bd7e1b65' # pragma: allowlist secret
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('clins_task_order_id_fkey', 'clins', type_='foreignkey')
op.create_foreign_key('clins_task_order_id_fkey', 'clins', 'task_orders', ['task_order_id'], ['id'])
op.drop_column('clins', 'loas')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('clins', sa.Column('loas', postgresql.ARRAY(sa.VARCHAR()), server_default=sa.text("'{}'::character varying[]"), autoincrement=False, nullable=True))
op.drop_constraint('clins_task_order_id_fkey', 'clins', type_='foreignkey')
op.create_foreign_key('clins_task_order_id_fkey', 'clins', 'task_orders', ['task_order_id'], ['id'], ondelete='CASCADE')
# ### end Alembic commands ###

View File

@ -56,7 +56,6 @@ class TaskOrders(BaseDomainClass):
clin = CLIN( clin = CLIN(
task_order_id=task_order_id, task_order_id=task_order_id,
number=clin_data["number"], number=clin_data["number"],
loas=clin_data["loas"],
start_date=clin_data["start_date"], start_date=clin_data["start_date"],
end_date=clin_data["end_date"], end_date=clin_data["end_date"],
obligated_amount=clin_data["obligated_amount"], obligated_amount=clin_data["obligated_amount"],

View File

@ -47,7 +47,6 @@ class CLINForm(FlaskForm):
label=translate("task_orders.form.obligated_funds_label"), label=translate("task_orders.form.obligated_funds_label"),
validators=[Optional()], validators=[Optional()],
) )
loas = FieldList(StringField())
def validate(self, *args, **kwargs): def validate(self, *args, **kwargs):
valid = super().validate(*args, **kwargs) valid = super().validate(*args, **kwargs)

View File

@ -1,6 +1,5 @@
from enum import Enum from enum import Enum
from sqlalchemy import Column, Date, Enum as SQLAEnum, ForeignKey, Numeric, String from sqlalchemy import Column, Date, Enum as SQLAEnum, ForeignKey, Numeric, String
from sqlalchemy.dialects.postgresql import ARRAY
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from atst.models import Base, mixins, types from atst.models import Base, mixins, types
@ -22,7 +21,6 @@ class CLIN(Base, mixins.TimestampsMixin):
task_order = relationship("TaskOrder") task_order = relationship("TaskOrder")
number = Column(String, nullable=True) number = Column(String, nullable=True)
loas = Column(ARRAY(String), server_default="{}", nullable=True)
start_date = Column(Date, nullable=True) start_date = Column(Date, nullable=True)
end_date = Column(Date, nullable=True) end_date = Column(Date, nullable=True)
obligated_amount = Column(Numeric(scale=2), nullable=True) obligated_amount = Column(Numeric(scale=2), nullable=True)
@ -46,7 +44,6 @@ class CLIN(Base, mixins.TimestampsMixin):
self.end_date, self.end_date,
self.obligated_amount, self.obligated_amount,
self.jedi_clin_type, self.jedi_clin_type,
len(self.loas),
] ]
) )

View File

@ -20,10 +20,6 @@ export default {
props: { props: {
initialClinIndex: Number, initialClinIndex: Number,
initialLoaCount: {
type: Number,
default: 0,
},
initialClinType: String, initialClinType: String,
initialAmount: { initialAmount: {
type: Number, type: Number,
@ -40,8 +36,6 @@ export default {
}, },
data: function() { data: function() {
const loas = this.initialLoaCount == 0 ? 1 : 0
const indexOffset = this.initialLoaCount
const start = !!this.initialStartDate const start = !!this.initialStartDate
? new Date(this.initialStartDate) ? new Date(this.initialStartDate)
: undefined : undefined
@ -53,8 +47,6 @@ export default {
return { return {
clinIndex: this.initialClinIndex, clinIndex: this.initialClinIndex,
indexOffset: this.initialLoaCount,
loas: loas,
clinType: this.initialClinType, clinType: this.initialClinType,
amount: this.initialAmount || 0, amount: this.initialAmount || 0,
startDate: start, startDate: start,
@ -82,14 +74,6 @@ export default {
}, },
methods: { methods: {
addLoa: function(event) {
++this.loas
},
loaIndex: function(index) {
return index + this.indexOffset - 1
},
clinChangeEvent: function() { clinChangeEvent: function() {
emitEvent('clin-change', this, { emitEvent('clin-change', this, {
id: this._uid, id: this._uid,

View File

@ -47,12 +47,6 @@
td { td {
padding: 0.8rem; padding: 0.8rem;
&.task-order__loa {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
} }
} }
@ -117,29 +111,6 @@
button { button {
margin-bottom: $gap * 3; margin-bottom: $gap * 3;
} }
.task-order__loa-fieldset {
.usa-input__title {
padding: 0 0 0.4rem 0;
font-size: 1.7rem;
}
.usa-input {
margin: 0;
}
input {
margin: $gap 0;
&:first-child {
margin-top: 0;
}
&:last-child {
margin-bottom: 0;
}
}
}
} }
.usa-input__title, .usa-input__title,

View File

@ -43,7 +43,6 @@
<th>{{ "task_orders.review.clins.obligated" | translate }}</th> <th>{{ "task_orders.review.clins.obligated" | translate }}</th>
<th>{{ "task_orders.review.clins.pop_start" | translate }}</th> <th>{{ "task_orders.review.clins.pop_start" | translate }}</th>
<th>{{ "task_orders.review.clins.pop_end" | translate }}</th> <th>{{ "task_orders.review.clins.pop_end" | translate }}</th>
<th>{{ "task_orders.review.clins.loa" | translate }}</th>
</tr> </tr>
</thead> </thead>
@ -59,14 +58,6 @@
</td> </td>
<td>{{ clin.start_date | formattedDate }}</td> <td>{{ clin.start_date | formattedDate }}</td>
<td>{{ clin.end_date | formattedDate }}</td> <td>{{ clin.end_date | formattedDate }}</td>
<td class="task-order__loa">
{% for loa in clin.loas %}
<span title='{{ loa }}'>
{{ loa }}
</span>
<br />
{% endfor %}
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -11,43 +11,10 @@
{% set previous_button_link = url_for("task_orders.form_step_two_add_number", task_order_id=task_order_id) %} {% set previous_button_link = url_for("task_orders.form_step_two_add_number", task_order_id=task_order_id) %}
{% set step = "3" %} {% set step = "3" %}
{% macro LOAInput() %}
<div v-for="loa in loas">
<textinput :name="'clins-' + clinIndex + '-loas-' + loaIndex(loa)" :watch='true' inline-template>
<div class="usa-input usa-input--validation--anything">
<masked-input
v-on:input='onInput'
v-on:blur='onBlur'
v-on:change='onChange'
v-bind:value='value'
v-bind:mask='mask'
v-bind:pipe='pipe'
v-bind:keep-char-positions='keepCharPositions'
v-bind:aria-invalid='showError'
type='text'
:id='name'
ref='input'>
</masked-input>
<input type='hidden' v-bind:value='rawValue' :name='name' />
</div>
</textinput>
</div>
<button
class="icon-link"
v-on:click="addLoa"
type="button">
{{ Icon('plus') }}
<span>{{ 'task_orders.form.add_loa' | translate }}</span>
</button>
{% endmacro %}
{% macro CLINFields(fields=None, index=None) %} {% macro CLINFields(fields=None, index=None) %}
<clin-fields <clin-fields
{% if fields %} {% if fields %}
v-bind:initial-clin-index='{{ index }}' v-bind:initial-clin-index='{{ index }}'
v-bind:initial-loa-count="{{ fields.loas.data | length or 0 }}"
v-bind:initial-clin-type="'{{ fields.jedi_clin_type.data }}'" v-bind:initial-clin-type="'{{ fields.jedi_clin_type.data }}'"
v-bind:initial-amount='{{ fields.obligated_amount.data or 0 }}' v-bind:initial-amount='{{ fields.obligated_amount.data or 0 }}'
v-bind:initial-start-date="'{{ fields.start_date.data | string }}'" v-bind:initial-start-date="'{{ fields.start_date.data | string }}'"
@ -125,19 +92,6 @@
</div> </div>
</div> </div>
<fieldset class="task-order__loa-fieldset">
<legend>
<div class="usa-input__title">
{{ 'task_orders.form.loa_label' | translate }}
</div>
</legend>
{% for loa in fields.loas %}
{{ TextInput(loa, showLabel=False, watch=True, show_validation=False) }}
{% endfor %}
{{ LOAInput() }}
</fieldset>
<div class="form-row"> <div class="form-row">
{% if fields %} {% if fields %}
<div class="form-col form-col--half"> <div class="form-col form-col--half">

View File

@ -84,7 +84,6 @@ def test_create_adds_clins():
"start_date": date(2020, 1, 1), "start_date": date(2020, 1, 1),
"end_date": date(2021, 1, 1), "end_date": date(2021, 1, 1),
"obligated_amount": Decimal("5000"), "obligated_amount": Decimal("5000"),
"loas": ["123123123123", "345345234"],
}, },
{ {
"jedi_clin_type": "JEDI_CLIN_1", "jedi_clin_type": "JEDI_CLIN_1",
@ -92,7 +91,6 @@ def test_create_adds_clins():
"start_date": date(2020, 1, 1), "start_date": date(2020, 1, 1),
"end_date": date(2021, 1, 1), "end_date": date(2021, 1, 1),
"obligated_amount": Decimal("5000"), "obligated_amount": Decimal("5000"),
"loas": ["78979087"],
}, },
] ]
task_order = TaskOrders.create( task_order = TaskOrders.create(
@ -115,7 +113,6 @@ def test_update_adds_clins():
"start_date": date(2020, 1, 1), "start_date": date(2020, 1, 1),
"end_date": date(2021, 1, 1), "end_date": date(2021, 1, 1),
"obligated_amount": Decimal("5000"), "obligated_amount": Decimal("5000"),
"loas": ["123123123123", "345345234"],
}, },
{ {
"jedi_clin_type": "JEDI_CLIN_1", "jedi_clin_type": "JEDI_CLIN_1",
@ -123,7 +120,6 @@ def test_update_adds_clins():
"start_date": date(2020, 1, 1), "start_date": date(2020, 1, 1),
"end_date": date(2021, 1, 1), "end_date": date(2021, 1, 1),
"obligated_amount": Decimal("5000"), "obligated_amount": Decimal("5000"),
"loas": ["78979087"],
}, },
] ]
task_order = TaskOrders.create( task_order = TaskOrders.create(
@ -148,7 +144,6 @@ def test_update_does_not_duplicate_clins():
"start_date": date(2020, 1, 1), "start_date": date(2020, 1, 1),
"end_date": date(2021, 1, 1), "end_date": date(2021, 1, 1),
"obligated_amount": Decimal("5000"), "obligated_amount": Decimal("5000"),
"loas": ["123123123123", "345345234"],
}, },
{ {
"jedi_clin_type": "JEDI_CLIN_1", "jedi_clin_type": "JEDI_CLIN_1",
@ -156,7 +151,6 @@ def test_update_does_not_duplicate_clins():
"start_date": date(2020, 1, 1), "start_date": date(2020, 1, 1),
"end_date": date(2021, 1, 1), "end_date": date(2021, 1, 1),
"obligated_amount": Decimal("5000"), "obligated_amount": Decimal("5000"),
"loas": ["78979087"],
}, },
] ]
task_order = TaskOrders.update( task_order = TaskOrders.update(

View File

@ -41,10 +41,6 @@ def random_future_date(year_min=1, year_max=5):
return _random_date(year_min, year_max, operator.add) return _random_date(year_min, year_max, operator.add)
def random_loa_numbers():
return ["".join(random.choices(string.digits, k=43))]
def _random_date(year_min, year_max, operation): def _random_date(year_min, year_max, operation):
if year_min == year_max: if year_min == year_max:
inc = year_min inc = year_min
@ -299,7 +295,6 @@ class CLINFactory(Base):
jedi_clin_type = factory.LazyFunction( jedi_clin_type = factory.LazyFunction(
lambda *args: random.choice(list(clin.JEDICLINType)) lambda *args: random.choice(list(clin.JEDICLINType))
) )
loas = factory.LazyFunction(random_loa_numbers)
class NotificationRecipientFactory(Base): class NotificationRecipientFactory(Base):

View File

@ -20,4 +20,3 @@ def test_is_obligated():
def test_is_completed(): def test_is_completed():
assert CLINFactory.create().is_completed assert CLINFactory.create().is_completed
assert not CLINFactory.create(loas=[]).is_completed

View File

@ -194,14 +194,11 @@ def test_task_orders_submit_form_step_three_add_clins(client, user_session, task
"clins-0-start_date": "01/01/2020", "clins-0-start_date": "01/01/2020",
"clins-0-end_date": "01/01/2021", "clins-0-end_date": "01/01/2021",
"clins-0-obligated_amount": "5000", "clins-0-obligated_amount": "5000",
"clins-0-loas-0": "123123123123",
"clins-0-loas-1": "345345234",
"clins-1-jedi_clin_type": "JEDI_CLIN_1", "clins-1-jedi_clin_type": "JEDI_CLIN_1",
"clins-1-number": "12312", "clins-1-number": "12312",
"clins-1-start_date": "01/01/2020", "clins-1-start_date": "01/01/2020",
"clins-1-end_date": "01/01/2021", "clins-1-end_date": "01/01/2021",
"clins-1-obligated_amount": "5000", "clins-1-obligated_amount": "5000",
"clins-1-loas-0": "78979087",
} }
response = client.post( response = client.post(
url_for( url_for(
@ -224,7 +221,6 @@ def test_task_orders_submit_form_step_three_add_clins_existing_to(
"start_date": "01/01/2020", "start_date": "01/01/2020",
"end_date": "01/01/2021", "end_date": "01/01/2021",
"obligated_amount": "5000", "obligated_amount": "5000",
"loas": ["123123123123", "345345234"],
}, },
{ {
"jedi_clin_type": "JEDI_CLIN_1", "jedi_clin_type": "JEDI_CLIN_1",
@ -232,7 +228,6 @@ def test_task_orders_submit_form_step_three_add_clins_existing_to(
"start_date": "01/01/2020", "start_date": "01/01/2020",
"end_date": "01/01/2021", "end_date": "01/01/2021",
"obligated_amount": "5000", "obligated_amount": "5000",
"loas": ["78979087"],
}, },
] ]
TaskOrders.create_clins(task_order.id, clin_list) TaskOrders.create_clins(task_order.id, clin_list)
@ -245,7 +240,6 @@ def test_task_orders_submit_form_step_three_add_clins_existing_to(
"clins-0-start_date": "01/01/2020", "clins-0-start_date": "01/01/2020",
"clins-0-end_date": "01/01/2021", "clins-0-end_date": "01/01/2021",
"clins-0-obligated_amount": "5000", "clins-0-obligated_amount": "5000",
"clins-0-loas-0": "123123123123",
} }
response = client.post( response = client.post(
url_for( url_for(

View File

@ -546,7 +546,6 @@ def test_task_orders_new_post_routes(post_url_assert_status):
"clins-0-start_date": "01/01/2020", "clins-0-start_date": "01/01/2020",
"clins-0-end_date": "01/01/2021", "clins-0-end_date": "01/01/2021",
"clins-0-obligated_amount": "5000", "clins-0-obligated_amount": "5000",
"clins-0-loas-0": "123123123123",
}, },
), ),
] ]

View File

@ -361,10 +361,8 @@ task_orders:
obligated: Obligated obligated: Obligated
pop_start: PoP Start pop_start: PoP Start
pop_end: PoP End pop_end: PoP End
loa: LOA
form: form:
add_clin: Enter another CLIN add_clin: Enter another CLIN
add_loa: Enter another line of accounting
add_to_header: Add your task order add_to_header: Add your task order
add_to_description: Now, refer to your document to find the 13-digit task order number. It should be located at lorem ipsum dolar. From now on we'll refer to this portion of funding by the recorded task order number. add_to_description: Now, refer to your document to find the 13-digit task order number. It should be located at lorem ipsum dolar. From now on we'll refer to this portion of funding by the recorded task order number.
clin_title: Enter CLINs clin_title: Enter CLINs
@ -376,7 +374,6 @@ task_orders:
cloud_funding_text: Data must match with what is in your uploaded document. cloud_funding_text: Data must match with what is in your uploaded document.
draft_alert_title: Your information has been saved draft_alert_title: Your information has been saved
draft_alert_message: You can return to the Task Order Builder to enter missing information. Once you are finished, youll be ready to submit this request. draft_alert_message: You can return to the Task Order Builder to enter missing information. Once you are finished, youll be ready to submit this request.
loa_label: 'Enter line of accounting (43 characters)'
obligated_funds_label: Enter obligated funds for Base CLIN obligated_funds_label: Enter obligated funds for Base CLIN
pop_end: 'Period of Performance (PoP) end date' pop_end: 'Period of Performance (PoP) end date'
pop_start: 'Period of Performance (PoP) start date' pop_start: 'Period of Performance (PoP) start date'