stadelmanma / interactive-ledger-rails Goto Github PK
View Code? Open in Web Editor NEWA rails powered ledger to store transactions from one or more accounts.
License: GNU General Public License v3.0
A rails powered ledger to store transactions from one or more accounts.
License: GNU General Public License v3.0
Current the code just loads and parses a tab delimited format and displays it without actually inserting it into the database. I want to keep this functionality so I can display an already existing ledger without necessarily adding it to the database.
It may be simplest to re-factor my current code into a function and view to do this and then work on adding the database functionality.
This will provide me added flexibility to work with the items in other helpers such as the summary view. Mainly, I could store the subcategory items on the object and use them to show additional details in the ledger totals and summary views.
https://www.chartkick.com/ seems like it will do the trick.
Graphs I think would be nice:
This would be a click event on the li element showing the category total. Ideally I'd add a plus sign to indicate there is more info available.
This method would take the place of the display_hash (and similar) methods in use, concentrating that logic into a single place to ensure consistency. The display logic would be dependent on the return type of the method passed in as an argument.
The syntax would be record.display(:amount)
and the code
Pseudo-code for the method would be
def display(method)
value = self.public_send(method)
case value.class
when Float
number_with_precision(value, delimiter: ',', precision: 2)
when Boolean
# something
end
end
I could also add a line to check if an attribute has a 'display' method i.e. display_validated
and call that instead of using the case block.
This would get started from an 'initial value' setting and then updated based on the value of each row in the table. I'll need to add the initial value column to the budgets table as well as a column to the view table for the total value
I'll need to figure out how to set it up but currently, rails s -b (ip address) -p 3000 -e production
seems to work.
Currently it would be very awkward to add more parsers for an end user because not only do you have to edit the helpers file but you also have to edit the ledger#edit view. Ideally I could add a 'parsers' directory to my application and add them all there. New parsers would need to be a subclass of the DefaultFormat. For the ledger#edit view I could just pull all of the subclasses and the base class itself instead of hard coding them.
A rename of Format to Parser might also be good.
I think the main application for this is where I used map to apply a regular expression match to transactions. MySQL is case insensitive so in a few cases I might not need a regex anyways.
This snippet below will populate all of the child models from a parent. I think I can use this code for when I want to modify transactions in a given upload
<p>
<%= f.fields_for(:ledger_uploads) do |upload| %>
<%= upload.label :data_source %>
<br>
<%= upload.text_field :data_source %>
<% end %>
</p>
This snippet could allow deletions
<%= person_form.fields_for :projects do |project_fields| %>
Delete: <%= project_fields.check_box :_destroy %>
<% end %>
This would be handy for various reasons and should be pretty easy to do.
It will be a three step process. The first will check for transactions with the same date and amount and then a check for similar descriptions. I want to use date's and amounts first because they are columns that could be indexed to speed up searches. Perhaps I can find some kind of gem to do the 'fuzzy' matching for me.
Then add a link to compare the similar transactions if any are found. I'll need to create some form of a 'show' view to compare the transactions, a table will still work best.
This should have been done a long time ago but I didn't know how when starting this project.
I want to be able to initialize this table with re-currant values but then edit those values and dates as required.
It should be pretty easy to switch to cells this early in the development process since I don't have that many views. I'll probably manage almost everything from cells except form related views.
This column will be used to prevent "re-uploading" duplicate data. I'll have the code throw an exception when attempting to run upload_data
on a record that has already been uploaded.
The proper way to do an upload is to first delete the ledger_upload and then re-create it. That way no transactions are left behind.
Since I only really import data from Discover, Chessie an possibly Wesbanco I can write upload methods to handle the bulk of data preprocessing and then shift to a new view to edit the transactions uploaded directly. I also want an upload method that does no preprocessing but thats as easy as an else
clause.
This will be done as needed to keep my controllers skinny and non-persistence related logic out of my models. For example all of the logic used to upload data should be a service because it represents a user interaction between a view and model.
Additionally, I'd like to move away from the helper and concern pattern into something clearer and more encapsulated.
Currently, if an expected categorical amount is budgeted for (i.e. Gas) over the week and there are no expenses with that category during the week the "anticipated amount" still gets used instead of an "actual amount" of 0.0 dollars. This messes with the running totals calculated. Perhaps a reasonable fix would be to maintain a unique list of all keys in present and set any missing ones to zero.
This would be triggered as an onclick event to show the sub cats
This is purely a convenience feature to save data in the form without reloading the page. This can be easily accomplished by adding an extra param to the POST request used to update the upload.
This will become less of an issue if I can implement incremental uploads and just query the database for the rest.
I think it would be far easier from the user's perspective if you edited the budget view in a form similar to viewing it. This makes it similar to editing it in an excel spreadsheet since that is the type of behavior I am going for.
This is the start, and then eventually I'll begin adding rdoc comments throughout the project.
This would allow a person to see all Walmart expenses by filtering by category or all amounts above/below a certain value.
I think I have this working in the pure JS version so it should be easy to convert into a helper. I'll probably want to pass in the Transaction object and a "test date" to determine when to increment the row span and when to output a row.
Now that I have more than one thing to look at I should have a home page to show me all my available ledgers and budgets.
I think this will greatly simplify some of the current navigation issues I'm having.
mainly discover payments, since if I include those in the running totals everything passed through my Discover card gets doubled.
In some cases I need to link a transaction to an expense because the week I marked something as 'due' might not correspond to the proper transaction or any transaction, i.e. things that are due on a monthly basis or if the check is taken out late.
See this SO answer. Might be a clean way around my ugly hack to bypass the already existing ledgers in the rails form.
This can provide me with an absolute path instead of awkwardly concatenating like I do now.
The table would store a regular expression and then set the category and sub-category based on it the pattern matches.
This can be a simple param in the GET request i.e. /ledgers/1/edit?upload=true
This would allow me to see the big picture of what my expenses look like as well as catch any typos in categories and sub-categories. Ideally for an aggregate category like 'Misc.' I could also see the sub categories within. Preferably from a click event so they are initially hidden.
I should also be able to define an 'account' for the entire upload if desired.
Conversely I could implement an 'uploader' for different formats such as a Discover and Chessie CSV export.
The data would then be sorted relative to all of the other data. In the edit tab I could make a method to examine possible duplicates, i.e. if three or more fields are exactly the same then flag it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.