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

fixed test #779

Merged
merged 2 commits into from
Jan 23, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@

import static fr.gouv.monprojetsup.data.Constants.LAS_CONSTANT;
import static fr.gouv.monprojetsup.data.etl.loaders.DataSources.RESUMES_MPS_RESUME_FORMATION;
import static fr.gouv.monprojetsup.data.etl.loaders.DataSources.RESUMES_MPS_RESUME_FORMATION_MOS;
import static fr.gouv.monprojetsup.data.etl.loaders.DataSources.RESUMES_MPS_RESUME_KEY;
import static fr.gouv.monprojetsup.data.etl.loaders.DataSources.RESUMES_MPS_RESUME_TYPE_FORMATION;
import static fr.gouv.monprojetsup.data.etl.loaders.DataSources.RESUMES_MPS_RESUME_TYPE_FORMATION_MOS;

public class DescriptifsLoader {
public static @NotNull DescriptifsFormationsMetiers loadDescriptifs(
Expand Down Expand Up @@ -73,9 +71,6 @@ private static void addMpsdescriptifs(DescriptifsFormationsMetiers descriptifs,
val lines = CsvTools.readCSV(
sources.getSourceDataFilePath(DataSources.RESUMES_MPS_PATH),
',');
String keyFlFr;
String keyDescFormation = RESUMES_MPS_RESUME_TYPE_FORMATION;
String keyDescFiliere = RESUMES_MPS_RESUME_FORMATION;
String keyTypeFor = "code type formation";

Map<String, String> resumesTypesformations = new HashMap<>();
Expand All @@ -86,13 +81,10 @@ private static void addMpsdescriptifs(DescriptifsFormationsMetiers descriptifs,
for (val line : lines) {
val frCod = line.get(keyTypeFor);
val descFormation = line.get(RESUMES_MPS_RESUME_TYPE_FORMATION);
val descFormationMos = line.get(RESUMES_MPS_RESUME_TYPE_FORMATION_MOS);
if(descFormation == null || descFormationMos == null) {
if(descFormation == null) {
throw new RuntimeException("No description for " + frCod);
}
if (!frCod.isBlank() && !descFormationMos.isBlank()) {
resumesTypesformations.put(frCod, descFormationMos.trim());
} else if (!frCod.isBlank() && !descFormation.isBlank()) {
if (!frCod.isBlank() && !descFormation.isBlank()) {
resumesTypesformations.put(frCod, descFormation.trim());
}
}
Expand All @@ -110,10 +102,7 @@ private static void addMpsdescriptifs(DescriptifsFormationsMetiers descriptifs,
String frcod = line.getOrDefault(keyTypeFor, "");

String descForm = resumesTypesformations.getOrDefault(frcod, "");
String descFiliere = line.get(RESUMES_MPS_RESUME_FORMATION_MOS).trim();
if(descFiliere.isBlank()) {
descFiliere = line.get(RESUMES_MPS_RESUME_FORMATION).trim();
}
String descFiliere = line.get(RESUMES_MPS_RESUME_FORMATION).trim();

var descriptif = descriptifs.keyToDescriptifs().computeIfAbsent(flfrcod, z -> new DescriptifFormation(line));
if (descriptif.getMultiUrls() == null) descriptif.setMultiUrls(new HashSet<>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"score": 4
},
{
"id": "fl2042",
"id": "fl250",
"status": 1,
"score": 5
}
Expand Down
Loading