Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DashboardLeaf
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ProjectLeaf
DashboardLeaf
Commits
061caad8
Commit
061caad8
authored
4 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
Fixed #33 - GarbageScheduleTile: add remaining days counter
parent
f4af2a39
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/logic/tile/tiles/GarbageContainerScheduleTile.html
+1
-1
1 addition, 1 deletion
src/logic/tile/tiles/GarbageContainerScheduleTile.html
src/logic/tile/tiles/GarbageContainerScheduleTile.py
+9
-2
9 additions, 2 deletions
src/logic/tile/tiles/GarbageContainerScheduleTile.py
with
10 additions
and
3 deletions
src/logic/tile/tiles/GarbageContainerScheduleTile.html
+
1
−
1
View file @
061caad8
...
@@ -29,6 +29,6 @@
...
@@ -29,6 +29,6 @@
<div
class=
"garbageContainerScheduleTile"
>
<div
class=
"garbageContainerScheduleTile"
>
<div
class=
"content"
>
<div
class=
"content"
>
<img
src=
"../../static/images/{{ data['iconFileName'] }}"
class=
"icon"
/>
<img
src=
"../../static/images/{{ data['iconFileName'] }}"
class=
"icon"
/>
{{ data['nextEventDate'] }}
{{ data['nextEventDate'] }}
- {{ data['remainingDays'] }} Tag(e)
</div>
</div>
</div>
</div>
This diff is collapsed.
Click to expand it.
src/logic/tile/tiles/GarbageContainerScheduleTile.py
+
9
−
2
View file @
061caad8
...
@@ -11,7 +11,7 @@ from logic.tile.Tile import Tile
...
@@ -11,7 +11,7 @@ from logic.tile.Tile import Tile
class
GarbageContainerScheduleTile
(
Tile
):
class
GarbageContainerScheduleTile
(
Tile
):
DATE_FORMAT
=
'
dd.MM
. (E)
'
DATE_FORMAT
=
'
E
dd.MM
'
ICON_BY_GARBAGE_TYPE
=
{
ICON_BY_GARBAGE_TYPE
=
{
'
Papier
'
:
'
garbage_paper
'
,
'
Papier
'
:
'
garbage_paper
'
,
...
@@ -38,15 +38,22 @@ class GarbageContainerScheduleTile(Tile):
...
@@ -38,15 +38,22 @@ class GarbageContainerScheduleTile(Tile):
nextEvent
=
self
.
__find_next_date
(
eventsForGarbageType
)
nextEvent
=
self
.
__find_next_date
(
eventsForGarbageType
)
nextEventDate
=
'
--.--.
'
nextEventDate
=
'
--.--.
'
remainingDays
=
''
if
nextEvent
:
if
nextEvent
:
nextEventDate
=
nextEvent
.
start
nextEventDate
=
nextEvent
.
start
if
isinstance
(
nextEventDate
,
datetime
):
remainingDays
=
nextEventDate
-
datetime
.
now
()
else
:
remainingDays
=
nextEventDate
-
datetime
.
now
().
date
()
remainingDays
=
remainingDays
.
days
nextEventDate
=
format_date
(
nextEventDate
,
self
.
DATE_FORMAT
,
'
de
'
)
nextEventDate
=
format_date
(
nextEventDate
,
self
.
DATE_FORMAT
,
'
de
'
)
iconName
=
self
.
ICON_BY_GARBAGE_TYPE
[
self
.
_settings
[
'
garbageType
'
]]
iconName
=
self
.
ICON_BY_GARBAGE_TYPE
[
self
.
_settings
[
'
garbageType
'
]]
return
{
return
{
'
nextEventDate
'
:
nextEventDate
,
'
nextEventDate
'
:
nextEventDate
,
'
iconFileName
'
:
f
'
{
iconName
}
.png
'
'
iconFileName
'
:
f
'
{
iconName
}
.png
'
,
'
remainingDays
'
:
remainingDays
}
}
def
__find_next_date
(
self
,
events
:
List
[
CalendarEvent
])
->
CalendarEvent
or
None
:
def
__find_next_date
(
self
,
events
:
List
[
CalendarEvent
])
->
CalendarEvent
or
None
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment