Skip to content

Commit

Permalink
Fixed error with report_view_id reference and instance_id reference
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Jun 14, 2024
1 parent bc94aec commit 5fce14c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/main/java/org/spin/report_engine/data/ReportInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class ReportInfo {
private Map<Integer, PrintFormatItem> groupLevels;
private QueryDefinition queryDefinition;
private long recordCount;
private int instanceId;

private ReportInfo(PrintFormat printFormat, QueryDefinition queryDefinition) {
name = printFormat.getName();
Expand Down Expand Up @@ -90,6 +91,15 @@ public ReportInfo withQueryDefinition(QueryDefinition queryDefinition) {
return this;
}

public int getInstanceId() {
return instanceId;
}

public ReportInfo withInstanceId(int instanceId) {
this.instanceId = instanceId;
return this;
}

public int getLevel() {
return level;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private ReportInfo get(String transactionName) {
MPrintFormat printFormat = new MPrintFormat(Env.getCtx(), getPrintFormatId(), null);
PrintFormat format = PrintFormat.newInstance(printFormat);
QueryDefinition queryDefinition = format.getQuery().withConditions(conditions).withInstanceId(getInstanceId()).withLimit(limit, offset).buildQuery();
ReportInfo reportInfo = ReportInfo.newInstance(format, queryDefinition);
ReportInfo reportInfo = ReportInfo.newInstance(format, queryDefinition).withReportViewId(getReportViewId()).withInstanceId(getInstanceId());
DB.runResultSet(transactionName, queryDefinition.getCompleteQuery(), queryDefinition.getParameters(), resulset -> {
while (resulset.next()) {
format.getItems().forEach(item -> {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/spin/report_engine/service/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private static Report.Builder convertReport(ReportInfo reportInfo, int limit, in
.setPrintFormatId(reportInfo.getPrintFormatId())
.setReportViewId(reportInfo.getReportViewId())
.setRecordCount(reportInfo.getRecordCount())
.setInstanceId(reportInfo.getInstanceId())
.addAllColumns(
reportInfo.getColumns().stream().map(
column -> ReportColumn.newBuilder()
Expand Down

0 comments on commit 5fce14c

Please sign in to comment.