Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open-web
Commits
f212ef0a
Commit
f212ef0a
authored
Feb 13, 2017
by
mdsecurity
Browse files
fixing isOpen()
parent
714923bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/app/place.ts
View file @
f212ef0a
...
@@ -2,53 +2,58 @@ import { Day } from './day';
...
@@ -2,53 +2,58 @@ import { Day } from './day';
import
{
Time
}
from
'
./time
'
;
import
{
Time
}
from
'
./time
'
;
export
class
Place
{
export
class
Place
{
main_schedule_times
:
Day
[]
=
[];
main_schedule_times
:
Day
[]
=
[];
special_schedule_times
=
[];
special_schedule_times
=
[];
id
:
number
;
id
:
number
;
last_modified
:
string
;
last_modified
:
string
;
name
:
string
;
name
:
string
;
category
:
number
;
category
:
number
;
location
:
string
;
location
:
string
;
constructor
(
main_schedule_times
:
Day
[],
special_schedule_times
,
id
:
number
,
last_modified
:
string
,
constructor
(
main_schedule_times
:
Day
[],
special_schedule_times
,
id
:
number
,
last_modified
:
string
,
name
:
string
,
category
:
number
,
location
:
string
)
{
name
:
string
,
category
:
number
,
location
:
string
)
{
this
.
main_schedule_times
=
main_schedule_times
;
this
.
main_schedule_times
=
main_schedule_times
;
this
.
special_schedule_times
=
special_schedule_times
;
this
.
special_schedule_times
=
special_schedule_times
;
this
.
id
=
id
;
this
.
id
=
id
;
this
.
last_modified
=
last_modified
;
this
.
last_modified
=
last_modified
;
this
.
name
=
name
;
this
.
name
=
name
;
this
.
category
=
category
;
this
.
category
=
category
;
this
.
location
=
location
;
this
.
location
=
location
;
}
}
// This method does NOT work with Special schedules
// This method does NOT work with Special schedules
isOpen
():
boolean
{
isOpen
():
boolean
{
const
currTime
=
new
Date
();
const
currTime
=
new
Date
();
const
inSeconds
=
currTime
.
getHours
()
*
60
*
60
+
currTime
.
getMinutes
()
*
60
+
currTime
.
getSeconds
();
const
inSeconds
=
currTime
.
getHours
()
*
60
*
60
+
currTime
.
getMinutes
()
*
60
+
currTime
.
getSeconds
();
const
dayOfWeek
=
currTime
.
getDay
()
-
1
;
const
dayOfWeek
=
currTime
.
getDay
()
-
1
;
for
(
let
i
=
0
;
i
<
this
.
main_schedule_times
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
main_schedule_times
.
length
;
i
++
)
{
const
day
=
this
.
main_schedule_times
[
i
];
const
day
=
this
.
main_schedule_times
[
i
];
if
(
day
.
start_day
===
dayOfWeek
||
day
.
end_day
===
dayOfWeek
+
1
)
{
if
(
day
.
start_day
===
dayOfWeek
&&
day
.
end_day
===
dayOfWeek
)
{
if
(
day
.
end_time
.
inSeconds
()
>
inSeconds
)
{
if
(
day
.
end_time
.
inSeconds
()
>
inSeconds
)
{
return
true
;
return
true
;
}
}
}
}
}
if
(
day
.
end_day
===
dayOfWeek
)
{
return
false
;
if
(
day
.
end_time
.
inSeconds
()
>
inSeconds
)
{
}
return
true
;
openFor
()
{
}
const
currTime
=
new
Date
();
}
// const today = currTime.getDay() - 1;
}
// const openDays: Day[] = this.onDay(today);
return
false
;
// const inSeconds = currTime.getHours() * 60 * 60 + currTime.getMinutes() * 60 + currTime.getSeconds();
}
openFor
()
{
const
currTime
=
new
Date
();
// const today = currTime.getDay() - 1;
// const openDays: Day[] = this.onDay(today);
// const inSeconds = currTime.getHours() * 60 * 60 + currTime.getMinutes() * 60 + currTime.getSeconds();
// let sumSeconds = 0;
// let sumSeconds = 0;
// for (let i = 0; i < openDays.length; i++) {
// for (let i = 0; i < openDays.length; i++) {
// let day = openDays[i];
// let day = openDays[i];
// sumSeconds += day.end_time.inSeconds() - day.end_time.inSeconds();
// sumSeconds += day.end_time.inSeconds() - day.end_time.inSeconds();
// }
// }
}
}
}
}
tslint.json
View file @
f212ef0a
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
"import-spacing"
:
true
,
"import-spacing"
:
true
,
"indent"
:
[
"indent"
:
[
true
,
true
,
"
space
s"
"
tab
s"
],
],
"interface-over-type-literal"
:
true
,
"interface-over-type-literal"
:
true
,
"label-position"
:
true
,
"label-position"
:
true
,
...
...
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