Skip to content

Commit

Permalink
Merge pull request #564 from CityOfNewYork/johnyu95-full-fire-marshal…
Browse files Browse the repository at this point in the history
…l-report

Full Fire Marshal Report
  • Loading branch information
johnyu95 authored Jun 12, 2023
2 parents 1dc43cf + 88e0bc5 commit ec9f38c
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/agency/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_custom_request_form_options(agency_ein):
CustomRequestForms.repeatable,
CustomRequestForms.category,
CustomRequestForms.minimum_required).filter_by(
agency_ein=agency_ein).order_by(asc(CustomRequestForms.category), asc(CustomRequestForms.id)).all()
agency_ein=agency_ein).order_by(asc(CustomRequestForms.category), asc(CustomRequestForms.order)).all()
return jsonify(custom_request_forms), 200


Expand Down Expand Up @@ -179,7 +179,7 @@ def get_request_types(agency_ein):
(custom_request_form.form_name, custom_request_form.form_name)
for custom_request_form in CustomRequestForms.query.filter_by(
agency_ein=agency_ein
).order_by(asc(CustomRequestForms.category), asc(CustomRequestForms.id)).all()
).order_by(asc(CustomRequestForms.category), asc(CustomRequestForms.order)).all()
]
request_types.insert(0, ("", "All"))
return jsonify({"request_types": request_types}), 200
Expand Down
2 changes: 2 additions & 0 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2012,6 +2012,7 @@ class CustomRequestForms(db.Model):
repeatable - an integer the determines if that form is repeatable. 0 = not repeatable, 1 = can be added twice, etc.
category - an integer to separate different types of custom forms for an agency
minimum_required - an integer to dictates the minimum amount of fields required for a successful submission
order - an integer to determine sorting order when displaying form options in the dropdown
"""

__tablename__ = "custom_request_forms"
Expand All @@ -2023,6 +2024,7 @@ class CustomRequestForms(db.Model):
repeatable = db.Column(db.Integer, nullable=False)
category = db.Column(db.Integer, nullable=True)
minimum_required = db.Column(db.Integer, nullable=True)
order = db.Column(db.Integer, nullable=True)

@classmethod
def populate(cls, json_name=None):
Expand Down
4 changes: 2 additions & 2 deletions app/report/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def generate_open_data_report(agency_ein: str, date_from: datetime, date_to: dat
Files.name,
Responses.dataset_description).filter(
Requests.agency_ein == agency_ein,
Requests.date_submitted.between(date_from, date_to),
Responses.date_modified.between(date_from, date_to),
Responses.privacy != PRIVATE,
Responses.is_dataset == True).all()

Expand All @@ -557,7 +557,7 @@ def generate_open_data_report(agency_ein: str, date_from: datetime, date_to: dat
Responses.dataset_description,
Links.url).filter(
Requests.agency_ein == agency_ein,
Requests.date_submitted.between(date_from, date_to),
Responses.date_modified.between(date_from, date_to),
Responses.privacy != PRIVATE,
Responses.is_dataset == True).all()

Expand Down
2 changes: 1 addition & 1 deletion app/request/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def __init__(self):
(custom_request_form.form_name, custom_request_form.form_name)
for custom_request_form in CustomRequestForms.query.filter_by(
agency_ein=default_agency.ein
).order_by(asc(CustomRequestForms.category), asc(CustomRequestForms.id)).all()
).order_by(asc(CustomRequestForms.category), asc(CustomRequestForms.order)).all()
]
self.request_type.choices.insert(0, ("", "All"))

Expand Down
127 changes: 123 additions & 4 deletions data/custom_request_forms.json
Original file line number Diff line number Diff line change
Expand Up @@ -686,23 +686,142 @@
"name": "fdny-form8-field9",
"values": [
"Building",
"Transportation",
"Vehicle/Transportation",
"Outdoors",
"Non-Fire Emergency"
],
"help_text": "If transportation is selected, please provide the model, make, and license plate in the description below. For Building, Outdoors, and Non-Fire Emergency please provide a short description below.",
"help_text": "If Vehicle/Transportation is selected, please provide the model, make, and license plate in the description below. For Building, Outdoors, and Non-Fire Emergency please provide a short description below.",
"required": false
}
},
{
"Description of Incident": {
"type": "textarea",
"name": "fdny-form8-field8",
"name": "fdny-form8-field10",
"required": true,
"error_message": "<span class=\"glyphicon glyphicon-exclamation-sign\"></span>&nbsp;<strong>Error, Description of Incident is required.</strong> Please provide a short description.",
"max_length": 5000,
"character_counter": true,
"help_text": "Please provide a short description of the incident. If Transportation was selected above, please make sure to provide the Type, Make, and Plate of the vehicle."
"help_text": "Please provide a short description of the incident. If Vehicle/Transportation was selected above, please make sure to provide the Type, Make, and Plate of the vehicle."
}
}
],
"repeatable": "1",
"category": "1",
"minimum_required": "0"
},
{
"agency_ein": "0057",
"form_name": "Full Fire Marshal Report",
"form_description": "",
"field_definitions": [
{
"Submission Method": {
"type": "radio",
"name": "fdny-form9-field1",
"values": [
"In Person/At FDNY",
"Online/At Home"
],
"help_text": "Please select an option.",
"required": true,
"error_message": "<span class=\"glyphicon glyphicon-exclamation-sign\"></span>&nbsp;<strong>Error, Submission Method is required.</strong> Please select an option."
}
},
{
"Incident Address": {
"type": "input",
"name": "fdny-form9-field2",
"help_text": "Please include the street name and house number.",
"required": true,
"error_message": "<span class=\"glyphicon glyphicon-exclamation-sign\"></span>&nbsp;<strong>Error, Incident Address is required.</strong> Please provide an address."
}
},
{
"Floor(s)": {
"type": "input",
"name": "fdny-form9-field3",
"required": false
}
},
{
"Apt(s)": {
"type": "input",
"name": "fdny-form9-field4",
"required": false
}
},
{
"Borough": {
"type": "select_dropdown",
"name": "fdny-form9-field5",
"values": [
"Brooklyn",
"Bronx",
"Manhattan",
"Queens",
"Staten Island"
],
"required": true,
"error_message": "<span class=\"glyphicon glyphicon-exclamation-sign\"></span>&nbsp;<strong>Error, Borough is required.</strong> Please select a borough."
}
},
{
"Bureau of Fire Investigation Job Number": {
"type":"input",
"name":"fdny-form9-field6",
"required": false,
"max_length": 11,
"character_counter": true
}
},
{
"Box #": {
"type": "input",
"name": "fdny-form9-field7",
"required": false
}
},
{
"Incident Date": {
"type": "date",
"name": "fdny-form9-field8",
"future_date_invalid": true,
"required": true,
"error_message": "<span class=\"glyphicon glyphicon-exclamation-sign\"></span>&nbsp;<strong>Error, Incident Date is required.</strong> Please select a date."
}
},
{
"Incident Report Number": {
"type": "input",
"name": "fdny-form9-field9",
"required": false,
"error_message": "<span class=\"glyphicon glyphicon-exclamation-sign\"></span>&nbsp;<strong>Error, Incident Report Number is required.</strong> Please provide the number."
}
},
{
"Incident Type": {
"type": "radio",
"name": "fdny-form9-field10",
"values": [
"Building",
"Vehicle/Transportation",
"Outdoors",
"Non-Fire Emergency"
],
"help_text": "If Vehicle/Transportation is selected, please provide the model, make, and license plate in the description below. For Building, Outdoors, and Non-Fire Emergency please provide a short description below.",
"required": false
}
},
{
"Description of Incident": {
"type": "textarea",
"name": "fdny-form9-field11",
"required": true,
"error_message": "<span class=\"glyphicon glyphicon-exclamation-sign\"></span>&nbsp;<strong>Error, Description of Incident is required.</strong> Please provide a short description.",
"max_length": 5000,
"character_counter": true,
"help_text": "Please provide a short description of the incident. If Vehicle/Transportation was selected above, please make sure to provide the Type, Make, and Plate of the vehicle."
}
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Add Order column to Custom Request Forms
Revision ID: 5e65ea2c1a5a
Revises: 19223de796a5
Create Date: 2023-06-01 16:36:05.167812
"""

# revision identifiers, used by Alembic.
revision = '5e65ea2c1a5a'
down_revision = '19223de796a5'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('custom_request_forms', sa.Column('order', sa.Integer(), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('custom_request_forms', 'order')
# ### end Alembic commands ###

0 comments on commit ec9f38c

Please sign in to comment.