CyberCraftInc / vacation_system

Cyber Craft Vacation System
0 stars 0 forks source link

Change DB schema #13

Closed eleidan closed 9 years ago

eleidan commented 9 years ago

The reason for the change is bad naming in vacation_requests table. There is the end column, and it is impossible to initialize it with FactoryGirl. In FactoryGirl a propery name is actually a method. As a result, creation of the end method is not feasible.

Update VacationRequest model Add the following fields:

Rename the following fields:

Remove the following fields:

Update implementation and tests to meet the changes

Update tests for BB VacationRequest model

Update BB VacationRequest model Add validation rules for Backbone.Validation plugin. Update the of list default values of attributes. Use helper in duration calculation.

Rework BB VacationRequest model Update defaults according to DB schema changes. The model initializes defaults so that it describes all the expected attributes. Any attribute that is not in the defaults is forbidden. The model provides modified setter to prevent setting forbidden attributes. It is possible to use dynamic attributes. The model provides modified getter that evaluates model method if it appears to be a key as parameter for the .get() method. The model presents the 'end_date' dynamic attribute that gets end date of the vacatio request depending on the 'status' attribute value. The .calculateDuration() method is updated according to changes in helpers implementation.

Update BB Holidays collection Update .arrayOfDates() method according to changes in helpers implementation.

Update RoR VacationRequestsController#index The VacationRequestsController#index action method select only those attributes that are expected by Backbone application.

Rework App.Helpers.arrayOfDates Change implementation of the helper so that it can be used as a standalone function with parameters, without binding to any object's context.

Update BB VacationRequest view Update according to changes in VacationRequest model implementation. The changes are checked with new tests for the view. Extract collections fetching into router.

Update BB VacationRequestForm view Update according to DB schema changes. Add tests.

Update BB AvailableVacations collection Add .availableDaysOfType() method that provides number of available days for given vacation type.

Update BB Dashboard view Update according to DB schema changes.

Update BB TimeTableByDay view Update accroding to changes in VacationRequest model implementation.

Update BB TimeTableByWeek view Update accroding to changes in VacationRequest model implementation.

Update progress summary

Update according to comments @alazarchuk , @rubycop