Commit 50ed30b6 authored by Kevin Robert's avatar Kevin Robert
Browse files

UNOTOPLYS-319 : Ajout du BOM et ordonnacement des résultats par screen index.

parent f653d175
......@@ -53,6 +53,9 @@ public class ExportController {
response.addHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileName + "\"");
response.addHeader(HttpHeaders.CONTENT_TYPE, "application/csv");
try {
// Ajout ud caractère spécial pour l'ouverture du fichier dans EXCEL.
final byte[] bom = new byte[] { (byte) 239, (byte) 187, (byte) 191 };
response.getOutputStream().write(bom);
exportService.exportAnswerCsv(response.getOutputStream(), formReference, applicationProperties.getExportCsvDelimiterColumns(), applicationProperties.getExportCsvDelimiterAnswers().toString());
response.getOutputStream().flush();
} catch (IOException e) {
......
......@@ -33,7 +33,7 @@ public interface FormRepository extends JpaRepository<Form, Long>, RoleRepositor
* @param id id du formulaire
* @return La liste des références des questions.
*/
@Query(value = "select screenitems ->> 'reference' reference from screen sc cross join lateral json_array_elements(sc.items) screenitems where sc.form_id = :formId and screenitems ->> 'type' in ('radio', 'checkbox', 'openquestion')", nativeQuery = true)
@Query(value = "select screenitems ->> 'reference' reference from screen sc cross join lateral json_array_elements(sc.items) screenitems where sc.form_id = :formId and screenitems ->> 'type' in ('radio', 'checkbox', 'openquestion') order by sc.index", nativeQuery = true)
List<String> getFormQuestionReferences(@Param("formId") Long id);
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment