Accountability: track results#2206
Merged
Merged
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
oriolgual
suggested changes
Nov 20, 2017
| helper Decidim::TraceabilityHelper | ||
| helper_method :current_version, :result | ||
|
|
||
| def show |
Contributor
There was a problem hiding this comment.
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? %> |
Contributor
There was a problem hiding this comment.
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? %> |
| <div> | ||
| <%= link_to result_versions_path(result, index) do %> | ||
| <h6 class="card--list__heading heading6"> | ||
| VERSION <%= index + 1 %> |
| <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> |
| </div> | ||
| <% if current_version.whodunnit.present? %> | ||
| <div class="definition-data__item last_revision_by"> | ||
| <span class="definition-data__title">VERSION AUTHOR</span> |
| save if changed? | ||
| return unless changed? | ||
|
|
||
| # rubocop:disable Rails/SkipsModelValidations |
Contributor
Author
There was a problem hiding this comment.
Is the documentation clear enough as to why we need to do this? Maybe I should improve it :(
Contributor
Author
There was a problem hiding this comment.
I've improved the documentation to note why we need this.
Contributor
There was a problem hiding this comment.
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
Contributor
|
Codeclimate says no |
74b6170 to
342c50c
Compare
Contributor
Author
|
@josepjaume solved! |
josepjaume
approved these changes
Nov 30, 2017
Contributor
|
Let's get this in! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎩 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_trailwhodunniteverywhere📷 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:
