Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #434 - Case type filter #482

Merged
merged 2 commits into from
Nov 10, 2015
Merged
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
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def generate_csv(results):
'show_discussions': bool, 'show_urban': int, 'show_intersection': int, 'show_lane': int,
'show_day': int, 'show_holiday': int, 'show_time': int, 'start_time': int, 'end_time': int,
'weather': int, 'road': int, 'separation': int, 'surface': int, 'acctype': int, 'controlmeasure': int,
'district': int}
'district': int, 'case_type': int}

@babel.localeselector
def get_locale():
Expand Down
3 changes: 3 additions & 0 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ def bounding_box_query(is_thin=False, yield_per=None, **kwargs):
if kwargs.get('district', 0) != 0:
markers = markers.filter(Marker.unit == kwargs['district'])

if kwargs.get('case_type', 0) != 0:
markers = markers.filter(Marker.provider_code == kwargs['case_type'])

if is_thin:
markers = markers.options(load_only("id", "longitude", "latitude"))
return markers
Expand Down
3 changes: 3 additions & 0 deletions static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ $(function () {
this.acctype = 0;
this.controlmeasure = 0;
this.district = 0;
this.case_type = 0;

this.dateRanges = [new Date($("#sdate").val()), new Date($("#edate").val())];

Expand Down Expand Up @@ -255,6 +256,7 @@ $(function () {
params["acctype"] = this.acctype;
params["controlmeasure"] = this.controlmeasure;
params["district"] = this.district;
params["case_type"] = this.case_type;
return params;
},
setMultipleMarkersIcon: function () {
Expand Down Expand Up @@ -875,6 +877,7 @@ $(function () {
this.acctype = $("input[type='radio'][name='acctype']:checked").val();
this.controlmeasure = $("input[type='radio'][name='controlmeasure']:checked").val();
this.district = $("input[type='radio'][name='district']:checked").val();
this.case_type = $("input[type='radio'][name='casetype']:checked").val();

this.dateRanges = [new Date($("#sdate").val()), new Date($("#edate").val())]
this.resetMarkers();
Expand Down
10 changes: 10 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,16 @@ <h5> אנו מפתחים תכונות חדשות לאתר. הנך מוזמנ/ת
</label>

<div class="filter-panel">
<div class="btn-label">סוג תיק:</div>
<div class="btn-wrap separator">
<input type="radio" name="casetype" id="checkbox-case-all" value=0 onclick="app.loadFilter()" checked/>
<label for="checkbox-case-all" class="btn one">הכל</label>
<input type="radio" name="casetype" id="checkbox-case-1" value=1 onclick="app.loadFilter()" />
<label for="checkbox-case-1" class="btn one" style="padding-right: 10px !important; padding-left: 10px !important;">1</label>
<input type="radio" name="casetype" id="checkbox-case-3" value=3 onclick="app.loadFilter()" />
<label for="checkbox-case-3" class="btn one" style="padding-right: 10px !important; padding-left: 10px !important;">3</label>
</div>

<div class="btn-label">אמצעי בקרה:</div>
<div class="btn-wrap separator">
<input type="radio" name="controlmeasure" id="checkbox-controls-all" value=0 onclick="app.loadFilter()" checked/>
Expand Down