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

Use audited to track changes in investments #3811

Merged
merged 9 commits into from
Nov 5, 2019
Merged

Conversation

javierm
Copy link
Member

@javierm javierm commented Nov 3, 2019

References

Background

Our current implementation of #3433 has a few issues:

  • Validation rules prevented tracking changes when a field was blank or became blank
  • It didn't track fields like tags, valuation tags or milestone tags
  • It stopped tracking fileds like title and description when we made them translatable; there was a bug in the test covering the scenario and so the test kept passing
  • Fields like selected were marked as changing from t to f and vice versa, instead of true and false
  • Dates were not localized

Objectives

  • Improve tracking of investment changes
  • Use a gem which simplifies the code and will allow us to track changes to any other model if we require it
  • Improve the user interface to track these changes

Visual changes

Before these changes:

Fields are not translated, boolean values are 't' and 'f', and the text in the table is very long

After these changes:

Fields and boolean values are translated, and texts are truncated

Notes

After these changes, the implementation is still far from perfect, but it's much better than it was.

@javierm javierm added the Bug label Nov 3, 2019
@javierm javierm self-assigned this Nov 3, 2019
@javierm javierm added this to Reviewing in Roadmap via automation Nov 3, 2019
@javierm javierm moved this from Reviewing to Doing in Roadmap Nov 3, 2019
@javierm javierm force-pushed the investment_changelog branch 2 times, most recently from 8a9c974 to a3693da Compare November 3, 2019 15:48
@javierm javierm changed the title [WIP] Use audited to track changes in investments Use audited to track changes in investments Nov 3, 2019
@javierm javierm moved this from Doing to Reviewing in Roadmap Nov 3, 2019
Since we were saving the same budget investments several times, once for
every language, we were creating more than 1000 changelog entries.

Assigning the language attributes when creating the investments
generates less entries, making it easier to work with them.
If we validate the presence of the old value and the new value, changes
in optional fields will not be stored if either the old value or the new
value are blank.
Our manual implementation had a few issues. In particular, it didn't
track changes related to associations, which became more of an issue
when we made investments translatable.

Using audited gives us more functionality while at the same time
simplifies our code. However, it adds one more external dependency to
our project.

The reason for choosing audited over paper trail is audited seems to
make it easier to handle associations.
The same way we do for milestones. We also make the code more consistent
since the view was already in a separate folder.
Note the user interface could certainly be improved, as it doesn't show
which languages have changed.
The name of the changed field is translated, values are truncated so
descriptions with thousands of character would make this table huge and
impossible to read, dates are localized, and values like arrays and
booleans are displayed properly.
Don't use <label> tags for things that are not labels, add a proper
<title> for the page, add a back link, remove an unnecessary
`inline-block` style for a header, localize dates and field names, ...

The interface could be further improve: proper diffs for long texts,
better separation between fields, ...
@javierm javierm force-pushed the investment_changelog branch 3 times, most recently from 3155b29 to 77310f0 Compare November 5, 2019 12:44
@javierm javierm merged commit cbe6af3 into master Nov 5, 2019
Roadmap automation moved this from Reviewing to Release 1.1.0 Nov 5, 2019
@javierm javierm deleted the investment_changelog branch November 5, 2019 13:49
smarques pushed a commit to venetochevogliamo/consul that referenced this pull request Apr 29, 2020
Use audited to track changes in investments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Roadmap
  
Release 1.1.0
Development

Successfully merging this pull request may close these issues.

None yet

1 participant