Skip to content

Commit

Permalink
Merge pull request #565 from adessoSE/fix-powerbi-report-prefix-error
Browse files Browse the repository at this point in the history
Fix PowerBI imports failing when Prefix doesn't start with 1010A
  • Loading branch information
czarnecki authored Feb 15, 2024
2 parents a38f187 + ef3f76a commit a9d59e8
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private ImportedWorkRecord mapWorkRecord(
int dateColumn,
int hoursColumn) {
var prefixedProjectId = row.getCell(projectIdColumn).getStringCellValue();
var projectId = prefixedProjectId.substring(prefixedProjectId.indexOf('A'));
var projectId = extractProjectId(prefixedProjectId);
var projectName = row.getCell(projectNameColumn).getStringCellValue();
var employee = row.getCell(employeeNameColumn).getStringCellValue();
var date = row.getCell(dateColumn).getDateCellValue();
Expand All @@ -160,4 +160,12 @@ private List<String> mapSkippedRecord(Row row) {
private boolean isInvoiceable(String value) {
return "KV".equals(value);
}

private String extractProjectId(String prefixedProjectId) {
var prefixIndex = prefixedProjectId.indexOf('A');
if (prefixIndex == -1) {
return prefixedProjectId;
}
return prefixedProjectId.substring(prefixIndex);
}
}

0 comments on commit a9d59e8

Please sign in to comment.