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
e3e65c2c
Commit
e3e65c2c
authored
Jun 20, 2023
by
dasharatha.vamshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update v_batch_running.txt
parent
53f12692
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
+31
-3
v_batch_running.txt
v_batch_running.txt
+31
-3
No files found.
v_batch_running.txt
View file @
e3e65c2c
...
@@ -3,12 +3,40 @@ create or replace view v_batch_running as
...
@@ -3,12 +3,40 @@ create or replace view v_batch_running as
subquery.process_stage_id,
subquery.process_stage_id,
subquery.master_product_id,
subquery.master_product_id,
subquery.batch_start,
subquery.batch_start,
concat((subquery.hours)::text, ' hrs', ' : ', lpad((subquery.minutes)::text, 2, '0'::text), ' mins') AS duration_formatted
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,
FROM ( SELECT batch_details.batch_no,
batch_details.process_stage_id,
batch_details.process_stage_id,
batch_details.master_product_id,
batch_details.master_product_id,
batch_details.batch_start,
batch_details.batch_start,
((date_part('day'::text, (now() - batch_details.batch_start)) * (24)::double precision) + date_part('hour'::text, (now() - batch_details.batch_start))) AS hours,
floor((EXTRACT(epoch FROM (now() - batch_details.batch_start)) / (((((60 * 60) * 24) * 7) * 52))::numeric)) AS years,
date_part('minute'::text, (now() - batch_details.batch_start)) AS minutes
(floor((EXTRACT(epoch FROM (now() - batch_details.batch_start)) / ((((60 * 60) * 24) * 30))::numeric)) % (12)::numeric) AS months,
(floor((EXTRACT(epoch FROM (now() - batch_details.batch_start)) / ((((60 * 60) * 24) * 7))::numeric)) % (52)::numeric) AS weeks,
(floor((EXTRACT(epoch FROM (now() - batch_details.batch_start)) / (((60 * 60) * 24))::numeric)) % (7)::numeric) AS days,
(floor((EXTRACT(epoch FROM (now() - batch_details.batch_start)) / ((60 * 60))::numeric)) % (24)::numeric) AS hours,
(floor((EXTRACT(epoch FROM (now() - batch_details.batch_start)) / (60)::numeric)) % (60)::numeric) AS minutes
FROM batch_details
FROM batch_details
WHERE ((batch_details.batch_start IS NOT NULL) AND (batch_details.batch_end IS NULL))) subquery;
WHERE ((batch_details.batch_start IS NOT NULL) AND (batch_details.batch_end IS NULL))) subquery;
\ No newline at end of file
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