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

feature: use database triggers to add records on Hardware insert #1026

Merged
merged 8 commits into from
Mar 10, 2022

Conversation

weibullguy
Copy link
Collaborator

@weibullguy weibullguy commented Mar 10, 2022

Does this PR introduce a breaking change?

  • Yes
  • No

Describe the purpose of this pull request.

To use triggers to add new records to associated tables (design electric, design mechanic, mil-hdk-217f, nswc, and reliability) when a new record is added to the hardware table.

Describe how this was implemented.

Added triggers to database. Added methods to associated table to insert node in it's tree. Updated test suite and stub files.

Describe any particular area(s) reviewers should focus on.

None

Provide any other pertinent information.

Closes #985

Pull Request Checklist

  • Code Style

    • Code is following code style guidelines.
  • Static Checks

    • Failing static checks are only applicable to code outside the scope of
      this PR.
  • Tests

    • At least one test for all newly created functions/methods?
  • Chores

    • Issue(s) have been raised for problem areas outside the scope of
      this PR. These problem areas have been decorated with an ISSUE: # comment.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 10, 2022

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.16%.

Quality metrics Before After Change
Complexity 0.23 ⭐ 0.25 ⭐ 0.02 👎
Method Length 55.46 ⭐ 56.74 ⭐ 1.28 👎
Working memory 4.85 ⭐ 4.85 ⭐ 0.00
Quality 81.14% 81.30% 0.16% 👍
Other metrics Before After Change
Lines 9917 10469 552
Changed files Quality Before Quality After Quality Change
src/ramstk/models/dbtables/programdb_allocation_table.py 81.88% ⭐ 81.67% ⭐ -0.21% 👎
src/ramstk/models/dbtables/programdb_design_electric_table.py 95.76% ⭐ 87.91% ⭐ -7.85% 👎
src/ramstk/models/dbtables/programdb_design_mechanic_table.py 95.76% ⭐ 87.91% ⭐ -7.85% 👎
src/ramstk/models/dbtables/programdb_milhdbk217f_table.py 95.76% ⭐ 87.91% ⭐ -7.85% 👎
src/ramstk/models/dbtables/programdb_nswc_table.py 95.76% ⭐ 87.91% ⭐ -7.85% 👎
src/ramstk/models/dbtables/programdb_reliability_table.py 95.76% ⭐ 88.64% ⭐ -7.12% 👎
src/ramstk/models/dbtables/programdb_similar_item_table.py 74.70% 🙂 75.11% ⭐ 0.41% 👍
src/ramstk/models/dbviews/programdb_hardware_view.py 78.33% ⭐ 78.64% ⭐ 0.31% 👍
src/ramstk/views/gtk3/hardware/view.py 79.32% ⭐ 80.78% ⭐ 1.46% 👍
tests/conftest.py 80.24% ⭐ 80.03% ⭐ -0.21% 👎
tests/models/programdb/allocation/allocation_integration_test.py 86.31% ⭐ 85.98% ⭐ -0.33% 👎
tests/models/programdb/design_electric/design_electric_integration_test.py 85.42% ⭐ 85.53% ⭐ 0.11% 👍
tests/models/programdb/design_electric/design_electric_unit_test.py 77.04% ⭐ 77.04% ⭐ 0.00%
tests/models/programdb/design_mechanic/design_mechanic_integration_test.py 84.03% ⭐ 84.43% ⭐ 0.40% 👍
tests/models/programdb/design_mechanic/design_mechanic_unit_test.py 75.13% ⭐ 75.13% ⭐ 0.00%
tests/models/programdb/hardware/hardware_integration_test.py 71.08% 🙂 70.99% 🙂 -0.09% 👎
tests/models/programdb/milhdbk217f/milhdbk217f_integration_test.py 86.60% ⭐ 86.71% ⭐ 0.11% 👍
tests/models/programdb/milhdbk217f/milhdbk217f_unit_test.py 78.71% ⭐ 78.71% ⭐ 0.00%
tests/models/programdb/mission/mission_integration_test.py 92.44% ⭐ 92.44% ⭐ 0.00%
tests/models/programdb/mission_phase/mission_phase_integration_test.py 93.02% ⭐ 93.02% ⭐ 0.00%
tests/models/programdb/nswc/nswc_integration_test.py 83.88% ⭐ 84.22% ⭐ 0.34% 👍
tests/models/programdb/nswc/nswc_unit_test.py 74.31% 🙂 74.31% 🙂 0.00%
tests/models/programdb/reliability/reliability_integration_test.py 85.92% ⭐ 85.97% ⭐ 0.05% 👍
tests/models/programdb/reliability/reliability_unit_test.py 79.60% ⭐ 79.60% ⭐ 0.00%
tests/models/programdb/revision/revision_integration_test.py 92.09% ⭐ 92.09% ⭐ 0.00%
tests/models/programdb/similar_item/similar_item_integration_test.py 82.14% ⭐ 82.03% ⭐ -0.11% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
tests/models/programdb/hardware/hardware_integration_test.py TestAnalysisMethods.test_do_predict_hazard_rate_active_assembly_assessed 1 ⭐ 338 ⛔ 12 😞 47.52% 😞 Try splitting into smaller methods. Extract out complex expressions
tests/models/programdb/hardware/hardware_integration_test.py TestAnalysisMethods.test_do_calculate_hardware 0 ⭐ 258 ⛔ 12 😞 51.25% 🙂 Try splitting into smaller methods. Extract out complex expressions
tests/models/programdb/hardware/hardware_integration_test.py TestSelectMethods.test_on_select_all_tree_loaded 0 ⭐ 236 ⛔ 11 😞 54.14% 🙂 Try splitting into smaller methods. Extract out complex expressions
tests/models/programdb/hardware/hardware_integration_test.py TestSelectMethods.test_on_select_all 0 ⭐ 222 ⛔ 11 😞 54.98% 🙂 Try splitting into smaller methods. Extract out complex expressions
tests/models/programdb/hardware/hardware_integration_test.py TestAnalysisMethods.test_do_calculate_power_dissipation_assembly 0 ⭐ 140 😞 12 😞 60.38% 🙂 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@sonarcloud
Copy link

