Merge branch 'main' of github.com:maybe-finance/maybe into zachgoll/ai-improvements
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
version: "3"
|
||||
x-db-env: &db_env
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
|
||||
x-rails-env: &rails_env
|
||||
DB_HOST: db
|
||||
HOST: "0.0.0.0"
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
BUNDLE_PATH: /bundle
|
||||
REDIS_URL: redis://redis:6379/1
|
||||
|
||||
services:
|
||||
app:
|
||||
@@ -16,32 +27,41 @@ services:
|
||||
command: sleep infinity
|
||||
|
||||
environment:
|
||||
DB_HOST: db
|
||||
HOST: "0.0.0.0"
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
BUNDLE_PATH: /bundle
|
||||
<<: *rails_env
|
||||
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
||||
worker:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
command: bundle exec sidekiq
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
<<: *rails_env
|
||||
depends_on:
|
||||
- redis
|
||||
|
||||
redis:
|
||||
image: redis:latest
|
||||
ports:
|
||||
- "6379:6379"
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
db:
|
||||
image: postgres:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
<<: *db_env
|
||||
ports:
|
||||
- "5432:5432"
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
redis-data:
|
||||
bundle_cache:
|
||||
|
||||
1
Gemfile
1
Gemfile
@@ -58,6 +58,7 @@ gem "intercom-rails"
|
||||
gem "plaid"
|
||||
gem "rotp", "~> 6.3"
|
||||
gem "rqrcode", "~> 2.2"
|
||||
gem "activerecord-import"
|
||||
|
||||
# AI
|
||||
gem "ruby-openai"
|
||||
|
||||
@@ -61,6 +61,8 @@ GEM
|
||||
activemodel (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
timeout (>= 0.4.0)
|
||||
activerecord-import (2.1.0)
|
||||
activerecord (>= 4.2)
|
||||
activestorage (7.2.2.1)
|
||||
actionpack (= 7.2.2.1)
|
||||
activejob (= 7.2.2.1)
|
||||
@@ -532,6 +534,7 @@ PLATFORMS
|
||||
x86_64-linux-musl
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord-import
|
||||
aws-sdk-s3 (~> 1.177.0)
|
||||
bcrypt (~> 3.1)
|
||||
benchmark-ips
|
||||
|
||||
@@ -18,7 +18,7 @@ module Account::EntriesHelper
|
||||
end
|
||||
end
|
||||
|
||||
deduped_entries.group_by(&:date).map do |date, grouped_entries|
|
||||
deduped_entries.group_by(&:date).sort.reverse_each.map do |date, grouped_entries|
|
||||
content = capture do
|
||||
yield grouped_entries
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class TransactionImport < Import
|
||||
transaction do
|
||||
mappings.each(&:create_mappable!)
|
||||
|
||||
rows.each do |row|
|
||||
transactions = rows.map do |row|
|
||||
mapped_account = if account
|
||||
account
|
||||
else
|
||||
@@ -13,17 +13,22 @@ class TransactionImport < Import
|
||||
category = mappings.categories.mappable_for(row.category)
|
||||
tags = row.tags_list.map { |tag| mappings.tags.mappable_for(tag) }.compact
|
||||
|
||||
entry = mapped_account.entries.build \
|
||||
date: row.date_iso,
|
||||
amount: row.signed_amount,
|
||||
name: row.name,
|
||||
currency: row.currency,
|
||||
notes: row.notes,
|
||||
entryable: Account::Transaction.new(category: category, tags: tags),
|
||||
import: self
|
||||
|
||||
entry.save!
|
||||
Account::Transaction.new(
|
||||
category: category,
|
||||
tags: tags,
|
||||
entry: Account::Entry.new(
|
||||
account: mapped_account,
|
||||
date: row.date_iso,
|
||||
amount: row.signed_amount,
|
||||
name: row.name,
|
||||
currency: row.currency,
|
||||
notes: row.notes,
|
||||
import: self
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
Account::Transaction.import!(transactions, recursive: true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="h-1.5 rounded-sm" style="width: <%= account_group.weight %>%; background-color: <%= account_group.color %>;"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="flex gap-4">
|
||||
<div class="flex flex-wrap gap-4">
|
||||
<% classification_group.account_groups.each do |account_group| %>
|
||||
<div class="flex items-center gap-2 text-sm">
|
||||
<div class="h-2.5 w-2.5 rounded-full" style="background-color: <%= account_group.color %>;"></div>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<div>
|
||||
<%= form.select currency_method,
|
||||
currencies_for_select.map(&:iso_code),
|
||||
{ inline: true, selected: currency_value },
|
||||
{ inline: true, selected: currency.iso_code },
|
||||
{
|
||||
class: "w-fit pr-5 disabled:text-subdued form-field__input",
|
||||
disabled: options[:disable_currency],
|
||||
|
||||
Reference in New Issue
Block a user