Skip to content

Show eCapris status syncing updates in project activity log#1618

Merged
mddilley merged 8 commits into
mike/22270_notes_viewfrom
mateo/22431_ecapric_activity_log
Jul 2, 2025
Merged

Show eCapris status syncing updates in project activity log#1618
mddilley merged 8 commits into
mike/22270_notes_viewfrom
mateo/22431_ecapric_activity_log

Conversation

@mateoclarke
Copy link
Copy Markdown
Contributor

@mateoclarke mateoclarke commented Jun 26, 2025

Associated issues

Closes cityofaustin/atd-data-tech#22431

Screenshot 2025-06-27 at 12 58 29 PM

Note: It's not in scope here, but I'd recommend a follow-up issue to make it so that Activity Log data automatically refreshes instead of having to manually refresh to see updates in the tab. cc/ @mddilley

Testing

Will have to test locally since this is a branch off a branch.

Steps to test:

  • Go to any project
  • On the summary page...
    • a. If the project has an eCAPRIS Subproject ID, delete it. Check the Activity tab and refresh the page (this is needed to requery the activity log data). You should see a new activity log entry that says the ID was removed and the sync was disabled.
    • b. If the project doesn't have an eCAPRIS Subject ID, add one (ex: 7333.001). Check the Activity tab and refresh the page (this is needed to requery the activity log data). You should see a new activity log entry that says the ID was set and sync was enabled.
  • Now do the opposite from the step above. If you did A, go ahead and add a Subproject ID and follow B above. If you did B, delete the Subproject ID you added and follow A above. You should now have tested both adding and removing a Subproject ID and checked how those actions are displayed in the activity log.
  • Now, with a subproject ID added, go to the Notes tab and disable the sync from eCapris. Check the activity log tab, refresh the page, and confirm the activity of Disabled eCapris sync is displayed. On Notes, toggle it back on, go back to Activity tab, refresh, and confirm the activity of Enabled eCapris sync.
  • Now, with sync enabled, go back to the Summary page and change the subproject ID (ex: 2231.292). In the Activity tab, you should see that sync was updated from the old subproject ID to the new one.
  • Now, with sync disabled, change the subproject ID on the Summary tab and you should see an Activity Log item that says the subproject ID was added and sync status was automatically enabled.

Ship list

@mateoclarke mateoclarke marked this pull request as draft June 26, 2025 14:04
Comment thread README.md
```bash
./hasura_cluster start_only
./run_migrations
hasura migrate apply
Copy link
Copy Markdown
Contributor Author

@mateoclarke mateoclarke Jun 26, 2025

Choose a reason for hiding this comment

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

if you try ./run_migrations

zsh: no such file or directory: ./run_migrations`

if you try ./hasura-cluster run_migrations

./hasura-cluster: line 376: run_migrations: command not found

so I updated the README to use the basic hasura cli command

// check truthiness to prevent rendering String(null) as "null"
!!changeData.new[changedField] &&
String(changeData.new[changedField]).length > 0
String(changeData.new[changedField]).length > 0
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

autoformatting

},
project_name_secondary: {
label: "secondary project name"
label: "secondary project name",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the rest of the updates in this file are just autoformatting...

const changedField = change.description[0].field;
// Get the changed fields from the description
const changedFields = change.description[0]?.fields || [];
const changedField = changedFields[0];
Copy link
Copy Markdown
Contributor Author

@mateoclarke mateoclarke Jun 27, 2025

Choose a reason for hiding this comment

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

This got a little tricky. Previously, we've been assuming there is only one changed field, but the current behavior with eCAPRIS updates is that you can have both should_sync_ecapris_statusesand ecapris_subproject_id together as one activity.

So I tried to account for this by letting changedFields be an array but not changing everything and letting changedField assume the first entry in the array.

This felt like the best way to not rock the boat but create an on-ramp to evaluate if the changedFields array contains one or both of the ecapris activity types.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I agree that this feels like a good way to avoid a large refactor. Thanks for handling it and good to know. 🙏

const newData = outputEvent.record_data.event.data.new;
const oldData = outputEvent.record_data.event.data.old;
let changedField = "";
let changedFields = [];
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Continuing the theme here. Updating changedField from one string to changedFields as an array. This is probably where my code could use the most skeptical eye that this change doesn't effect other patterns.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for flagging! I looked many different production project activity logs with this update, and I didn't find anything that looked out of order.

@mateoclarke mateoclarke marked this pull request as ready for review June 27, 2025 19:29
changeIcon,
changeText: [
{
text: "Updated eCAPRIS subproject statuses sync for ",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i almost was wanting this to say "Updated eCAPRIS subproject ID from ___ to ___", similar to the message for when you add or delete a subproject ID. this message was kind of reading as if it was the sync status that changed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think you're right. If we wanted to be extra verbose, maybe "Updated eCAPRIS subproject ID and statuses sync from ___ to ___". Since technically the sync status didn't change but it's updated and activated by default with the new subproject ID.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am all about this change. 🙏 Thanks y'all and could you update to what you suggested @mateoclarke? I can also update later if needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

just pushed the update!

Copy link
Copy Markdown
Contributor

@roseeichelmann roseeichelmann left a comment

Choose a reason for hiding this comment

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

I like the way you handled this with adding the changedFields array. I have one comment on maybe changing the wording of one of the activity log messages, but other than that this looks and works great to me!!

Copy link
Copy Markdown
Collaborator

@mddilley mddilley left a comment

Choose a reason for hiding this comment

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

Looks awesome! I tested all combinations of id and sync updates on my local instance, and I see the activity log reflect the changes. Cool to see this code extended too! 🚀

Love the improved wording that you and Rose discussed. 🚢

const changedField = change.description[0].field;
// Get the changed fields from the description
const changedFields = change.description[0]?.fields || [];
const changedField = changedFields[0];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I agree that this feels like a good way to avoid a large refactor. Thanks for handling it and good to know. 🙏

changeIcon,
changeText: [
{
text: "Updated eCAPRIS subproject statuses sync for ",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am all about this change. 🙏 Thanks y'all and could you update to what you suggested @mateoclarke? I can also update later if needed.

const newData = outputEvent.record_data.event.data.new;
const oldData = outputEvent.record_data.event.data.old;
let changedField = "";
let changedFields = [];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for flagging! I looked many different production project activity logs with this update, and I didn't find anything that looked out of order.

@mddilley
Copy link
Copy Markdown
Collaborator

Noting that I retested the latest commit, and it looks great. 🚢

@mateoclarke Thanks for noting the need to refresh the activity log after making project updates. I dug up cityofaustin/atd-data-tech#15828 which was created to address.

Copy link
Copy Markdown
Member

@johnclary johnclary left a comment

Choose a reason for hiding this comment

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

Awesome work—these activity log messages look really excellent. So fancy is the Moped activity log 😍

Copy link
Copy Markdown
Member

@chiaberry chiaberry left a comment

Choose a reason for hiding this comment

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

I really like how you were able to address multiple fields being updated without it cascading down to be a huge refactor. Its been a long time since I've really looked at the activity log code and I am trying to remember if there are other activities that possibly update more than one field at a time? future work!

mddilley added 2 commits July 2, 2025 12:43
Handle eCAPRIS sync activity in log when there is no eCAPRIS subproject id
@mddilley mddilley merged commit 6b723e7 into mike/22270_notes_view Jul 2, 2025
@mddilley mddilley deleted the mateo/22431_ecapric_activity_log branch July 2, 2025 22:01
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.

5 participants