Skip to content

[MDS-5758] Dam History #3463

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

Merged
merged 14 commits into from
Mar 18, 2025
Merged

[MDS-5758] Dam History #3463

merged 14 commits into from
Mar 18, 2025

Conversation

taraepp
Copy link
Collaborator

@taraepp taraepp commented Mar 14, 2025

Objective

  • record and show history of the dam
  • the damReducer was pretty lightweight so I turned it into a slice
  • made DiffTable re-usable
  • I wanted to be able to use functions and hashes for displaying data, so added that in.
  • made HistoryMixin on the BE

MDS-5758

Why are you making this change? Provide a short explanation and/or screenshots
The modal:
image
All of the fields:
image

@@ -15,14 +15,14 @@ class ConsequenceClassification(Enum):
NRT = 'NRT'

def __str__(self):
return self.value
return self.value[0]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this was interesting! I kept getting errors in the bit that converted these values to strings. As it turned out, self.value actually returned a Tuple. So it looked like [ValueIWant,].

'operating_status': fields.String(enum=OperatingStatus, attribute='operating_status.name'),
'consequence_classification': fields.String(enum=ConsequenceClassification, attribute='consequence_classification.name'),
'operating_status': fields.String,
'consequence_classification': fields.String,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know why, but these enums worked perfectly fine when using DAM_MODEL but exploded the swagger when it was cloned into DAM_HISTORY_MODEL. Turned them into fields.String on the base model on the off-chance that another enum attribute is added at some point or someone goes to use it as a reference.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting. Should work fine though in this model context.

Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_minespace-web'

Failed conditions
53.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_common'

Failed conditions
78.7% Coverage on New Code (required ≥ 80%)
9.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link

Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_core-api'

Failed conditions
15.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

changeset: IDiffColumn[];
}

/**
* Used to map the diff titles and values to a more user-friendly format
* Supply *one of* hash, tranform, data
Copy link
Collaborator

Choose a reason for hiding this comment

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

Autobots, TRANFORM! 😆


const createRequestHeader = REQUEST_HEADER.createRequestHeader;

const damSlice = createAppSlice({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! Loving the slice format!

@@ -478,6 +479,30 @@ class AuditMixin(object):
update_timestamp = db.Column(
db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)

class HistoryMixin(object):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh nice, good idea!

Copy link
Collaborator

@matbusby-fw matbusby-fw left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Collaborator

@sggerard sggerard left a comment

Choose a reason for hiding this comment

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

Nice Dam work! 🦫

@taraepp taraepp merged commit 16193d8 into develop Mar 18, 2025
17 of 20 checks passed
@taraepp taraepp deleted the mds-5758-dam-history branch March 18, 2025 17:04
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.

3 participants