gcal-invoice/MountainView Invoice coding update

So I shared gcal-invoice/MountainView Invoice with a few people and they looked at the code and thought it was pretty good (I think, ha. ha.) and I realized that I’ve neglected the project for too long because it wasn’t even possible to hit a running copy of the web app. So yesterday I spent the day getting JSCS, JShint added, the unit tests passing and documenting the setup/install process for the project.

What’s been done

This is what’s been done for the project:

  • fixing unit tests, adding some mocks/spies/stubs using Sinon for googleCalendar module, testing selectCalendarAndFilterEvents (which is one of the main parts of the app)
  • getting the unit tests to run with PhantomJS rather than Firefox
  • measuring code coverage with karma-coverage
  • integration with Codacy to check for code issues and automated code review
  • integration with Codacy for code coverage using node-codacy-coverage
  • fixing style of JavaScript code and unit tests to match Google’s JavaScript style guide (using JSCS for the style checking)
  • cleaned up a few small issues that JSHint caught
  • making the app webserver work with Cloud9 (using environment variables for binding the hostname/port rather than hard-coding the values)
  • getting the Gruntfile updated to run jshint, jscs, codacy
  • locking down some dependency version numbers
  • TravisCI integration

What is it?

MountainView Invoice is an AngularJS web app that lets you login to Google Calendar and select a bunch of events, enter an hourly rate, enter any other fees/discounts and gives you a nice daily table with the total, perfect for an invoice. I needed it while I was consulting because there were some days where I worked in 1.5-3 hour blocks, I had a few half hour blocks too and it was such a pain to go through them. I didn’t feel the need for a time-tracker like Harvest because that’s too task and minute specific and I wanted the clients to look at how much value was delivered in the day rather than having them focus on minute-by-minute tasks. High-level view vs low-level details.

So anyway, it’s hard to up 1.5 + 3 + 0.5 + 0.5 + 0.75 + 1.5 + … for every day in a week for months was getting to be a pain big enough that it could use some automation. With MountainView Invoice I would just select all the events in bi-weekly chunks, copy/paste the table of hours per day worked into an invoice and then send it off to the client. Much faster and after double-checking the calculations manually and checking them with unit tests I was confident that I could just breeze through invoice creation.

Very important note: the code is licensed under the GNU GPL (General Public License) version 3 or later. I was considering making it AGPL and may do so if I continue to work on it.

What’s Next?

Here are some ideas as to what’s next for the project:

  • hosting it on a web server somewhere (not sure if github pages is good enough)
  • adding more unit tests to make sure it works for more elaborate use cases (such as 5 events in one day or an event split over 2 days)
  • fixing the styling so it looks good on mobile, tablet, and all other desktop browsers
  • setting up a configuration JSON file where the google API token can be stored
  • sprucing up the style of the invoice table
  • allowing other fees/discounts to be added to the invoice
  • adding a database such as MongoDB or Firebase to be able to save invoices and to be able to filter out events that have already been added to an invoice (this would have saved me a lot more time)

I think these are all things that can be done in small chunks and worked on a little bit at a time as a side project. I’m not looking to use CoffeeScript or ES6 or any crazy CSS tricks on this. The goal is to have a testable product that just happens to be free as in beer and free as in speech and hopefully someone who’s freelancing out there finds it useful.

Author: Rudolf Olah

Rudolf Olah is a software development expert with over 6 years of professional software developer experience. He has produced the video course Learning AngularJS Testing for PacktPublishing and works on the strategic as well as the tactical parts of software and web devleopment.

Leave a Reply and Share Your Thoughts