Skip to content

Commit fe1ebd7

Browse files
committed
fix non-legacy mode indices
1 parent 8ce2c3e commit fe1ebd7

File tree

6 files changed

+68
-38
lines changed

6 files changed

+68
-38
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Run.xml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extern/config.json

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,44 @@
77
"targetType": "excel",
88
"mapping": {
99
"Kundennummer": null,
10-
"Name": 0,
11-
"Vorname": 1,
12-
"Anrede": 2,
13-
"Geburtsdatum": 3,
14-
"Strasse": 4,
15-
"Hausnummer": 5,
16-
"PLZ": 6,
17-
"Ort": 7,
10+
"Name": 1,
11+
"Vorname": 2,
12+
"Anrede": 3,
13+
"Geburtsdatum": 4,
14+
"Strasse": 5,
15+
"Hausnummer": 6,
16+
"PLZ": 7,
17+
"Ort": 8,
1818
"Telefon1": null,
1919
"Telefon2": null,
2020
"Fax": null,
2121
"eMail": null,
22-
"Mobil": 8,
22+
"Mobil": 9,
2323
"UserName": null,
2424
"Passwort": null,
25-
"CH1": 9,
25+
"CH1": 10,
2626
"CH2": null,
2727
"CH3": null,
2828
"CH4": null,
2929
"CH5": null,
3030
"CH6": null,
31-
"eMail-Privat": 10,
32-
"Versand zugestimmt": 11,
33-
"Aufmerksam über": 12,
34-
"Vorname Erziehungsb.": 13,
35-
"Nachname Erziehungsb.": 14
31+
"eMail-Privat": 11,
32+
"Versand zugestimmt": 12,
33+
"Aufmerksam über": 13,
34+
"Vorname Erziehungsb.": 14,
35+
"Nachname Erziehungsb.": 15
3636
}
3737
},
3838
"FB": {
3939
"target": "data/feedback.mdb",
4040
"subTarget": "tbl_Feedback_FP",
4141
"targetType": "access",
4242
"mapping": {
43-
"ID1": {
43+
"ID1": null,
44+
"WorkshopID": {
45+
"sourceColumnIndex": 1,
4446
"isRequired": true
4547
},
46-
"WorkshopID": 0,
4748
"Geschlecht": null,
4849
"Alter": 2,
4950
"Freiwilligkeit": 3,
@@ -59,10 +60,7 @@
5960
"Leitung_hat_gut_erklaert": 13,
6061
"Leitung_konnte_Fragen_beantworten": 14,
6162
"Leitung_um_Gruppe_gekümmert": 15,
62-
"Idee_was_besser_frei": {
63-
"sourceColumnIndex": 16,
64-
"isRequired": true
65-
},
63+
"Idee_was_besser_frei": 16,
6664
"Wunsch_Workshops_frei": 17,
6765
"Ausserdem_frei": 18
6866
}
@@ -71,16 +69,16 @@
7169
"targetType": "excel",
7270
"target": "data/geburtstage.xls",
7371
"mapping": {
74-
"Vorname": 0,
75-
"Nachname": 1,
76-
"Straße": 2,
77-
"Hausnummer": 3,
78-
"PLZ": 4,
79-
"Ort": 5,
80-
"E-Mail": 6,
81-
"Mobilfunknummer": 7,
82-
"Bemerkung": 8,
83-
"Ich bin erstmals auf die Angebote der Stiftung aufmerksam geworden": 9
72+
"Vorname": 1,
73+
"Nachname": 2,
74+
"Straße": 3,
75+
"Hausnummer": 4,
76+
"PLZ": 5,
77+
"Ort": 6,
78+
"E-Mail": 7,
79+
"Mobilfunknummer": 8,
80+
"Bemerkung": 9,
81+
"Ich bin erstmals auf die Angebote der Stiftung aufmerksam geworden": 10
8482
}
8583
}
8684
}

src/main/java/com/damgem/DataImporter/Data/Profile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static Profile fromConfigurationData(ConfigurationData configurationData,
3636
"Information und Legacy Mode ist nicht aktiviert.");
3737
}
3838
String profileName = parameterData.values.substring(0, indexOfSeparator);
39-
parameterData.values = parameterData.values.substring(indexOfSeparator);
39+
parameterData.values = parameterData.values.substring(indexOfSeparator + 1);
4040

4141
if(!configurationData.profiles.containsKey(profileName)) {
4242
throw new DataImporterError("Profil nicht gefunden", "legacyMode ist " +

src/main/java/com/damgem/DataImporter/Field/FieldBlueprint.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ public FieldBlueprint(String name, FieldBlueprint namelessBlueprint) {
3232

3333
public Field fillFrom(String[] values) throws DataImporterError {
3434
if(this.sourceColumnIndex == null) return this.fill("");
35-
if(this.sourceColumnIndex >= values.length) {
35+
if(this.sourceColumnIndex > values.length) {
3636
throw new DataImporterError("Eingabe Fehler", "Das Feld \"" + this.name + "\" soll " +
37-
"aus dem " + this.sourceColumnIndex + ". Feld (Indizes starten bei 0) gelesen werden. Die " +
37+
"aus dem " + this.sourceColumnIndex + ". Feld gelesen werden. Die " +
3838
"Eingabe hat jedoch nur " + values.length + " Datenfelder!");
3939
}
40-
if(this.sourceColumnIndex < 0) {
40+
if(this.sourceColumnIndex <= 0) {
4141
throw new DataImporterError("Konfigurations Fehler", "Das Feld \"" + this.name +
42-
"\" soll aus dem Feld mit negativem Index " + this.sourceColumnIndex + " gelesen werden!");
42+
"\" soll aus dem Feld mit negativem Index gelesen werden: " + this.sourceColumnIndex);
4343
}
44-
return this.fill(values[this.sourceColumnIndex]);
44+
// subtract 1 to index as source column index is an 1-based index
45+
return this.fill(values[this.sourceColumnIndex - 1]);
4546
}
4647

4748
@Override

0 commit comments

Comments
 (0)