Skip to content

Commit

Permalink
fix: use only the first two characters of ai to determine fixed len…
Browse files Browse the repository at this point in the history
…gth (#1506)
  • Loading branch information
superskip authored Aug 25, 2022
1 parent 648df6f commit 7d2c8aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions d2-tracker/dhis2.d2GS1DataMatrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const aiFixedLengthMap = {
'34': 10,
'35': 10,
'36': 10,
'41': 10,
'41': 16,
};

const removeGS1Identifier = value => value.substring(3);
Expand Down Expand Up @@ -267,7 +267,7 @@ const handleGroupData = (gs1Group) => {
if (gs1Group) {
const gs1GroupLength = gs1Group.length;
const ai = getApplicationIdentifier(gs1Group);
let nextValueLength = aiFixedLengthMap[ai];
let nextValueLength = aiFixedLengthMap[ai.substring(0, 2)];
if (nextValueLength == null) {
nextValueLength = gs1GroupLength;
}
Expand Down

0 comments on commit 7d2c8aa

Please sign in to comment.