Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
opening-hours
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
regionalkauf
opening-hours
Commits
56cb660e
Commit
56cb660e
authored
Nov 12, 2015
by
Johannes Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
option for custom fields
parent
145bfc18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
7 deletions
+27
-7
dateArray.js
lib/dateArray.js
+24
-1
regionInfoRequest.js
lib/regionInfoRequest.js
+3
-6
No files found.
lib/dateArray.js
View file @
56cb660e
"use strict"
;
var
tmUtils
=
require
(
'./timeUtils'
);
var
holidaysGetter
=
{};
var
Holidays
=
require
(
'./holidays'
);
...
...
@@ -27,10 +29,21 @@ function wrapper(_epochSpan) {
}
function
parseJSON
(
data
)
{
var
rawCustom
=
data
[
"custom"
];
var
custom
=
{};
for
(
var
key
in
rawCustom
)
{
var
field
=
rawCustom
[
key
];
custom
[
field
]
=
{
include
:
field
.
include
||
[],
exclude
:
field
.
exclude
||
[]
}
}
return
{
incl
:
data
[
"include"
],
excl
:
data
[
"exclude"
],
maybe
:
data
[
"maybe"
]
maybe
:
data
[
"maybe"
],
custom
:
custom
}
}
...
...
@@ -56,6 +69,16 @@ function wrapper(_epochSpan) {
ret
.
maybeIntervals
=
tmUtils
.
andNotOp
(
maybeIntervals
,
ret
.
intervals
);
}
ret
.
debugInfo
=
debugInfo
;
if
(
json
.
custom
)
{
var
custIntervals
=
ret
.
customIntervals
=
{};
let
custObj
=
json
.
custom
;
for
(
let
key
in
custObj
)
{
let
field
=
custObj
[
key
];
custIntervals
[
key
]
=
buildOpeningHours
([
field
.
include
,
field
.
exclude
],
[]);
}
}
cb
(
null
,
ret
);
}
...
...
lib/regionInfoRequest.js
View file @
56cb660e
...
...
@@ -20,16 +20,13 @@ var blndMapping = {
module
.
exports
=
{
getBundesland
:
function
(
info
,
cb
)
{
if
(
!
info
.
state
)
{
console
.
log
(
info
);
return
cb
(
new
Error
(
"no state given"
));
}
var
state
=
info
.
state
||
"Bayern"
;
var
mappedState
=
blndMapping
[
info
.
state
];
var
mappedState
=
blndMapping
[
state
];
if
(
mappedState
)
return
cb
(
null
,
mappedState
);
else
{
if
(
info
.
state
=
"Tschechien"
)
return
cb
(
null
,
"BY"
);
return
cb
(
new
Error
(
"no state mapping found for "
+
info
.
state
))
return
cb
(
new
Error
(
"no state mapping found for "
+
state
))
}
},
getKatholisch
:
function
(
info
,
cb
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment