Skip to content

Commit

Permalink
Cric 1980 add export to review category report (#1846)
Browse files Browse the repository at this point in the history
* CRIC-1980: Add export to review category report
  • Loading branch information
saakhil authored Aug 23, 2024
1 parent d2cb383 commit 9bc05c8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
10 changes: 6 additions & 4 deletions grails-app/services/org/broadinstitute/orsp/QueryService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2015,10 +2015,12 @@ class QueryService implements Status {
SessionFactory sessionFactory = grailsApplication.getMainContext().getBean('sessionFactory')
final session = sessionFactory.currentSession
def query = new StringBuilder()
query.append('select distinct i.id, i.type, i.project_key, i.summary, i.status, i.approval_status, ')
.append('i.reporter, i.request_date, ie.value as review_category from issue i ')
.append('left outer join issue_extra_property ie on ie.project_key = i.project_key and ie.name = "review-category" ')
.append('where i.type = "IRB Project" and i.deleted = 0 order by project_key asc')
query.append('SELECT DISTINCT iss.id, iss.type, iss.project_key, iss.summary, iss.status, iss.approval_status, iss.reporter, iss.request_date, ')
.append('CASE WHEN irt.value IS NOT NULL AND irt.value!=\'""\' AND JSON_VALID(irt.value) THEN JSON_UNQUOTE(JSON_EXTRACT(irt.value, \'$.label\')) ')
.append('ELSE rc.value END AS review_category FROM issue iss ')
.append('LEFT OUTER JOIN issue_extra_property irt ON irt.project_key = iss.project_key AND irt.name = "initialReviewType" ')
.append('LEFT OUTER JOIN issue_extra_property rc ON rc.project_key = iss.project_key AND rc.name = "review-category" ')
.append('WHERE iss.type = "IRB Project" AND iss.deleted = 0 ORDER BY iss.project_key ASC')
final SQLQuery sqlQuery = session.createSQLQuery(query.toString())
final result = sqlQuery.list().collect {row ->
[
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/IRBReport/IRBReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const IRBReport = (props) => {
showExportButtons= {true}
showSearchBar= {true}
showPdfExport= {false}
showTotal= {true}
></TableComponent>
</div>
</div>
Expand Down
9 changes: 8 additions & 1 deletion src/main/webapp/reviewCategories/ReviewCategories.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const ReviewCategories = hh(class ReviewCategories extends Component {
Reports.getReviewCategory().then(result => {
if (this._isMounted) {
this.setState(prev => {
prev.categories = result.data;
prev.categories = this.findProjectStatus(result.data);
return prev;
}, () => this.props.hideSpinner())
}
Expand All @@ -153,6 +153,13 @@ const ReviewCategories = hh(class ReviewCategories extends Component {
});
};

findProjectStatus = (data) => {
data.forEach(item => {
if (item.status === 'Preparing Application') item.status = item.approvalStatus
});
return data;
}

onSearchChange = (search) => {
this.tableHandler(0, this.state.sizePerPage, search, this.state.sort, 1);
};
Expand Down

0 comments on commit 9bc05c8

Please sign in to comment.