From 59c35cb1d787d9c3a2eb76da0a22fcbeaa5fa003 Mon Sep 17 00:00:00 2001 From: jpl Date: Wed, 19 Apr 2017 12:35:54 +0200 Subject: Refs #2982: add daytypes check for updateSynthesis method on tt#edit --- app/assets/javascripts/es6_browserified/time_tables/actions/index.js | 4 +++- .../javascripts/es6_browserified/time_tables/reducers/timetable.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'app/assets/javascripts') diff --git a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js index c6e822067..1a6b7d197 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js +++ b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js @@ -69,7 +69,7 @@ const actions = { return monthList[date.getMonth()] }, - updateSynthesis: (state) => { + updateSynthesis: (state, daytypes) => { let periods = state.time_table_periods let isInPeriod = function(d){ @@ -87,6 +87,8 @@ const actions = { if(currentDate >= begin && currentDate <= end) { if(d.excluded_date) { testDate = false + } else if(daytypes[d.wday] === false) { + testDate = false } else { testDate = true } diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js b/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js index b2e5ad0be..1c492859f 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js +++ b/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js @@ -10,12 +10,12 @@ const timetable = (state = {}, action) => { periode_range: action.json.periode_range, time_table_periods: action.json.time_table_periods }) - return _.assign({}, fetchedState, {current_month: actions.updateSynthesis(fetchedState)}) + return _.assign({}, fetchedState, {current_month: actions.updateSynthesis(fetchedState, actions.strToArrayDayTypes(action.json.day_types))}) case 'RECEIVE_MONTH': let newState = _.assign({}, state, { current_month: action.json.days }) - return _.assign({}, newState, {current_month: actions.updateSynthesis(newState)}) + return _.assign({}, newState, {current_month: actions.updateSynthesis(newState, actions.strToArrayDayTypes(action.json.day_types))}) case 'GO_TO_PREVIOUS_PAGE': case 'GO_TO_NEXT_PAGE': let nextPage = action.nextPage ? 1 : -1 -- cgit v1.2.3