Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,15 @@ def show_request(request_id):

# add follow-on closure data, fix types, etc, etc
by_id = {}

follow_on_open_count = 0
follow_on_close_count = 0


serve_nm_lst = [s['service_name'] for s in
open311tools.services(app.config['OPEN311_SERVER'],
app.config['OPEN311_API_KEY'])]

for note in sr['notes']:
if note['type'] in ('follow_on', 'follow_on_created', 'follow_on_closed'):
note_sr_id = note['extended_attributes']['service_request_id']
Expand All @@ -158,6 +165,12 @@ def show_request(request_id):
follow_on_open_count += 1
by_id[note_sr_id] = note

serv_nm = note['extended_attributes']['service_name']
print serv_nm
print open311tools.services(app.config['OPEN311_SERVER'], app.config['OPEN311_API_KEY'])
if serv_nm in serve_nm_lst:
note['link_url'] = url_for('show_request', request_id=note_sr_id)

elif note['type'] == 'follow_on_closed' or note['description'].endswith('Closed'):
follow_on_close_count += 1
note['type'] = 'follow_on_closed'
Expand All @@ -169,6 +182,7 @@ def show_request(request_id):
if follow_on_open_count >0:
# remove the notes that claim the request is closed
sr['notes'] = [n for n in sr['notes'] if not n['type'] == 'closed']

# set the request to open
sr['status'] = 'open'

Expand All @@ -187,6 +201,12 @@ def show_request(request_id):
# add the extra note
sr['notes'].append(tmp_note)


if 'parent_service_request_id' in sr['extended_attributes']:
p_req_id = sr['extended_attributes']['parent_service_request_id']
sr['parent_url'] = url_for('show_request', request_id=p_req_id)


# if there's no activity yet, show 'under review'
if relevant_notes == 0:
sr['notes'].append({
Expand Down
15 changes: 15 additions & 0 deletions templates/service_request.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,16 @@ <h2 class="activity_header">Activity</h2>

<div class="details">
<p>

{% if note.type == 'follow_on_created' %}
<strong>Transferred to:</strong><br/>

{% if note.link_url %}
<strong><a href = {{note.link_url}}>{{ note.extended_attributes.service_name }}</a></strong><br/>
{% else %}

<strong>{{ note.extended_attributes.service_name }}</strong><br/>
{% endif %}
Department: {{ note.extended_attributes.agency_responsible }}
{% if note.extended_attributes.closed_datetime %}
<div>
Expand Down Expand Up @@ -106,12 +113,20 @@ <h2 class="activity_header">Activity</h2>
<div class="details">
<p>
<strong>{{ sr.service_name }}</strong>
{% if sr.parent_url %}
{% if sr.extended_attributes.duplicate %}
<br/><a href = {{sr.parent_url}}>Duplicate</a>
{% else %}
<br/><a href = {{sr.parent_url}}>Parent</a>
{% endif %}
{% endif %}
{% if sr.agency_responsible %}
<br/>Department: {{ sr.agency_responsible }}
{% endif %}
{% if sr.extended_attributes and sr.extended_attributes.channel %}
<br/>via {{ sr.extended_attributes.channel.title() }}
{% endif %}

</p>
</div>
</li>
Expand Down