Skip to content

Commit

Permalink
remove some impact questions
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienReuiller committed Sep 14, 2023
1 parent 725ab0e commit 362d848
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 69 deletions.
32 changes: 0 additions & 32 deletions lemarche/templates/tenders/create_step_survey.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
</div>
<div class="row">
<div class="col-12 col-lg-7">
{% bootstrap_field form.worked_with_inclusif_siae_this_kind_tender form_group_class="form-group mb-lg-5" %}
<div id="div_is_encouraged_by_le_marche"
class="{% if form.worked_with_inclusif_siae_this_kind_tender.value == '1' %}d-none{% endif %}">
{% bootstrap_field form.is_encouraged_by_le_marche form_group_class="form-group form-group-required mb-lg-5" %}
</div>
{% bootstrap_field form.providers_out_of_insertion form_group_class="form-group mb-lg-5" %}
{% bootstrap_field form.le_marche_doesnt_exist_how_to_find_siae form_group_class="form-group" %}
</div>
</div>
Expand All @@ -50,29 +44,3 @@
</button>
</div>
{% endblock submit_btn %}
{% block extra_js %}
<script>
document.addEventListener('DOMContentLoaded', function () {
{% comment %} div of the question 3 {% endcomment %}
let divIsEncouragedByLeMarche = document.getElementById('div_is_encouraged_by_le_marche');

let kindRadios = document.querySelectorAll('input[type=radio][name="survey-worked_with_inclusif_siae_this_kind_tender"]');
kindRadios.forEach(radio => radio.addEventListener('change', () => {
let displayQuestion3 = ["0", "?"].includes(radio.value)
if (displayQuestion3) {
divIsEncouragedByLeMarche.classList.remove('d-none');
question3Response = divIsEncouragedByLeMarche.querySelector('input')
question3Response.required = true;
} else {
divIsEncouragedByLeMarche.classList.add('d-none');
question3Response = divIsEncouragedByLeMarche.querySelector('input')
question3Response.required = false;
question3ResponseChecked = divIsEncouragedByLeMarche.querySelector('input:checked')
if(question3ResponseChecked){
question3ResponseChecked.checked = false;
}
}
}));
});
</script>
{% endblock %}
2 changes: 1 addition & 1 deletion lemarche/tenders/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class Tender(models.Model):
# survey
scale_marche_useless = models.CharField(
verbose_name="Utilité du marché de l'inclusion",
help_text="Q°1. Si le Marché de l'inclusion n'existait pas, auriez-vous consulté des prestataires inclusifs* pour ce besoin ?", # noqa
help_text="Si le Marché de l'inclusion n'existait pas, auriez-vous consulté des prestataires inclusifs* pour ce besoin ?", # noqa
max_length=2,
choices=tender_constants.SURVEY_SCALE_QUESTION_CHOICES,
default=tender_constants.SURVEY_SCALE_QUESTION_0,
Expand Down
7 changes: 1 addition & 6 deletions lemarche/www/pages/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,7 @@ def csrf_failure(request, reason=""): # noqa C901
if not key.startswith(("csrfmiddlewaretoken", "tender_create_multi_step_view")):
value = formtools_session_step_data.get(step).get(key)
key_cleaned = key.replace(f"{step}-", "")
if key_cleaned in [
"le_marche_doesnt_exist_how_to_find_siae",
"providers_out_of_insertion",
"worked_with_inclusif_siae_this_kind_tender",
"is_encouraged_by_le_marche",
]:
if key_cleaned == "le_marche_doesnt_exist_how_to_find_siae":
tender_dict["extra_data"] |= {key_cleaned: value[0]}
elif key_cleaned == "location":
tender_dict[key_cleaned] = Perimeter.objects.get(slug=value[0])
Expand Down
28 changes: 1 addition & 27 deletions lemarche/www/tenders/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,29 +223,8 @@ class TenderCreateStepSurveyForm(forms.ModelForm):
required=True,
)

worked_with_inclusif_siae_this_kind_tender = forms.ChoiceField(
label="Q°2. Avez-vous déjà travaillé avec des prestataires inclusifs sur ce type de prestation ?",
choices=tender_constants.SURVEY_YES_NO_DONT_KNOW_CHOICES,
widget=forms.RadioSelect,
required=True,
)
# hidden if worked_with_inclusif_siae_this_kind_tender is no or don't know
is_encouraged_by_le_marche = forms.ChoiceField(
label="Q°3. Est-ce la plateforme du Marché de l'inclusion qui vous a encouragé à consulter des prestataires inclusifs pour ce besoin ?", # noqa
choices=tender_constants.SURVEY_ENCOURAGED_BY_US_CHOICES,
widget=forms.RadioSelect,
required=False,
)

providers_out_of_insertion = forms.ChoiceField(
label="Q°4. Comptez-vous consulter d'autres prestataires en dehors de l'Insertion et du Handicap ?",
choices=tender_constants.SURVEY_SCALE_QUESTION_CHOICES,
widget=forms.RadioSelect,
required=True,
)

le_marche_doesnt_exist_how_to_find_siae = forms.CharField(
label="Q°5. Si le Marché de l'inclusion n'existait pas, comment auriez-vous fait pour trouver un prestataire inclusif ?", # noqa
label="Si le Marché de l'inclusion n'existait pas, comment auriez-vous fait pour trouver un prestataire inclusif ?", # noqa
required=False,
widget=forms.Textarea(attrs={"rows": 2, "cols": 15, "data-expandable": "true"}),
)
Expand All @@ -259,11 +238,6 @@ class Meta:
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.instance.id:
self.initial["worked_with_inclusif_siae_this_kind_tender"] = self.instance.extra_data.get(
"worked_with_inclusif_siae_this_kind_tender"
)
self.initial["is_encouraged_by_le_marche"] = self.instance.extra_data.get("is_encouraged_by_le_marche")
self.initial["providers_out_of_insertion"] = self.instance.extra_data.get("providers_out_of_insertion")
self.initial["le_marche_doesnt_exist_how_to_find_siae"] = self.instance.extra_data.get(
"le_marche_doesnt_exist_how_to_find_siae"
)
Expand Down
3 changes: 0 additions & 3 deletions lemarche/www/tenders/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ def _generate_fake_data_form(
step_4 = {
"tender_create_multi_step_view-current_step": "survey",
"survey-scale_marche_useless": tender_constants.SURVEY_SCALE_QUESTION_0,
"survey-worked_with_inclusif_siae_this_kind_tender": tender_constants.SURVEY_DONT_KNOW,
"survey-is_encouraged_by_le_marche": tender_constants.SURVEY_NOT_ENCOURAGED_ONLY_BY_US,
"survey-providers_out_of_insertion": tender_constants.SURVEY_SCALE_QUESTION_2,
"survey-le_marche_doesnt_exist_how_to_find_siae": "TEST",
} | _step_4

Expand Down

0 comments on commit 362d848

Please sign in to comment.