Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Commits
3c487c4c
There was a problem fetching the pipeline metadata.
Commit
3c487c4c
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
specific colors added to cancelled and no show appointments
parent
d4ee1729
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!37
Custom calendar colors for appointment location and appointment status
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/models/__init__.py
+1
-1
1 addition, 1 deletion
smash/web/models/__init__.py
smash/web/models/appointment.py
+13
-6
13 additions, 6 deletions
smash/web/models/appointment.py
with
14 additions
and
7 deletions
smash/web/models/__init__.py
+
1
−
1
View file @
3c487c4c
...
@@ -5,6 +5,7 @@ import datetime
...
@@ -5,6 +5,7 @@ import datetime
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
configuration_item
import
ConfigurationItem
from
flying_team
import
FlyingTeam
from
flying_team
import
FlyingTeam
from
location
import
Location
from
location
import
Location
from
room
import
Room
from
room
import
Room
...
@@ -18,7 +19,6 @@ from item import Item
...
@@ -18,7 +19,6 @@ from item import Item
from
language
import
Language
from
language
import
Language
from
subject
import
Subject
from
subject
import
Subject
from
contact_attempt
import
ContactAttempt
from
contact_attempt
import
ContactAttempt
from
configuration_item
import
ConfigurationItem
def
get_current_year
():
def
get_current_year
():
...
...
This diff is collapsed.
Click to expand it.
smash/web/models/appointment.py
+
13
−
6
View file @
3c487c4c
...
@@ -3,8 +3,10 @@ import datetime
...
@@ -3,8 +3,10 @@ import datetime
from
django.db
import
models
from
django.db
import
models
from
constants
import
APPOINTMENT_TYPE_DEFAULT_COLOR
,
APPOINTMENT_TYPE_DEFAULT_FONT_COLOR
from
constants
import
APPOINTMENT_TYPE_DEFAULT_COLOR
,
APPOINTMENT_TYPE_DEFAULT_FONT_COLOR
,
\
CANCELLED_APPOINTMENT_COLOR_CONFIGURATION_TYPE
,
NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE
from
.
import
FlyingTeam
,
Location
,
Room
,
Visit
,
Worker
from
.
import
FlyingTeam
,
Location
,
Room
,
Visit
,
Worker
from
.
import
ConfigurationItem
class
Appointment
(
models
.
Model
):
class
Appointment
(
models
.
Model
):
...
@@ -86,11 +88,16 @@ class Appointment(models.Model):
...
@@ -86,11 +88,16 @@ class Appointment(models.Model):
def
color
(
self
):
def
color
(
self
):
result
=
APPOINTMENT_TYPE_DEFAULT_COLOR
result
=
APPOINTMENT_TYPE_DEFAULT_COLOR
priority
=
1000000
if
self
.
status
==
Appointment
.
APPOINTMENT_STATUS_NO_SHOW
:
for
type
in
self
.
appointment_types
.
all
():
result
=
ConfigurationItem
.
objects
.
get
(
type
=
NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE
).
value
if
type
.
calendar_color_priority
<
priority
:
elif
self
.
status
==
Appointment
.
APPOINTMENT_STATUS_CANCELLED
:
priority
=
type
.
calendar_color_priority
result
=
ConfigurationItem
.
objects
.
get
(
type
=
CANCELLED_APPOINTMENT_COLOR_CONFIGURATION_TYPE
).
value
result
=
type
.
calendar_color
else
:
priority
=
1000000
for
type
in
self
.
appointment_types
.
all
():
if
type
.
calendar_color_priority
<
priority
:
priority
=
type
.
calendar_color_priority
result
=
type
.
calendar_color
return
result
return
result
def
font_color
(
self
):
def
font_color
(
self
):
...
...
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