Skip to content

Commit

Permalink
Fix application job post id
Browse files Browse the repository at this point in the history
Swapped the Greenhouse job-boards API endpoint with Harvest API job post endpoint.
The GH job boards API doesn't return job posts that have been flagged `inactive` or `not live`
  • Loading branch information
carkod committed Oct 31, 2023
1 parent 99034cd commit b4d77fd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
4 changes: 2 additions & 2 deletions templates/careers/base_job-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="col-6" style="position: relative">
<div style="position: sticky; top: 65px">
<h1 class="p-heading--2">{{ job.title }}</h1>
<p class="p-muted-heading">{{ job.location }}</p>
<p class="p-muted-heading">{{ job.location.name }}</p>
</div>
</div>
<div class="col-6">
Expand All @@ -21,7 +21,7 @@ <h1 class="p-heading--2">{{ job.title }}</h1>
<div class="col-6 col-start-large-4 p-strip u-no-padding--top">
<div class="p-strip u-no-padding--top">
<h1 class="p-heading--2">{{ job.title }}</h1>
<p class="p-muted-heading">{{ job.location }}</p>
<p class="p-muted-heading">{{ job.location.name }}</p>
</div>
{% block application_content %}{% endblock %}
</div>
Expand Down
38 changes: 19 additions & 19 deletions templates/careers/job-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{% endif %}
{% if job.is_remote %}
"jobLocationType": "TELECOMMUTE",
"applicantLocationRequirements": {{ job.location | job_location_countries | tojson}},
"applicantLocationRequirements": {{ job.location | job_location_countries | tojson }},
{% else %}
"jobLocation": {
"@type": "Place",
Expand Down Expand Up @@ -86,32 +86,32 @@ <h3 class="p-heading--5">Apply for this role</h3>
<input type="hidden" name="id" value="{{ job.id }}" />
{% if job.questions %}
{% for question in job.questions %}
<label for="{{ question.fields[0].name }}" class="{% if question.required %}is-required{% endif %}">{{ question.label }}</label>
{% if question.fields[0].type == "input_text" %}
<input id="{{ question.fields[0].name }}" name="{{ question.fields[0].name }}" {% if question.description %}aria-describedby="{{ question.fields[0].name }}_help"{% endif %} type="text" {% if question.required %}required{% endif %} maxlength="255">
{% if question.description %}<p class="p-form-help-text" id="{{ question.fields[0].name }}_help">{{ question.description | safe }}</p>{% endif %}
{% elif question.fields[0].type == "input_file" %}
<input id="{{ question.fields[0].name }}" name="{{ question.fields[0].name }}" {% if question.description %}aria-describedby="{{ question.fields[0].name }}_help"{% endif %} type="file" {% if question.required %}required{% endif %} accept=".pdf, .doc, .docx, .txt, .rtf">
{% if question.description %}<p class="p-form-help-text" id="{{ question.fields[0].name }}_help">{{ question.description | safe }}</p>{% endif %}
{% elif question.fields[0].type == "textarea" %}
<textarea id="{{ question.fields[0].name }}" name="{{ question.fields[0].name }}" {% if question.description %}aria-describedby="{{ question.fields[0].name }}_help"{% endif %} type="textarea" {% if question.required %}required{% endif %}></textarea>
{% if question.description %}<p class="p-form-help-text" id="{{ question.fields[0].name }}_help">{{ question.description | safe }}</p>{% endif %}
{% elif question.fields[0].type == "multi_value_single_select" %}
<select name="{{ question.fields[0].name }}" id="{{ question.fields[0].name }}" {% if question.description %}aria-describedby="{{ question.fields[0].name }}_help"{% endif %} {% if question.required %}required{% endif %}>
<label for="{{ question.name }}" class="{% if question.required %}is-required{% endif %}">{{ question.label }}</label>
{% if question.type == "short_text" %}
<input id="{{ question.name }}" name="{{ question.name }}" {% if question.description %}aria-describedby="{{ question.name }}_help"{% endif %} type="text" {% if question.required %}required{% endif %} maxlength="255">
{% if question.description %}<p class="p-form-help-text" id="{{ question.name }}_help">{{ question.description | safe }}</p>{% endif %}
{% elif question.type == "attachment" %}
<input id="{{ question.name }}" name="{{ question.name }}" {% if question.description %}aria-describedby="{{ question.name }}_help"{% endif %} type="file" {% if question.required %}required{% endif %} accept=".pdf, .doc, .docx, .txt, .rtf">
{% if question.description %}<p class="p-form-help-text" id="{{ question.name }}_help">{{ question.description | safe }}</p>{% endif %}
{% elif question.type == "long_text" %}
<textarea id="{{ question.name }}" name="{{ question.name }}" {% if question.description %}aria-describedby="{{ question.name }}_help"{% endif %} type="textarea" {% if question.required %}required{% endif %}></textarea>
{% if question.description %}<p class="p-form-help-text" id="{{ question.name }}_help">{{ question.description | safe }}</p>{% endif %}
{% elif question.type == "single_select" %}
<select name="{{ question.name }}" id="{{ question.name }}" {% if question.description %}aria-describedby="{{ question.name }}_help"{% endif %} {% if question.required %}required{% endif %}>
<option value="" disabled="disabled" selected="">Select an option</option>
{% for answer_option in question.fields[0].get("values",[])|reverse %}
{% for answer_option in question.get("values",[])|reverse %}
<option value="{{ answer_option.value }}">{{ answer_option.label }}</option>
{% endfor %}
</select>
{% if question.description %}<p class="p-form-help-text" id="{{ question.fields[0].name }}_help">{{ question.description | safe }}</p>{% endif %}
{% elif question.fields[0].type == "multi_value_multi_select" %}
<select name="{{ question.fields[0].name }}" id="{{ question.fields[0].name }}" {% if question.description %}aria-describedby="{{ question.fields[0].name }}_help"{% endif %} multiple="" {% if question.required %}required{% endif %}>
{% if question.description %}<p class="p-form-help-text" id="{{ question.name }}_help">{{ question.description | safe }}</p>{% endif %}
{% elif question.type == "multi_value_multi_select" %}
<select name="{{ question.name }}" id="{{ question.name }}" {% if question.description %}aria-describedby="{{ question.name }}_help"{% endif %} multiple="" {% if question.required %}required{% endif %}>
<option value="" disabled="disabled">Select...</option>
{% for answer_option in question.fields[0].get("values",[]) %}
{% for answer_option in question.get("values",[]) %}
<option value="{{ answer_option.value }}">{{ answer_option.label }}</option>
{% endfor %}
</select>
{% if question.description %}<p class="p-form-help-text" id="{{ question.fields[0].name }}_help">{{ question.description | safe }}</p>{% endif %}
{% if question.description %}<p class="p-form-help-text" id="{{ question.name }}_help">{{ question.description | safe }}</p>{% endif %}
{% endif %}
{% endfor %}
{% endif %}
Expand Down
4 changes: 3 additions & 1 deletion webapp/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ def job_details(job_id, job_title):
context = {"bleach": bleach}

try:
context["job"] = greenhouse.get_vacancy(job_id)
# Greenhouse job board API (get_vacancy) doesn't show inactive roles
context["job"] = harvest.get_job_post(job_id)
# job_post = greenhouse.get_vacancy(job_id)
except HTTPError as error:
if error.response.status_code == 404:
flask.abort(404)
Expand Down

0 comments on commit b4d77fd

Please sign in to comment.