-
-
Notifications
You must be signed in to change notification settings - Fork 420
Accountability: track results #2206
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
Conversation
ab1f8a2
to
5a6dec7
Compare
Codecov Report
@@ Coverage Diff @@
## master #2206 +/- ##
=========================================
+ Coverage 98.58% 98.6% +0.01%
=========================================
Files 1239 1249 +10
Lines 28439 28725 +286
=========================================
+ Hits 28038 28325 +287
+ Misses 401 400 -1 |
ceb8996
to
e00f53c
Compare
helper Decidim::TraceabilityHelper | ||
helper_method :current_version, :result | ||
|
||
def show |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to declare actions
<span class="definition-data__title"><%= t("results.show.stats.current_version_number", scope: "decidim.accountability") %></span> | ||
<%= result.versions.count %> | ||
</div> | ||
<% if result.versions.last.whodunnit.present? %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a method to result
instead of all this chaining?
<span class="definition-data__title"><%= t("results.show.stats.current_version_number", scope: "decidim.accountability") %></span> | ||
<%= result.versions.count %> | ||
</div> | ||
<% if result.versions.last.whodunnit.present? %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
<div> | ||
<%= link_to result_versions_path(result, index) do %> | ||
<h6 class="card--list__heading heading6"> | ||
VERSION <%= index + 1 %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i18n
<div class="columns section mediumlarge-4 large-3"> | ||
<div class="card extra definition-data"> | ||
<div class="definition-data__item versions_count"> | ||
<span class="definition-data__title">VERSION NUMBER</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i18n
</div> | ||
<% if current_version.whodunnit.present? %> | ||
<div class="definition-data__item last_revision_by"> | ||
<span class="definition-data__title">VERSION AUTHOR</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i18n
save if changed? | ||
return unless changed? | ||
|
||
# rubocop:disable Rails/SkipsModelValidations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the documentation clear enough as to why we need to do this? Maybe I should improve it :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've improved the documentation to note why we need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an ugly hack, but I can't see any ways to work around it. It's PostgreSQL/Rails/MVC's fault I believe...
e08ecea
to
9dc3c4a
Compare
f851088
to
74b6170
Compare
Codeclimate says no |
74b6170
to
342c50c
Compare
@josepjaume solved! |
Let's get this in! |
🎩 What? Why?
This PR adds traceabilty to results, so end users can track the different versions and see how a result is being updated.
This PR keeps track of changes in all attributes of the result, but does not keep track of the related proposals.
paper_trail
, the gem I'm using to generate versions, says it can track relations, but I doubt it can track how we're dealing with ourlinked_resources
, and the README says it's an experimental feature and it's not ready for production. This means we have to track it manually, creating a new version manually every time the relations are changed. But we'd also need to use a custom serializer, because otherwise it cannot keep track of the relations since their are not a real attribute.This leads to a rabbit hole that will end up biting us in the future. Instead of that, I suggest iterating over the current solution and, if needed, create a custom way to save versions that has a way to keep track of our own
linked_resources
.In order to solve the issue by now, we could either remove the ability to change the linked proposals of a result when editing, or don't track them at all. Since I understand sometimes human errors can be made and can cause people to forget the linked proposals and edit the result to add them, I think it's good if we don't track the linked proposals at all.
📌 Related Issues
📋 Subtasks
paper_trail
whodunnit
everywhere📷 Screenshots (optional)
Screenshots are updated with the latest commit.
Result page with versions:

Versions index page for a single result:

Version created after modifying the description of the result:

Version created after creating a result:
