Invoice model recommendation - ruby-on-rails

I just started to develop an invoice app. I would like to hear your opinions and recommendations about this dilemma.
The invoice has a client section. The client can be selected from a drop-down select menu or it can be entered directly into a text field. Let's say it's just a one time purchase and the client won't ever come back. Should I have these two columns: client_id and client_field so either of those two can be filled out? The negative side is that a lot of client_field will be empty. Or should I not use a client_field and just add a new client even thought that client will only be used once?

Be consistent and use a separate client model and client_id even for clients that only appear once. If you have both client_id and client_model you will have extra complexity:
Your validation will have to check both and ensure that everything is consistent.
You will have to o.client.try(:name) || o.client_field and such all over the place just to display data.
If you change the structure of your client records in the future you will have to reformat your "table within a table" client_field kludge.
Any database based reporting will go from simple SQL to a monstrosity of LEFT JOINs and CASE statements.
And those are just a couple things off the top of my head.
If you're worried about having a dropdown with a lot of entries — and you should be worried about any dropdown with more than ~20 entries — then go with just an autocompleting text input or limit the dropdown to the top ~20 clients and use a autocompleting text input for the rest (or perhaps even a JavaScript based combo-box); there's a good chance that the dropdown won't even get used by your users, accountants and other people that do a lot of data entry and invoicing often hate having to reach for the mouse.

Is there anything wrong with having an auto-complete field where, if submitted without a matching ID, you will just create the client and link them in?
That's what's expected from the stand-point of the user and it's how applications like QuickBooks have worked for years.

Related

Use Google Forms for Sociometry

I wonder if it is possible to use Google Forms to gather Sociometry responses.
See this picture as an example:
Clarification:
I want to create many rows per a single responder (see in my picture, there are 5 rows for responder 1, which represent each of the 5 Peers the responder needs to rank) . The second issue, is that the population always changes (responder 1 needs to rank 5 people, while responder 2 needs only 4)
Just create a form and link it to your sheet.
I think you have already done this, but just in case:
create a new form.
link the responses to a spreadsheet.
How to identify the responder
Unless you are in a workspace account and all the responders are also in a workspace account there is no way to identify the responder. The only way that you can do this is to ask the responder in the form for their "Responder ID". The only field that will be populated automatically will be the timestamp.
How to get multiple rows per response
The simple way is to simply get the participants to fill out the response multiple times. The more complex way is to look into Apps Script to construct forms based on a certain criteria, though this sounds like it will probably be complex to do in this way. Maybe you would be interested in building an Apps Script web app with which you could build an html form. That will probably give you more flexibility, though it will be a bit more work to set up.
How to organize your sheet so that all Responder IDs are sorted.
You can do this manually by filtering or sorting the data. Alternatively you can look into Apps Script to do this process automatically every few minutes or hours, depending on what you need it for.

Local storage on Rails

I've built a Rails app, basically a CRUD app for memos/notes.
A notes title must be unique. If a user enters a name already taken a warning message is shown prompting them to chose another.
My question is how to make this latency for this feedback as close to zero as possible. When creating a note little UX speed bumps like this will get annoying for user quickly.
Of course the main bottleneck is the network. Inspired by Meteor (and mini-mongo) I was thinking some kind of local storage could be a solution?
I.E. When app first loads, send ALL JSON to the client with ALL note titles. The app (front end is Angular JS) could check LocalStorage (or App Cache, Web SQL?) instead of incurring a network round trip. The feedback would be instant.
I've used LocalStorage in the past to augment an app, but in the scenario it'd really seriously depend on it. I'm not sure how confident I'd be building on something that user might not have. Also as the number of user Notes/Memos I have doubts how feasible it is to send a JSON object down the wire with ALL the note titles. That might get pretty big. On the other hand MeteorJS seems to do this with no probs.
Has anyone done something similar or have any pointers? Thanks!
I don't know how Meteor works here, but you're right that storing all note titles in localStorage is not a good idea. Actually, you don't need localStorage here, you can just put it in a JS array, because you need this data only once (when checking new note title).
I think, there could be 2 possible solutions:
You can change your business requirements and allow non-unique title. Is there really a necessity for titles to be unique?
You can verify note title when user submits form. In this case you can provide suggestions for users, so they not spend time guessing vacant title.
Or, if titles must be unique only within a user (two users can have same title for their notes), you can really load all note titles in JS array and check uniqueness while users types in a title.
Or you can send an AJAX request checking title uniqueness as soon as user finished typing the title. In this case you can win some seconds.
Or you can send an AJAX request as soon as user typed in 3 symbols. The request will return all titles that begin with these 3 symbols, so you don't need to load all the titles.

Is it possible to write a TFS Shared Query with a parameter on a custom field?

I have a set of queries on the Team home page that use the standard #Me, for example to let different users quickly get to bugs they have personally raised, PBIs they created that are now in a certain state.
The users are in customer groups and I'd like to have a similar set of queries showing as tiles on the home page, e.g. "Team Open Bugs", "Team PBIs for review".
Is it possible to write a query that does this -
Select all [work item type] from [team project] where [state] and [#myCustomerTeam] ?
From what I have read so far I believe this is not possible, and certainly not possible through the UI. I'm curious to find out if anyone has solved a problem like this - having different customer groups see different Team Favorites tiles on the Home page of Team Web Access - in some other way. I'm going to try making three sets of queries and putting different permissions on them (there are TFS groups that correspond to the Customer Group field) but I'm not confident that Denying even Read permission on the query itself will stop the tile showing on everyone's homepage.
Edited to say that solution worked for my purposes, as per comment.
Still interested to know if anyone has managed something like this more cleanly. In this case the field I would have liked to parameterise happened to be something I could map to a completely different type of thing, thus shifting the problem. I can imagine wanting to parameterise a field that didn't have that characteristic though.

How to design a simple keyword content delivery mechanism that functions like Adwords

I'm have application that allows users to store food diary entries of approximately 140 characters in length. I am looking for a solution that will allow me to tie content modules (think tips for healthy eating) to the user's diary entries based on keywords in the entry similar to what Google does with adwords. Are there any out-of-the-box solutions that can do that in Rails?
Here are the specific requirements:
User logs food diary entry
In the user's food diary, if there's a specific tip that matches a keyword for the entry, then the tip is displayed next to the entry
Tips would be defined through an admin tool where the admin specifies the tip content and keywords that would make it appear in the diary
Trying to figure out a) if there's a pre-build solution I could use for something like this or b) what the best approach would be for performance since the users's food diary might have 20 entries per page, and each entry would have to be evaluated to see if there are any corresponding tips that match entry keywords.
For designing a home-grown solution, one idea I had was to make the tip associations when a new food entry is stored like this:
user adds a food entry
after_save a callback method breaks apart the entry into keywords and searches the tips model for matches
if there's a match, it's stored in an association table when new entries are created rather then when the user's food diary is rendered in the web page.
There's a performance hit on storing new entries, but it might allow the user's diary to load faster then doing all those look-ups when the diary is rendered.
Does that make sense, or is there a better way? better yet, are there tools that can accomplish what I'm trying to do?
Thanks!
This is not an AdWords API question, but I'll take a shot:
I would move the association table building into an offline task / cronjob. That would take care of the performance overhead when creating new entries, and users would be generally okay with a message like "Tips are being generated, please be patient" if they happen to view the topic too soon.
I'm not aware of any existing solutions, but this sounds like a hashtag system to me. Basically you have two lists (food dairy entries, tips), you want to assign hashtags to both lists and then pair entries with same hashtags. Googling for a hashtag system / library might be a good starting point.
Cheers,
Anash

Populating dropdownlists for mult-tenant applications

I am building an mvc 3 application that will be multi-tenant, which means it will use the same basic data structure, but provide different data depending on the domain name used to access it.
A problem I am trying to solve is this. How best do I populate a number of dropdown lists with selection choices based on the site being rendered. To add another wrinkle, I will need to localize the strings as well.
An obvious choice is to simply create a table with columns for website id and language id, plus field id and string value. This seems ok, but also seems to ignore possible mechanisms that are already in place for localization. I feel like i'm recreating the wheel here.
As an example, site 1 might have a dropdownlist for Favorite Activities, and have ranges items that are geared toward musical interests. Site 2 might have the same dropdown, but have items geared for sports intersts.
So my question is, how would you go about solving this problem? Also, in a similar vein... If you have selection lists, say State codes, cities, etc.. would you tend to create seperate tables to populate this data (states table, cities table, etc..) or would you put all this information in a common table and have an ID to indicate which dropdown it was to be used for? The former seems more normalized, but the latter seems more efficient (less code to write).
Thoughts about Common Lookup Tables. This guy is definitely against.
http://www.projectdmx.com/dbdesign/lookup.aspx
I have used it and believe that I have saved some time, or at least some keystrokes. Might be sorry later on.

Resources