Skip to content

Commit

Permalink
Merge branch 'main' into assets-ui-pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaunity authored Oct 4, 2024
2 parents 9f4fbb6 + 62f6644 commit 5daa074
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion documentation/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Infrastructure / Support

Bugfixes
-----------

* The UI footer now stays at the bottom even on pages with little content [see `PR #1204 <https://github.com/FlexMeasures/flexmeasures/pull/1204>`_]


v0.23.0 | September 18, 2024
Expand Down
2 changes: 1 addition & 1 deletion flexmeasures/api/v3_0/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def patch(self, account_data: dict, id: int, account: Account):
for k, v in account_data.items():
setattr(account, k, v)

event_message = f"Account {account.name} has been updated. Modified fields: {modified_fields_str}"
event_message = f"Account Updated, Field: {modified_fields_str}"

# Add Audit log
account_audit_log = AuditLog(
Expand Down
11 changes: 5 additions & 6 deletions flexmeasures/api/v3_0/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,17 +347,16 @@ def patch(self, asset_data: dict, id: int, db_asset: GenericAsset):
for attr_key, attr_value in v.items():
if current_attributes.get(attr_key) != attr_value:
audit_log_data.append(
f"Attr: {attr_key}, From: {current_attributes.get(attr_key)}, To: {attr_value}"
f"Updated Attr: {attr_key}, From: {current_attributes.get(attr_key)}, To: {attr_value}"
)
continue
audit_log_data.append(f"Field: {k}, From: {getattr(db_asset, k)}, To: {v}")
audit_log_data.append(
f"Updated Field: {k}, From: {getattr(db_asset, k)}, To: {v}"
)

# Iterate over each field or attribute updates and create a separate audit log entry for each.
for event in audit_log_data:
audit_log_event = (
f"Updated asset '{db_asset.name}': {db_asset.id}; fields: {event}"
)
AssetAuditLog.add_record(db_asset, audit_log_event)
AssetAuditLog.add_record(db_asset, event)

for k, v in asset_data.items():
setattr(db_asset, k, v)
Expand Down
4 changes: 2 additions & 2 deletions flexmeasures/api/v3_0/tests/test_assets_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def test_alter_an_asset(
print(f"Editing Response: {asset_edit_response.json}")
assert asset_edit_response.status_code == 200

audit_log_event = f"Updated asset '{prosumer_asset.name}': {prosumer_asset.id}; fields: Field: name, From: {name}, To: other"
audit_log_event = f"Updated Field: name, From: {name}, To: other"
assert db.session.execute(
select(AssetAuditLog).filter_by(
event=audit_log_event,
Expand All @@ -213,7 +213,7 @@ def test_alter_an_asset(
)
).scalar_one_or_none()

audit_log_event = f"Updated asset '{prosumer_asset.name}': {prosumer_asset.id}; fields: Field: latitude, From: {latitude}, To: 11.1"
audit_log_event = f"Updated Field: latitude, From: {latitude}, To: 11.1"
assert db.session.execute(
select(AssetAuditLog).filter_by(
event=audit_log_event,
Expand Down
4 changes: 2 additions & 2 deletions flexmeasures/ui/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
{% endblock %}
</head>

<body>
<body class="d-flex flex-column min-vh-100">

{% block body %}

Expand Down Expand Up @@ -943,7 +943,7 @@
src="https://cdn.datatables.net/plug-ins/1.10.22/features/conditionalPaging/dataTables.conditionalPaging.js"></script>
{% endblock paginate_tables_script %}

<footer class="page-footer font-small pt-4 mt-4">
<footer class="page-footer font-small pt-4 mt-auto">
<div class="footer text-center">
<div class="container-fluid">
{% block copyright_notice %}
Expand Down

0 comments on commit 5daa074

Please sign in to comment.