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
3c7ade5d
Commit
3c7ade5d
authored
Jul 28, 2014
by
Johannes Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed error propagaytion
parent
b79718bf
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
10 deletions
+26
-10
config.json
config.json
+11
-0
blndRelDbRequest.js
lib/blndRelDbRequest.js
+2
-0
blndRelRequest.js
lib/blndRelRequest.js
+9
-7
dateArray.js
lib/dateArray.js
+3
-2
holidays.js
lib/holidays.js
+1
-1
No files found.
config.json
0 → 100644
View file @
3c7ade5d
{
"restApiHost"
:
"127.0.0.1"
,
"restApiPort"
:
3001
,
"mysqlConfig"
:
{
"host"
:
"127.0.0.1"
,
"port"
:
3306
,
"database"
:
"gemeindeschluessel"
,
"username"
:
"root"
,
"password"
:
"bla"
}
}
\ No newline at end of file
lib/blndRelDbRequest.js
0 → 100644
View file @
3c7ade5d
var
mysql
=
require
(
'mysql'
);
lib/
restRequests
.js
→
lib/
blndRelRequest
.js
View file @
3c7ade5d
var
http
=
require
(
'http'
);
var
http
=
require
(
'http'
);
var
config
=
require
(
'../config.json'
);
var
hostname
=
"127.0.0.1"
;
var
hostname
=
config
[
"restApiHost"
];
var
port
=
3001
;
var
port
=
config
[
"restApiPort"
];
var
headers
=
{
"Content-Type"
:
"application/json"
,
"Connection"
:
"keep-alive"
};
var
blndMapping
=
{
var
blndMapping
=
{
"Baden-Württemberg"
:
"BW"
,
"Baden-Württemberg"
:
"BW"
,
...
@@ -26,6 +23,10 @@ var blndMapping = {
...
@@ -26,6 +23,10 @@ var blndMapping = {
"Thüringen"
:
"TH"
"Thüringen"
:
"TH"
};
};
var
headers
=
{
"Content-Type"
:
"application/json"
,
"Connection"
:
"keep-alive"
};
function
request
(
path
,
cb
)
{
function
request
(
path
,
cb
)
{
var
options
=
{
var
options
=
{
hostname
:
hostname
,
hostname
:
hostname
,
...
@@ -47,6 +48,7 @@ function request(path, cb) {
...
@@ -47,6 +48,7 @@ function request(path, cb) {
var
req
=
http
.
request
(
options
,
callback
);
var
req
=
http
.
request
(
options
,
callback
);
req
.
on
(
"error"
,
function
(
err
)
{
req
.
on
(
"error"
,
function
(
err
)
{
err
=
new
Error
(
'Could not connect to: '
+
hostname
+
path
);
cb
(
err
);
cb
(
err
);
});
});
req
.
setTimeout
(
500
,
function
()
{
req
.
setTimeout
(
500
,
function
()
{
...
@@ -88,7 +90,7 @@ module.exports.getKatholisch = function(plz, cb) {
...
@@ -88,7 +90,7 @@ module.exports.getKatholisch = function(plz, cb) {
return
cb
(
err
);
return
cb
(
err
);
}
}
if
(
feiertag
===
undefined
)
if
(
feiertag
===
undefined
)
return
cb
(
new
Error
(
"no
religion entry found
for plz "
+
plz
));
return
cb
(
new
Error
(
"no
entry found in religion table
for plz "
+
plz
));
cb
(
null
,
!!
feiertag
);
cb
(
null
,
!!
feiertag
);
})
})
};
};
...
...
lib/dateArray.js
View file @
3c7ade5d
...
@@ -91,7 +91,8 @@ function wrapper(_epochSpan) {
...
@@ -91,7 +91,8 @@ function wrapper(_epochSpan) {
}
}
function
getDaySpan
(
data
)
{
function
getDaySpan
(
data
)
{
var
dayoption
=
parseInt
(
data
[
"dayoption"
][
"0"
]);
var
dayoptionS
=
data
[
"dayoption"
][
"0"
];
var
dayoption
=
parseInt
(
dayoptionS
);
if
(
dayoption
<
7
)
return
[
dayoption
,
dayoption
];
if
(
dayoption
<
7
)
return
[
dayoption
,
dayoption
];
switch
(
dayoption
)
{
switch
(
dayoption
)
{
case
7
:
case
7
:
...
@@ -103,7 +104,7 @@ function wrapper(_epochSpan) {
...
@@ -103,7 +104,7 @@ function wrapper(_epochSpan) {
case
10
:
case
10
:
return
[
1
,
6
];
return
[
1
,
6
];
default
:
default
:
throw
new
Error
(
"Invalid day option: "
+
dayoption
);
throw
new
Error
(
"Invalid day option: "
+
dayoption
S
);
}
}
}
}
...
...
lib/holidays.js
View file @
3c7ade5d
var
holidayMapping
=
require
(
'./holidayMapping.json'
);
var
holidayMapping
=
require
(
'./holidayMapping.json'
);
var
easterSunday
=
require
(
'./easterSunday'
);
var
easterSunday
=
require
(
'./easterSunday'
);
var
restRequest
=
require
(
'./
restRequests
'
);
var
restRequest
=
require
(
'./
blndRelRequest
'
);
var
SimplQueue
=
require
(
'./simplQueue'
);
var
SimplQueue
=
require
(
'./simplQueue'
);
var
easterSundays
=
{};
var
easterSundays
=
{};
...
...
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