Company form: choosing a NACE division from the suggestions splits it at its commas into made-up industries #531

Closed
opened 2026-10-01 10:47:26 +00:00 by tiagoagueda · 0 comments
Owner

Found on 2026-09-29 in a read-only review of postulo at 95348908d, reading the Other industries box against the suggestions it offers and saving one in a test.

Checked again on 2026-10-01 against main at 0a5cad587: still present. The code is now at jobs/forms.py:118-124 (new_industries), jobs/forms.py:280-289 (CompanyForm.suggestions), jobs/forms.py:331-334 (_add_new_industries) and static/js/app.js:1632-1642 (typedNames); jobs/models.py:104-107 and jobs/industries.py:183-201 have not moved.

The Other industries box offers the NACE division names as suggestions (#140), and then splits whatever it holds at every comma, semicolon and slash. Many division names contain one of those, so choosing a suggestion creates two or three fragments instead of the division.

  • Where: jobs/forms.py:117-123 (new_industries, with the industry-suggestions datalist); jobs/forms.py:279-288 (CompanyForm.suggestions) and jobs/industries.py:183-201 (suggestions, which adds every division name); jobs/forms.py:330-333 (_add_new_industries) and jobs/models.py:104-107 (Industry.split, re.split(r"[;,/]", ...)); the label control does the same in the browser, static/js/app.js:1399-1409 (typedNames, .split(/[;,/]/)).
  • What happens: a person picks Manufacture of computer, electronic and optical products from the suggestions and saves. The company gets two new industries, Manufacture of computer and electronic and optical products, both with no NACE code; both then appear on the Industries page, in the filters and in the figures by industry. Of the 87 division names, 24 in English, 23 in French, 28 in German and 25 in Portuguese contain ,, ; or /.
  • Why it matters: the suggestion list is the way #140 meant people to reach a real vocabulary, and a quarter of it produces junk that has to be merged away by hand; the division code the name should have carried is lost.
  • Fix: recognise whole known names before splitting, on both sides: in Industry.split (and typedNames), first take out any run that matches a suggestion (industries.divisions() in the reading and fallback languages, and STARTER_INDUSTRIES), then split what is left. Alternatively separate typed names with a character no division contains, and say so in the help text, which today reads "Separate several with commas."

Done when

  • A test in tests/test_nace.py that saves a company with Manufacture of computer, electronic and optical products (and with that name plus Software, comma-separated) under Other industries and gets exactly the division, with code 26, plus Software.
Found on 2026-09-29 in a read-only review of postulo at 95348908d, reading the *Other industries* box against the suggestions it offers and saving one in a test. Checked again on 2026-10-01 against `main` at `0a5cad587`: still present. The code is now at `jobs/forms.py:118-124` (`new_industries`), `jobs/forms.py:280-289` (`CompanyForm.suggestions`), `jobs/forms.py:331-334` (`_add_new_industries`) and `static/js/app.js:1632-1642` (`typedNames`); `jobs/models.py:104-107` and `jobs/industries.py:183-201` have not moved. The *Other industries* box offers the NACE division names as suggestions (#140), and then splits whatever it holds at every comma, semicolon and slash. Many division names contain one of those, so choosing a suggestion creates two or three fragments instead of the division. - **Where:** `jobs/forms.py:117-123` (`new_industries`, with the `industry-suggestions` datalist); `jobs/forms.py:279-288` (`CompanyForm.suggestions`) and `jobs/industries.py:183-201` (`suggestions`, which adds every division name); `jobs/forms.py:330-333` (`_add_new_industries`) and `jobs/models.py:104-107` (`Industry.split`, `re.split(r"[;,/]", ...)`); the label control does the same in the browser, `static/js/app.js:1399-1409` (`typedNames`, `.split(/[;,/]/)`). - **What happens:** a person picks *Manufacture of computer, electronic and optical products* from the suggestions and saves. The company gets two new industries, *Manufacture of computer* and *electronic and optical products*, both with no NACE code; both then appear on the Industries page, in the filters and in the figures by industry. Of the 87 division names, 24 in English, 23 in French, 28 in German and 25 in Portuguese contain `,`, `;` or `/`. - **Why it matters:** the suggestion list is the way #140 meant people to reach a real vocabulary, and a quarter of it produces junk that has to be merged away by hand; the division code the name should have carried is lost. - **Fix:** recognise whole known names before splitting, on both sides: in `Industry.split` (and `typedNames`), first take out any run that matches a suggestion (`industries.divisions()` in the reading and fallback languages, and `STARTER_INDUSTRIES`), then split what is left. Alternatively separate typed names with a character no division contains, and say so in the help text, which today reads "Separate several with commas." ## Done when - A test in `tests/test_nace.py` that saves a company with *Manufacture of computer, electronic and optical products* (and with that name plus *Software*, comma-separated) under *Other industries* and gets exactly the division, with code `26`, plus *Software*.
tiagoagueda added this to the 0.5.0 milestone 2026-10-01 10:47:26 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo#531
No description provided.