adamsaghy commented on code in PR #3337:
URL: https://github.com/apache/fineract/pull/3337#discussion_r1280477212


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobRunnerReadServiceImpl.java:
##########
@@ -154,11 +154,11 @@ private static final class JobDetailMapper implements 
RowMapper<JobDetailData> {
 
         JobDetailMapper(DatabaseSpecificSQLGenerator sqlGenerator) {
             sqlBuilder = new StringBuilder("select").append(
-                    " job.id,job.display_name as displayName,job.next_run_time 
as nextRunTime,job.initializing_errorlog as 
initializingError,job.cron_expression as cronExpression,job.is_active as 
active,job.currently_running as currentlyRunning,")
-                    .append(" runHistory.version,runHistory.start_time as 
lastRunStartTime,runHistory.end_time as lastRunEndTime,runHistory.")
-                    .append(sqlGenerator.escape("status"))
-                    .append(",runHistory.error_message as 
jobRunErrorMessage,runHistory.trigger_type as triggerType,runHistory.error_log 
as jobRunErrorLog ")
-                    .append(" from job job  left join job_run_history 
runHistory ON job.id=runHistory.job_id and 
job.previous_run_start_time=runHistory.start_time ");
+                            " job.id,job.display_name as 
displayName,job.next_run_time as nextRunTime,job.initializing_errorlog as 
initializingError,job.cron_expression as cronExpression,job.is_active as 
active,job.currently_running as currentlyRunning,")
+                    .append(" (SELECT max(jrh.`version`) FROM job_run_history 
jrh WHERE jrh.job_id = job.id) AS version,runHistory.start_time as 
lastRunStartTime,runHistory.end_time as lastRunEndTime,runHistory."
+                            + sqlGenerator.escape("status")
+                            + ",runHistory.error_message as 
jobRunErrorMessage,runHistory.trigger_type as triggerType,runHistory.error_log 
as jobRunErrorLog ")
+                    .append(" from job job  left join job_run_history 
runHistory ON job.id=runHistory.job_id and 
job.previous_run_start_time=runHistory.start_time AND runHistory.trigger_type = 
'cron' ");

Review Comment:
   if the job was executed manually, then the trigger type will not be 'cron'. 
Are you sure it is okay to filter them out?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to