Skip to content

created a working test for CG12 | Group: "TeamExtreme"#1629

Open
KJeansGR wants to merge 2 commits into
OpenEnergyDashboard:developmentfrom
KJeansGR:development
Open

created a working test for CG12 | Group: "TeamExtreme"#1629
KJeansGR wants to merge 2 commits into
OpenEnergyDashboard:developmentfrom
KJeansGR:development

Conversation

@KJeansGR
Copy link
Copy Markdown

Description

Adds CG12 compare group quantity test coverage for kWh to kg CO₂ conversion behavior in readingsCompareGroupQuantity.js.

This test validates that compare readings for groups correctly return converted quantity values when using the kg CO₂ graphic unit.

Partly Addresses #[issue]

Type of change

(Check the ones that apply by placing an "x" instead of the space in the [ ] so it becomes [x])

  • Note merging this changes the database configuration.
  • This change requires a documentation update

Checklist

(Note what you have done by placing an "x" instead of the space in the [ ] so it becomes [x]. It is hoped you do all of them.)

  • [ x] I have followed the OED pull request ideas
  • [ x] I have removed text in ( ) from the issue request
  • [x ] You acknowledge that every person contributing to this work has signed the OED Contributing License Agreement and each author is listed in the Description section.

Limitations

The test currently inserts the required cik conversion row directly during setup to ensure the compare readings query has access to the expected conversion path.

@huss
Copy link
Copy Markdown
Member

huss commented May 24, 2026

@KJeansGR Thank you for this contribution. The PR description states the CLA has been signed by all contributors. However, the OED records do not have one for you. Furthermore, @WillyxWonka is the author of the one commit of this work. Thus, I would like you to:

  1. You, the other person and anyone else who worked on this to sign the CLA or let me know that you think our records are off.
  2. Add a comment that gives the names of any other people involved or states that you are the only two people.

Once this is done, this PR can be formally reviewed.

Given the limitation listed in the PR description, I did take a very quick look at the code. Here are some thoughts:

  • You changed the package.json file. I'm unclear on why so would like an explanation of why you wanted to do this. If this is a good idea, it is likely it should be a separate PR as I don't think it is directly related to the test case.
  • Tests of readings should not be inserting into cik in a direct way. This likely indicates either an issue with the test or a bug in OED. Whatever the cause, it needs to be figured out. I'm unsure why you did this so it is hard for me to comment too precisely on what might be wrong. I'm also not doing a detailed analysis until the CLA is done.

Please let me know if anything is not clear, you have thoughts or need something.

@WillyxWonka
Copy link
Copy Markdown

WillyxWonka commented May 24, 2026 via email

@huss
Copy link
Copy Markdown
Member

huss commented May 24, 2026

@WillyxWonka Thank you for the quick and complete comment. My thoughts are below.

The package.json change was unrelated to CG12, and I will remove it from the PR.

Good. Don't forget to revert the package-lock.json.

Regarding the direct insertion into cik: during debugging I found that the compare readings path was returning null values unless the Electric_Utility → kg CO₂ conversion existed in cik. The conversion existed in the conversions table and redoCik(conn) was being called, but the expected conversion path was still not appearing in cik for the compare readings query. I added the direct cik insertion as a temporary debugging workaround to verify that the compare group calculation itself produced the expected CG12 values once the conversion path existed. Line quantity tests such as L18 and LG18 passed successfully using similar conversion definitions, but compare group quantity tests continued returning null values. I agree that directly inserting into cik is probably not the correct final approach. I will continue investigating whether this is: - an issue in my test setup - or a bug/inconsistency in the compare readings conversion pipeline. I was hoping for more clarity because I initially attempted to use the provided conversion definitions directly from the testing documentation, but the compare group test consistently returned null values. I may be misunderstanding part of the intended setup, so I plan to discuss this further with my group as well. I moved quickly on the PR because I thought I may have identified a real issue in the compare conversion path.

First, let me say that your debugging of the issue was quite good. I think it may be best for you to not spend more time working on this until I can have a look as it is unexpected. I will try to find time soon to do that and let you know what I find. If you feel otherwise then let me know.

Regarding contributors: this work was completed as part of my class capstone group assignment, but I am the only contributor to this specific PR/code change. Also, the @WillyxWonka GitHub profile referenced in the commit history is also me using a different username/account identity. I will also complete the CLA requirements.

Sounds good and thanks for the clarification.

@WillyxWonka
Copy link
Copy Markdown

WillyxWonka commented May 24, 2026 via email

};

await prepareTest(
unitDatakWh.concat([u10, u12]),
Copy link
Copy Markdown
Member

@huss huss May 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KJeansGR The testing design document specified u2, u10 & u12 but you don't have u2. Also, c11 & c12 but you don't have c12. I searched the code base for "kWh as kg of CO2" to find tests that also use these units. This revealed BG12 that uses these units and is a group test (but for bar not compare). (There are others but they differ more). It may help to look at this one to see how to set this up. I cannot be certain but I think this is what is causing your issues and the need to touch cik. The missing unit/conversion means the needed cik entries are not there. Please let me know if anything is not clear, you have thoughts/question or need help.

Also, don't forget the CLA & the package changes.

Copy link
Copy Markdown
Member

@huss huss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KJeansGR Review and testing found your updates work as expected and desired. I made two minor comments to consider. Finally, you need to do the CLA for this to move forward.

@@ -333,7 +333,82 @@ mocha.describe('readings API', () => {
});

// Add CG12 here
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove this placeholder comment now that the test is done.

});

expectCompareToEqualExpected(res, expected, GROUP_ID);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really small but could you remove these two blank lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants