Skip to content

Commit

Permalink
updated current_app.stats.count to correct name, added depreacated de…
Browse files Browse the repository at this point in the history
…corator to update_personal_data(), removed language from UserNameSchema
  • Loading branch information
alessandrodi committed Sep 26, 2024
1 parent 12d274a commit ac32759
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/eduid/webapp/personal_data/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class UserNameSchema(EduidSchema):
chosen_given_name = fields.String(required=False)
surname = fields.String(required=True)
legal_name = fields.String(required=False)
language = fields.String(required=True, attribute="preferredLanguage")


class UserLanguageRequestSchema(EduidSchema, CSRFRequestMixin):
Expand Down
6 changes: 4 additions & 2 deletions src/eduid/webapp/personal_data/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from eduid.common.decorators import deprecated
from flask import Blueprint

from eduid.common.config.base import FrontendAction
Expand Down Expand Up @@ -48,6 +49,7 @@ def get_user(user: User) -> FluxData:
return success_response(payload=user.to_dict())


@deprecated("update_personal_data view is deprecated, use update_user_name or update_user_language view instead")

Check failure on line 52 in src/eduid/webapp/personal_data/views.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (W291)

src/eduid/webapp/personal_data/views.py:52:114: W291 Trailing whitespace

Check failure on line 52 in src/eduid/webapp/personal_data/views.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (W291)

src/eduid/webapp/personal_data/views.py:52:114: W291 Trailing whitespace
@pd_views.route("/user", methods=["POST"])
@UnmarshalWith(PersonalDataRequestSchema)
@MarshalWith(PersonalDataResponseSchema)
Expand Down Expand Up @@ -117,7 +119,7 @@ def update_user_name(
save_and_sync_user(personal_data_user)
except UserOutOfSync:
return error_response(message=CommonMsg.out_of_sync)
current_app.stats.count(name="personal_data_saved", value=1)
current_app.stats.count(name="user_name_saved", value=1)
current_app.logger.info(f"Saved personal data for user {personal_data_user}")

personal_data = personal_data_user.to_dict()
Expand All @@ -139,7 +141,7 @@ def update_user_language(
save_and_sync_user(personal_data_user)
except UserOutOfSync:
return error_response(message=CommonMsg.out_of_sync)
current_app.stats.count(name="personal_data_saved", value=1)
current_app.stats.count(name="user_language_saved", value=1)
current_app.logger.info(f"Saved personal data for user {personal_data_user}")

personal_data = personal_data_user.to_dict()
Expand Down

0 comments on commit ac32759

Please sign in to comment.