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

Draft: Add Tags #714

Closed
wants to merge 1 commit into from
Closed

Draft: Add Tags #714

wants to merge 1 commit into from

Conversation

flacnut
Copy link

@flacnut flacnut commented May 4, 2024

I am not familiar with Ruby or Rails, constructive feedback welcomed!

This PR is a draft of possible ways to add tags.

Context (713)

I have in the past used the ORM / ActiveRecord completely, mapping a many-to-many with a join table, however this negatively impacted the performance of my application for the use case of generating many charts which include tag filters.

Tags_demo_data_2

Copy link
Collaborator

@zachgoll zachgoll left a comment

Choose a reason for hiding this comment

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

Appreciate the PR here, as I mentioned in the Discussion, I definitely think tags are a must-have for the system.

We don't have any internal designs for this quite yet, so I think in order to introduce this, it would have to be backend only for the moment.

If you wanted to go down that route, I'd probably favor a many to many relationship as ActiveRecord has a lot of neat helpers and handles this quite well.

I will get a design iteration going internally shortly so that we can get this added.

@@ -23,6 +23,14 @@ class Transaction < ApplicationRecord
.where("er.rate IS NOT NULL OR transactions.currency = ?", currency)
}

def tags
Copy link
Collaborator

Choose a reason for hiding this comment

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

In Rails, since you've set tag_ids as a column on the model, you wouldn't need this explicit getter and setter unless you wanted to perform some sort of modification prior to saving

@@ -82,7 +82,11 @@ def sync
private

def set_account
@account = Current.family.accounts.find(params[:id])
begin
@account = Current.family.accounts.find(params[:id])
Copy link
Collaborator

Choose a reason for hiding this comment

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

In Rails this error handling is typically not necessary as the @account would just be nil if not found.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, this was actually a fix for something else. If you navigate to an account_id that doesn't exist, rails spits out stack traces which is not very graceful.

@zachgoll zachgoll marked this pull request as draft May 8, 2024 12:33
@zachgoll
Copy link
Collaborator

@flacnut going to close this out for now and we can re-open it (or open a new one) when we get the designs for it. We've been doing some roadmap planning and will definitely be getting this in soon!

@zachgoll zachgoll closed this May 16, 2024
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.

None yet

2 participants