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

refactor: rewrite job_card.py queries in QB #32937

Merged
merged 2 commits into from
Nov 14, 2022

Conversation

s-aga-r
Copy link
Contributor

@s-aga-r s-aga-r commented Nov 12, 2022

Before

select 
    jc.name as name, 
    jctl.to_time 
from
    `tabJob Card Time Log` jctl, 
    `tabJob Card` jc 
where 
    jctl.parent = jc.name 
    and
    (
        ('2022-11-12 23:15:50.684475' > jctl.from_time and '2022-11-12 23:15:50.684475' < jctl.to_time) 
        or ('2022-11-13 01:15:50.684475' > jctl.from_time and '2022-11-13 01:15:50.684475' < jctl.to_time) 
        or ('2022-11-12 23:15:50.684475' <= jctl.from_time and '2022-11-13 01:15:50.684475' >= jctl.to_time)  
        or ('2022-11-12 23:15:50.684475' <= jctl.from_time and '2022-11-13 01:15:50.684475' <= jctl.to_time)
    )
    and jctl.name != 'No Name' 
    and jc.name != 'No Name' 
    and jc.docstatus < 2  
    and jc.workstation = '_Test Workstation 1' 
order by 
    jctl.to_time desc

After

SELECT 
    `tabJob Card`.`name` `name`,
    `tabJob Card Time Log`.`to_time` 
FROM 
    `tabJob Card Time Log`,
    `tabJob Card` 
WHERE 
    `tabJob Card Time Log`.`parent`=`tabJob Card`.`name` 
    AND 
    (
        (`tabJob Card Time Log`.`from_time`<'2022-11-12 23:18:10.482724' AND `tabJob Card Time Log`.`to_time`>'2022-11-12 23:18:10.482724') 
        OR (`tabJob Card Time Log`.`from_time`<'2022-11-13T01:18:10.482724' AND `tabJob Card Time Log`.`to_time`>'2022-11-13T01:18:10.482724') 
        OR (`tabJob Card Time Log`.`from_time`>='2022-11-12 23:18:10.482724' AND `tabJob Card Time Log`.`to_time`<='2022-11-13T01:18:10.482724') 
        OR (`tabJob Card Time Log`.`from_time`>='2022-11-12 23:18:10.482724' AND `tabJob Card Time Log`.`to_time`>='2022-11-13T01:18:10.482724')
    ) 
    AND `tabJob Card Time Log`.`name`<>'No Name' 
    AND `tabJob Card`.`name`<>'No Name' 
    AND `tabJob Card`.`docstatus`<2 
    AND `tabJob Card`.`workstation`='_Test Workstation 1' 
ORDER BY 
    `tabJob Card Time Log`.`to_time` DESC

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Nov 12, 2022
@s-aga-r s-aga-r force-pushed the refactor/qb/job-card branch from 6bd8907 to 357aa99 Compare November 12, 2022 07:06
@s-aga-r s-aga-r added backport version-13-hotfix backport version-14-hotfix backport to version 14 and removed needs-tests This PR needs automated unit-tests. labels Nov 12, 2022
@s-aga-r s-aga-r marked this pull request as ready for review November 12, 2022 11:07
@s-aga-r s-aga-r marked this pull request as draft November 12, 2022 16:01
@s-aga-r s-aga-r force-pushed the refactor/qb/job-card branch from 357aa99 to 7df2921 Compare November 12, 2022 16:34
@codecov
Copy link

codecov bot commented Nov 12, 2022

Codecov Report

Merging #32937 (a191ce6) into develop (22598a0) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #32937   +/-   ##
========================================
  Coverage    63.83%   63.84%           
========================================
  Files          819      819           
  Lines        58722    58729    +7     
========================================
+ Hits         37488    37495    +7     
  Misses       21234    21234           
Impacted Files Coverage Δ
erpnext/manufacturing/doctype/job_card/job_card.py 71.88% <100.00%> (+0.45%) ⬆️

@s-aga-r s-aga-r marked this pull request as ready for review November 13, 2022 04:13
@rohitwaghchaure rohitwaghchaure merged commit ab1722d into frappe:develop Nov 14, 2022
s-aga-r added a commit that referenced this pull request Nov 14, 2022
…-32937

refactor: rewrite `job_card.py` queries in QB (backport #32937)
s-aga-r added a commit that referenced this pull request Nov 14, 2022
…-32937

refactor: rewrite `job_card.py` queries in QB (backport #32937)
@s-aga-r s-aga-r deleted the refactor/qb/job-card branch April 15, 2023 10:01
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants