Giter VIP home page Giter VIP logo

metanoia's People

Contributors

crawfoal avatar

Watchers

 avatar  avatar

metanoia's Issues

Write a more helpful README

Give instructions on how to run through the demo, and only link to the production version (don't give staging link).

"Add new employee" is broken in production

You can only see this in production. When you try to add a new employee (or give an existing one a new role), it doesn't work, saying that the role isn't in the list.

I think what is happening is that the code is eager loaded in production, and EmploymentForm is loaded before the role story classes, so when this validation is defined:

validates :role_name, inclusion: { in: Employment.roles.map(&:to_s) }

Employment.roles hasn't be set up properly yet.

Create a layout for JS responses

It should render the flash and put it before main.

This would be a good time to move the flash partial to the shared folder (it is currently in the layouts folder).

Review admin role & policies

Admins should be allowed to get a gym set up, but after it is "published", they should no longer be able to edit the gym or it's employees. It should be required that before a gym is published there is at least one manager assigned.

Better color scheme for application

Choose a more vibrant color scheme. Also, I'd like to pick one main color for each role, and have the color switch when the role switches so that it is more obvious to the user what their current role is.

Refactor EmploymentForm#errors

Don't merge the employment errors directly into the form errors. Keep them separate, and instead create an instance variable to hold the merged errors. To perform the merging, use ActiveModel::Errors#copy! (which is available in Rails version 5.0.0.1) to copy the form errors, and then merge in the employment errors as I was doing.

Re-do the Guardfile

Review the README at guard-rspec. For example,

  • definitely want to have a special command for when all specs are running (to make sure that test coverage is turned on)
  • consider setting failed_mode to focus, and having all unit tests listed first
  • maybe set all_after_pass to true

Also, maybe define different groups (could separate out unit and integration tests).

Also, install guard-spring

Review specs and use factories more

Factories can be for non-active record objects too.

If a complex set up is needed in more than one place, consider if a (rather complicated) factory is appropriate.

Make charts responsive

The climb histograms aren't resizing when I resize the browser window. They are responsive in that the size adjusts to the size of the window at the time that the page is loading, so it's not a huge issue, but I'd still like to fix it. Maybe use a Bourbon Neat grid instead of flexbox.

Clean up EmployeeListPolicy#index?

Better to use User#employed_at?, but we'll need to adjust that method so it can be called without a specific role in order to see if a user is employed at a given gym with any role.

Refactor Employee#roles

Make a separate #roles_in_words method, and have #roles just returns the array of strings / symbols. We don't always need to turn it into a sentence, e.g.

# app/policies/employment_policy
def index?
  Employee.new(email: user.email, gym_id: employment.gym_id).roles.present?
end

Create a RoleStory class or module

  • hold information about the role story models and tables (basically all of the role story and role name related stuff that is currently in the Employment model)
  • have a method for_user that behaves like an ActiveRecord scope, returning all role stories for a particular user (something like SetterStory.where(user: user).or(ManagerStory.where(user: user) only with metaprogramming so that all types of role stories are handled; maybe define a for_user method for each role story model in the Employable concern

Might be tempting to call it RoleStories because it contains information about all of the role story models, however if we call it RoleStory, then calls to the method above will look kind of like regular ActiveRecord stuff.

Review all of the role story models and stuff

Things would probably be cleaner if some inheritance or mixin modules were used. Also, maybe make the association one polymorphic has many instead of multiple 1:1's (but still, each user should only have one of each type of story).

SeedMigration table is dropped when db:drop runs

Any task that depends on db:drop (e.g. db:reset and db:populate) will drop the seed_migrations table. When a new seed migration is run after this, it then thinks that no seed migrations have been run yet, so it runs them all and data is duplicated.

Two possible solutions:
(a) Add pre-requisite rake task to db:drop that will write the seed_migrations table to a YAML file. Have another task that will load the seed_migrations table back into memory and is a post-requisite for db:schema:load.
(b) Add a way to record the current version somewhere, and record it after each migration is run. We obviously wouldn't want to record the current version in the database, because we'd run into the same problem... so maybe in a file somewhere? Once we have this recorded somewhere, we could either use it to regenerate the seed_migrations table, or we could use the seed_migrations table in combination with the recorded current version when determining which migrations to run.

Fix new climb

It looks really ugly now... I think this started after I added min_width: 0 in order to allow the flex box to decrease in size

Add waiting icon when AJAX is loading

So far, this is just for when the new section fields are loading (which probably shouldn't be through AJAX...). It will also be on the gym show page when a new section is selected.

Review feature specs

Some could probably be cleaned up with page objects. Also, look at other people's feature specs for ideas.

Seed records for the roles table

Then we can add validation that ensures that when users are given a new role, that it is a role that exists. Then we don't need to validation like this:

# spec/factories/users.rb
# ...
valid_roles = roles.pluck(:name).keep_if do |role_name|
  Employment.roles.include? role_name.to_sym
end
# ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.