Skip to content

Commit

Permalink
avniproject/avni-webapp#1347 | Skip descriptor row while counting suc…
Browse files Browse the repository at this point in the history
…cess / error rows for usersAndCatchments
  • Loading branch information
himeshr committed Oct 7, 2024
1 parent 6c8b281 commit fc17bbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
import java.util.ArrayList;
import java.util.List;

import static org.avni.server.importer.batch.csv.writer.UserAndCatchmentWriter.METADATA_ROW_START_STRING;
import static org.avni.server.service.ImportLocationsConstants.EXAMPLE;

@Configuration
@EnableBatchProcessing
@EnableScheduling
Expand Down Expand Up @@ -137,7 +140,8 @@ private int getNumberOfLinesToSkip(Reader reader) throws IOException {
descriptors.addAll(doTokenize(possibleDescriptorLine));
}};

if (CollectionUtil.anyStartsWith(descriptors, ImportLocationsConstants.EXAMPLE)) {
if (CollectionUtil.anyStartsWith(descriptors, EXAMPLE)
|| CollectionUtil.anyStartsWith(descriptors, METADATA_ROW_START_STRING)) {
linesToSkip++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class UserAndCatchmentWriter implements ItemWriter<Row>, Serializable {
private static final String ERR_MSG_MISSING_MANDATORY_FIELDS = "Mandatory columns are missing from uploaded file - %s. Please refer to sample file for the list of mandatory headers.";
private static final String ERR_MSG_INVALID_CONCEPT_ANSWER = "'%s' is not a valid value for the concept '%s'. " +
"To input this value, add this as an answer to the coded concept '%s'.";
private static final String METADATA_ROW_START_STRING = "Mandatory field.";
public static final String METADATA_ROW_START_STRING = "Mandatory field";

@Autowired
public UserAndCatchmentWriter(CatchmentService catchmentService,
Expand Down

0 comments on commit fc17bbf

Please sign in to comment.