-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmethods.coffee
More file actions
40 lines (37 loc) · 1.01 KB
/
Copy pathmethods.coffee
File metadata and controls
40 lines (37 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Meteor.methods
updateTransport: (person, transport) ->
if transport == 'Car'
carCount = Person.find({ transport: 'Car' }).count()
if carCount < 5
if carCount == 4
Transport.update { type: transport }, { $set: full: true }
else
Transport.update { type: transport }, { $set: full: false }
Person.update { name: person }, { $set: transport: transport }
else
Person.update { name: person }, { $set: transport: transport }
updateBullets: (person) ->
Person.update { name: person }, ( $inc: bullets: 1 )
updateDate: (name, timestamp) ->
if timestamp == null
Person.update { name: name }, { $unset: date: '' }
else
date = new Date(timestamp)
day = date.getDate()
month = date.getMonth()
date = day + ' ' + months[month]
Person.update { name: name }, { $set: date: date }
months = [
'January'
'Februari'
'Maart'
'April'
'Mei'
'Juni'
'July'
'Augustus'
'September'
'October'
'November'
'December'
]