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
411f6f9c
Commit
411f6f9c
authored
Nov 12, 2015
by
Johannes Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
option for custom fields finished
parent
56cb660e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
5 deletions
+26
-5
index.js
index.js
+24
-4
dateArray.js
lib/dateArray.js
+2
-1
No files found.
index.js
View file @
411f6f9c
"use strict"
;
var
dateArray
=
require
(
'./lib/dateArray'
);
var
dateArray
=
require
(
'./lib/dateArray'
);
var
dateView
=
require
(
'./lib/dateView'
);
var
dateView
=
require
(
'./lib/dateView'
);
var
splitMidnight
=
require
(
'./lib/timeUtils'
).
splitMidnight
;
var
splitMidnight
=
require
(
'./lib/timeUtils'
).
splitMidnight
;
function
mapEvents
(
dataObj
)
{
function
mapEvents
(
intervals
)
{
if
(
dataObj
.
intervals
)
{
if
(
intervals
)
{
return
splitMidnight
(
dataObj
.
intervals
).
map
(
function
(
evt
)
{
return
splitMidnight
(
intervals
).
map
(
function
(
evt
)
{
return
{
return
{
startDate
:
evt
[
0
],
startDate
:
evt
[
0
],
endDate
:
evt
[
1
]
endDate
:
evt
[
1
]
...
@@ -38,10 +40,26 @@ function getOHIndex(info, today, cb) {
...
@@ -38,10 +40,26 @@ function getOHIndex(info, today, cb) {
sure
:
transform
(
resultSure
),
sure
:
transform
(
resultSure
),
maybe
:
transform
(
resultMaybe
)
maybe
:
transform
(
resultMaybe
)
};
};
if
(
result
.
customIntervals
&&
result
.
customIntervals
.
emergency
)
{
fResult
.
emergency
=
transform
(
result
.
customIntervals
.
emergency
);
}
cb
(
null
,
fResult
);
cb
(
null
,
fResult
);
})
})
}
}
function
mapCustomIntervals
(
customIvals
)
{
var
res
=
{};
if
(
customIvals
)
{
for
(
let
key
in
customIvals
)
{
res
[
key
]
=
mapEvents
(
customIvals
[
key
]);
}
}
return
res
;
}
function
getFull
(
info
,
now
,
cb
)
{
function
getFull
(
info
,
now
,
cb
)
{
var
epocheSpan
=
dateView
.
getPropperEpochSpan
(
now
);
var
epocheSpan
=
dateView
.
getPropperEpochSpan
(
now
);
dateArray
(
epocheSpan
).
getData
(
info
,
function
(
err
,
dataObj
)
{
dateArray
(
epocheSpan
).
getData
(
info
,
function
(
err
,
dataObj
)
{
...
@@ -53,8 +71,10 @@ function getFull(info, now, cb) {
...
@@ -53,8 +71,10 @@ function getFull(info, now, cb) {
text
:
short
.
text
,
text
:
short
.
text
,
status
:
short
.
status
,
status
:
short
.
status
,
weekView
:
dateView
.
weekViewData
(
dataObj
,
now
),
weekView
:
dateView
.
weekViewData
(
dataObj
,
now
),
events
:
mapEvents
(
dataObj
)
events
:
mapEvents
(
dataObj
.
intervals
),
customEvents
:
mapCustomIntervals
(
dataObj
.
customIntervals
)
};
};
cb
(
null
,
res
);
cb
(
null
,
res
);
})
})
}
}
...
...
lib/dateArray.js
View file @
411f6f9c
...
@@ -30,10 +30,11 @@ function wrapper(_epochSpan) {
...
@@ -30,10 +30,11 @@ function wrapper(_epochSpan) {
function
parseJSON
(
data
)
{
function
parseJSON
(
data
)
{
var
rawCustom
=
data
[
"custom"
];
var
rawCustom
=
data
[
"custom"
];
var
custom
=
{};
var
custom
=
{};
for
(
var
key
in
rawCustom
)
{
for
(
var
key
in
rawCustom
)
{
var
field
=
rawCustom
[
key
];
var
field
=
rawCustom
[
key
];
custom
[
field
]
=
{
custom
[
key
]
=
{
include
:
field
.
include
||
[],
include
:
field
.
include
||
[],
exclude
:
field
.
exclude
||
[]
exclude
:
field
.
exclude
||
[]
}
}
...
...
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