mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
fixing job state setting when job is disabled
This commit is contained in:
@@ -169,9 +169,17 @@ export const removeJobsByUserId = (userId) => {
|
||||
|
||||
/**
|
||||
* Get all jobs.
|
||||
*
|
||||
* By default only enabled jobs are returned, since most callers (scheduler,
|
||||
* geocoding cron, tracker, dashboard) operate on active jobs only. The UI,
|
||||
* however, must also be able to load disabled jobs (e.g. to edit them or view
|
||||
* their listings), so it passes `includeDisabled: true`.
|
||||
*
|
||||
* @param {Object} [params]
|
||||
* @param {boolean} [params.includeDisabled=false] - When true, disabled jobs are included.
|
||||
* @returns {Job[]} List of jobs ordered by name (NULLs last).
|
||||
*/
|
||||
export const getJobs = () => {
|
||||
export const getJobs = ({ includeDisabled = false } = {}) => {
|
||||
const rows = SqliteConnection.query(
|
||||
`SELECT j.id,
|
||||
j.user_id AS userId,
|
||||
@@ -186,7 +194,7 @@ export const getJobs = () => {
|
||||
j.last_run_at AS lastRunAt,
|
||||
(SELECT COUNT(1) FROM listings l WHERE l.job_id = j.id AND l.is_active = 1 AND l.manually_deleted = 0) AS numberOfFoundListings
|
||||
FROM jobs j
|
||||
WHERE j.enabled = 1
|
||||
${includeDisabled ? '' : 'WHERE j.enabled = 1'}
|
||||
ORDER BY j.name IS NULL, j.name`,
|
||||
);
|
||||
return rows.map((row) => ({
|
||||
|
||||
Reference in New Issue
Block a user