Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mpp-batch-views
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dasharatha.vamshi
mpp-batch-views
Commits
768cac9d
Commit
768cac9d
authored
Jun 20, 2023
by
dasharatha.vamshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
e3e65c2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
v_batch_running_final
v_batch_running_final
+48
-0
No files found.
v_batch_running_final
0 → 100644
View file @
768cac9d
SELECT
subquery.batch_no,
subquery.process_stage_id,
subquery.master_product_id,
subquery.batch_start,
concat(
CASE
WHEN (subquery.years > (0)::numeric) THEN ((subquery.years)::text || 'y '::text)
ELSE ''::text
END,
CASE
WHEN ((subquery.months > (0)::numeric) AND (subquery.months < (12)::numeric)) THEN ((subquery.months)::text || 'mon '::text)
ELSE ''::text
END,
CASE
WHEN ((subquery.weeks > (0)::numeric) AND (subquery.weeks < (4)::numeric)) THEN ((subquery.weeks)::text || 'w '::text)
ELSE ''::text
END,
CASE
WHEN ((subquery.days > (0)::numeric) AND (subquery.days < (7)::numeric)) THEN ((subquery.days)::text || 'd '::text)
ELSE ''::text
END,
CASE
WHEN ((subquery.hours > (0)::numeric) AND (subquery.hours < (24)::numeric)) THEN ((subquery.hours)::text || 'h '::text)
ELSE ''::text
END,
CASE
WHEN ((subquery.minutes > (0)::numeric) AND (subquery.minutes < (60)::numeric)) THEN ((subquery.minutes)::text || 'm'::text)
ELSE ''::text
END
) AS duration_formatted
FROM (
SELECT
batch_details.batch_no,
batch_details.process_stage_id,
batch_details.master_product_id,
batch_details.batch_start,
floor((EXTRACT(epoch FROM (now() - batch_details.batch_start)) / (((((60 * 60) * 24) * 7) * 52))::numeric)) AS years,
(floor((EXTRACT(epoch FROM (now() - batch_details.batch_start)) / ((((60 * 60) * 24) * 30)::double precision))::numeric) % (12)::numeric) AS months,
(floor((EXTRACT(epoch FROM (now() - batch_details.batch_start)) / ((((60 * 60) * 24) * 7)::double precision))::numeric) % (52)::numeric) AS weeks,
(floor((EXTRACT(epoch FROM (now() - batch_details.batch_start)) / (((60 * 60) * 24)::double precision))::numeric) % (7)::numeric) AS days,
(floor((EXTRACT(epoch FROM (now() - batch_details.batch_start)) / ((60 * 60)::double precision))::numeric) % (24)::numeric) AS hours,
(floor((EXTRACT(epoch FROM (now() - batch_details.batch_start)) / (60)::double precision)::numeric) % (60)::numeric) AS minutes
FROM
batch_details
WHERE
(batch_details.batch_start IS NOT NULL) AND (batch_details.batch_end IS NULL)
) subquery;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment