Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use a type of String to make queries #1651

Merged
merged 2 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1590,9 +1590,10 @@ public Map<String, Map<String, Long>> getTopicRequestsCounts(
operationTypeCountsMap.put(RequestOperationType.CLAIM.value, assignedToClaimReqs);
if (RequestMode.MY_APPROVALS == requestMode) {
// Make sure to remove any requests which the requestor can not approve
// Using Integer.toString() as it seems to be the fastest method of changing it.
Long topicApprovalCount =
topicRequestsRepo.countRequestorsTopicRequestsGroupByStatusType(
teamId, tenantId, requestor, RequestStatus.CREATED.value);
teamId, Integer.toString(teamId), tenantId, requestor, RequestStatus.CREATED.value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to have a different teamId in the second argument here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think so, the teamId is the requestors teamId and so is retriving the statistics for all topics/connector requests they are able to approve, and that aligns with what we return to the UI in terms of the connectors themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have another scenario I'm not thinking of though let me know!


statusCountsMap.put(
RequestStatus.CREATED.value, topicApprovalCount == null ? 0L : topicApprovalCount);
Expand Down Expand Up @@ -1732,7 +1733,7 @@ public Map<String, Map<String, Long>> getConnectorRequestsCounts(
// Make sure to remove any requests which the requestor can not approve
Long connectorApprovalCount =
kafkaConnectorRequestsRepo.countRequestorsConnectorRequestsGroupByStatusType(
teamId, tenantId, requestor, RequestStatus.CREATED.value);
teamId, Integer.toString(teamId), tenantId, requestor, RequestStatus.CREATED.value);

statusCountsMap.put(
RequestStatus.CREATED.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ List<Object[]> findAllConnectorRequestsGroupByStatus(
@Query(
value =
"select count(*) from kwkafkaconnectorrequests where tenantid = :tenantId"
+ " and (teamid = :teamId or approvingteamid = :teamId) and requestor != :requestor and connectorstatus = :connectorStatus group by connectorstatus",
+ " and (teamid = :teamId or approvingteamid = :approvingTeamid) and requestor != :requestor and connectorstatus = :connectorStatus group by connectorstatus",
nativeQuery = true)
Long countRequestorsConnectorRequestsGroupByStatusType(
@Param("teamId") Integer teamId,
@Param("approvingTeamid") String approvingTeamid,
@Param("tenantId") Integer tenantId,
@Param("requestor") String requestor,
@Param("connectorStatus") String connectorStatus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ long countAllTopicRequestsByApprovingTeamAndTopictype(
@Query(
value =
"select count(*) from kwtopicrequests where tenantid = :tenantId"
+ " and (teamid = :teamId or approvingteamid = :teamId) and requestor != :requestor "
+ " and (teamid = :teamId or approvingteamid = :approvingTeamId) and requestor != :requestor "
+ "and topicstatus = :topicStatus group by topicstatus",
nativeQuery = true)
Long countRequestorsTopicRequestsGroupByStatusType(
@Param("teamId") Integer teamId,
@Param("approvingTeamId") String approvingTeamId,
@Param("tenantId") Integer tenantId,
@Param("requestor") String requestor,
@Param("topicStatus") String topicStatus);
Expand Down