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
6a15bb8f
Commit
6a15bb8f
authored
Jul 09, 2014
by
Johannes Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
before cb refactor
parent
c1424fd6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
9 deletions
+71
-9
holidays.js
lib/holidays.js
+37
-9
restRequests.js
lib/restRequests.js
+34
-0
No files found.
lib/holidays.js
View file @
6a15bb8f
var
holidayMapping
=
require
(
'./holidayMapping.json'
);
var
holidayMapping
=
require
(
'./holidayMapping.json'
);
var
easterSunday
=
require
(
'./easterSunday'
);
var
easterSunday
=
require
(
'./easterSunday'
);
var
assert
=
require
(
'assert'
);
var
fixedHolidays
=
{
var
fixedHolidays
=
{
101
:
"0101"
,
101
:
"0101"
,
...
@@ -30,9 +31,8 @@ function Holidays(year) {
...
@@ -30,9 +31,8 @@ function Holidays(year) {
};
};
function
getEasterSunday
()
{
function
getEasterSunday
()
{
if
(
!
easterSundays
[
year
])
if
(
!
easterSundays
[
year
])
easterSundays
[
year
]
=
easterSunday
.
getEasterSunday
(
year
);
easterSundays
[
year
]
=
easterSunday
.
getEasterSunday
(
year
);
console
.
log
(
easterSundays
);
return
easterSundays
[
year
];
return
easterSundays
[
year
];
}
}
...
@@ -60,16 +60,44 @@ function Holidays(year) {
...
@@ -60,16 +60,44 @@ function Holidays(year) {
var
holidays
=
getFixedHolidays
(
fixedHolidays
);
var
holidays
=
getFixedHolidays
(
fixedHolidays
);
holidays
=
getVariableHolidaysMap
(
variableOffsets
,
holidays
);
holidays
=
getVariableHolidaysMap
(
variableOffsets
,
holidays
);
this
.
getHolidayIDs
=
function
(
region
,
kath
)
{
function
plzToBlnd
(
plz
)
{
if
(
region
===
'BY'
)
{
}
}
};
this
.
getAllHolidays
=
function
(
region
,
kath
)
{
function
isAugsburg
(
plz
)
{
}
function
getHolidayKeys
(
plz
,
kath
,
cb
)
{
//remove
var
keys
=
Object
.
keys
(
holidays
);
return
keys
;
//\remove
var
blnd
=
plzToBlnd
(
plz
);
var
isAugsburg
=
isAugsburg
(
plz
);
var
keys
=
holidayMapping
[
'sureHolidays'
];
assert
(
isAugsburg
&&
blnd
==
'BY'
);
var
blndMap
=
holidayMapping
[
'region'
][
blnd
];
if
(
blndMap
)
{
keys
.
concat
(
blndMap
[
'default'
]);
if
(
kath
&&
blndMap
[
'kath'
])
keys
.
concat
(
blndMap
[
'kath'
]);
if
(
isAugsburg
&&
blndMap
[
'augsburg'
])
keys
.
concat
(
blndMap
[
'augsburg'
]);
}
cb
(
null
,
keys
);
}
this
.
getAllHolidays
=
function
(
plz
,
kath
)
{
var
keys
=
getHolidayKeys
(
plz
,
kath
);
var
result
=
[];
var
result
=
[];
for
(
var
key
in
holidays
)
{
for
(
var
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
result
.
push
(
holidays
[
key
]);
var
key
=
keys
[
i
];
var
elem
=
holidays
[
key
];
if
(
elem
)
result
.
push
(
elem
);
}
}
return
result
;
return
result
;
};
};
...
...
lib/restRequests.js
0 → 100644
View file @
6a15bb8f
var
http
=
require
(
'http'
);
var
path
=
'/api/postleitzahlen/findone/?filter[where][plz]=93047'
;
var
headers
=
{};
headers
[
"Content-Type"
]
=
"application/json"
;
var
options
=
{
hostname
:
"127.0.0.1"
,
port
:
3000
,
path
:
path
,
method
:
'GET'
,
headers
:
headers
};
var
callback
=
function
(
response
)
{
console
.
log
(
'bla'
);
var
str
=
''
;
response
.
on
(
'data'
,
function
(
chunk
)
{
str
+=
chunk
;
});
response
.
on
(
'end'
,
function
()
{
console
.
log
(
str
);
});
};
var
req
=
http
.
request
(
options
,
callback
);
req
.
on
(
"error"
,
function
(
error
)
{
console
.
error
(
error
);
});
req
.
end
();
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