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
8ead1f9e
Commit
8ead1f9e
authored
Jul 28, 2014
by
Johannes Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed error propagaytion
parent
0ae32c35
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
5 deletions
+70
-5
config.json
config.json
+3
-4
blndRelDbRequest.js
lib/blndRelDbRequest.js
+66
-0
holidays.js
lib/holidays.js
+1
-1
No files found.
config.json
View file @
8ead1f9e
...
...
@@ -3,9 +3,8 @@
"restApiPort"
:
3001
,
"mysqlConfig"
:
{
"host"
:
"127.0.0.1"
,
"port"
:
3306
,
"database"
:
"gemeindeschluessel"
,
"username"
:
"root"
,
"password"
:
"bla"
"user"
:
"root"
,
"password"
:
"ntgf42raUpaD"
,
"database"
:
"holidays"
}
}
\ No newline at end of file
lib/blndRelDbRequest.js
View file @
8ead1f9e
var
mysql
=
require
(
'mysql'
);
var
config
=
require
(
'../config.json'
);
var
blndMapping
=
{
"Baden-Württemberg"
:
"BW"
,
"Niedersachsen"
:
"NI"
,
"Bayern"
:
"BY"
,
"Nordrhein-Westfalen"
:
"NW"
,
"Berlin"
:
"BE"
,
"Rheinland-Pfalz"
:
"RP"
,
"Brandenburg"
:
"BB"
,
"Saarland"
:
"SL"
,
"Bremen"
:
"HB"
,
"Sachsen"
:
"SN"
,
"Hamburg"
:
"HH"
,
"Sachsen-Anhalt"
:
"ST"
,
"Hessen"
:
"HE"
,
"Schleswig-Holstein"
:
"SH"
,
"Mecklenburg-Vorpommern"
:
"MV"
,
"Thüringen"
:
"TH"
};
console
.
log
(
config
[
"mysqlConfig"
]);
var
connection
=
mysql
.
createConnection
(
config
[
"mysqlConfig"
]);
module
.
exports
.
getBundesland
=
function
(
plz
,
cb
)
{
connection
.
query
(
"SELECT bundesland FROM postleitzahlen WHERE plz = "
+
plz
,
function
(
err
,
result
)
{
if
(
err
)
return
cb
(
err
);
var
blnd
;
try
{
blnd
=
result
[
0
][
'bundesland'
];
blnd
=
blndMapping
[
blnd
];
}
catch
(
err
)
{
return
cb
(
err
);
}
if
(
blnd
===
undefined
)
return
cb
(
new
Error
(
"no bundesland found for plz "
+
plz
));
cb
(
null
,
blnd
);
});
};
module
.
exports
.
getKatholisch
=
function
(
plz
,
cb
)
{
connection
.
query
(
"SELECT feiertag FROM relHoliday WHERE plz = "
+
plz
,
function
(
err
,
result
)
{
if
(
err
)
return
cb
(
err
);
var
feiertag
;
try
{
feiertag
=
result
[
0
][
"feiertag"
];
}
catch
(
error
)
{
return
cb
(
err
);
}
if
(
feiertag
===
undefined
)
return
cb
(
new
Error
(
"no entry found in religion table for plz "
+
plz
));
cb
(
null
,
!!
feiertag
);
});
};
/*getBundesland(4600, function (err, result) {
console.log(err);
console.log(result);
});*/
/*getKatholisch(93047, function (err, result) {
console.log(err);
console.log(result);
});*/
lib/holidays.js
View file @
8ead1f9e
var
holidayMapping
=
require
(
'./holidayMapping.json'
);
var
easterSunday
=
require
(
'./easterSunday'
);
var
restRequest
=
require
(
'./blndRelRequest'
);
var
restRequest
=
require
(
'./blndRel
Db
Request'
);
var
SimplQueue
=
require
(
'./simplQueue'
);
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