sonarcloud bot commented Mar 10, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
27.3% 27.3% Duplication

@weibullguy weibullguy self-assigned this Mar 10, 2022
@github-actions github-actions bot added the status: inprogress Issue or PR is open, milestoned, and assigned. label Mar 10, 2022
@weibullguy weibullguy added bump: patch Issue or PR documents a bug fix or enhancement requiring a patch version bump. priority: normal Issue or PR is normal priority. type: refactor Issue or PR dealing with refactoring of RAMSTK code. labels Mar 10, 2022
@codecov
Copy link

codecov bot commented Mar 10, 2022

Codecov Report

Merging #1026 (c498c9b) into master (b0cd45e) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1026      +/-   ##
==========================================
+ Coverage   94.80%   94.85%   +0.05%     
==========================================
  Files         144      144              
  Lines        5194     5247      +53     
  Branches      508      522      +14     
==========================================
+ Hits         4924     4977      +53     
  Misses        233      233              
  Partials       37       37              
Flag Coverage Δ
3.6 94.85% <100.00%> (+0.05%) ⬆️
3.7 94.85% <100.00%> (+0.05%) ⬆️
3.8 94.85% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...c/ramstk/models/dbviews/programdb_hardware_view.py 100.00% <ø> (ø)
...mstk/models/dbtables/programdb_allocation_table.py 100.00% <100.00%> (ø)
...models/dbtables/programdb_design_electric_table.py 100.00% <100.00%> (ø)
...models/dbtables/programdb_design_mechanic_table.py 100.00% <100.00%> (ø)
...stk/models/dbtables/programdb_milhdbk217f_table.py 100.00% <100.00%> (ø)
src/ramstk/models/dbtables/programdb_nswc_table.py 100.00% <100.00%> (ø)
...stk/models/dbtables/programdb_reliability_table.py 100.00% <100.00%> (ø)
...tk/models/dbtables/programdb_similar_item_table.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d4bc77...c498c9b. Read the comment docs.

@weibullguy weibullguy merged commit f7cbb7c into master Mar 10, 2022
@trafico-bot trafico-bot bot added the endgame: merged Pull Request has been merged successfully label Mar 10, 2022
@weibullguy weibullguy deleted the feature/issue-985 branch March 10, 2022 17:44
@weibullguy weibullguy added status: closed Pull Request is complete and integrated or closed for anther reason. and removed status: inprogress Issue or PR is open, milestoned, and assigned. labels Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump: patch Issue or PR documents a bug fix or enhancement requiring a patch version bump. endgame: merged Pull Request has been merged successfully priority: normal Issue or PR is normal priority. status: closed Pull Request is complete and integrated or closed for anther reason. type: refactor Issue or PR dealing with refactoring of RAMSTK code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Database Triggers to Add Records to Related Tables
1 participant