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

Added Admin Warnings For Deleting Conversions #1400

Open
wants to merge 11 commits into
base: development
Choose a base branch
from

Conversation

danielshid
Copy link
Contributor

Description

I added warnings to inform admins of the impact their actions will have on meter units and possible graphing units when choosing to delete conversions.

Partially Addresses #905

Type of change

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

Checklist

  • I have followed the OED pull request ideas
  • I have removed text in ( ) from the issue request
  • 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

I was not able to cover cases for default graphic units and groups.

Copy link
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.

Thanks to @danielshid for working on this issue. Overall, it is fine. I have made some comments about details and style for you to consider. Given the cases are complex, this is not surprising. I did some testing and it works as desired (modulo the comments). I'll do a final check after the comments are addressed. Let me know if I can help in any way.

if (count === 1) {
msg += `Deleting this meter conversion will orphan ${unitDataById[state.destinationId].name}.\n`;
} else {
msg += 'Deleting this meter conversion will make the following meter(s) ungraphable:\n';
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure the logic is what was desired. If there is only this conversion and there are meter(s) using the source unit then tell the admin about each meter and cancel the delete. If there are multiple conversions then tell the admin about each meter using the source unit and warn that the number of graphable units for the meter is reduced.

if (destCount === 1) {
msg += `Deleting this unit conversion will orphan ${unitDataById[state.destinationId].name}.\n`;
}
if (state.bidirectional) {
Copy link
Member

Choose a reason for hiding this comment

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

I think the description of the cases I gave you was confusing. What needs to be determined (including the check right above) is if there is only this conversion for the unit. To check this, the code needs to check if that unit is a source or if the conversion is bidirectional then it can be the destination (excluding the one being deleted). The idea is if it is the destination then it can could get to another unit if allowed which means it must be bidirectional. This check is looking at the bidirectional status of the one being deleted and not the other possibilities.

src/client/app/styles/modal.css Outdated Show resolved Hide resolved
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.

2 participants