-
Notifications
You must be signed in to change notification settings - Fork 0
/
sensus.py
112 lines (90 loc) · 2.85 KB
/
sensus.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# -*- coding: utf-8 -*-
import datetime
class Deltagare:
id = ""
Foernamn = ""
Efternamn = ""
Personnummer = ""
Ledare = False
Epost = ""
MobilNr = ""
Attending = True
def __init__(self, id, Foernamn, Efternamn, Personnummer, ledare, epost="", mobilNr="", attending=True):
self.id = id
self.Foernamn = Foernamn
self.Efternamn = Efternamn
self.Personnummer = Personnummer
self.Ledare = ledare
self.Epost = epost
self.MobilNr = mobilNr
self.Attending = attending
def getAttendingMark(self):
return "1" if self.Attending else ""
def getname(self):
return self.Foernamn + ' ' + self.Efternamn
class Sammankomst:
kod = ""
datum = None
duration = 90
deltagare = []
ledare = []
def getAllPersons(self):
return self.ledare + self.deltagare
def isPersonAttending(self, person):
for p in self.getAllPersons():
if p.Personnummer == person.Personnummer:
return p.Attending
return False
def __init__(self, kod, datum, duration, Aktivitet):
self.kod = kod
self.datum = datum
self.duration = duration
self.Aktivitet = Aktivitet
self.deltagare = []
self.ledare = []
def GetDateString(self, format='%Y-%m-%d'):
return self.datum.strftime(format)
def GetStartTimeString(self, format='%H:%M:%S'):
return self.datum.strftime(format)
def GetStopTimeString(self, format='%H:%M:%S'):
maxEndTime = self.datum.replace(hour=23,minute=59,second=59)
endtime = self.datum + datetime.timedelta(minutes=self.duration)
if endtime > maxEndTime:
endtime = maxEndTime # limit to the current day (to keep Stop time after Start time)
return endtime.strftime(format)
class SensusLista:
Sammankomster = []
Aktivitet="Moete"
Lokal="Scouthuset"
NamnPaaKort=""
deltagare = []
ledare = []
def __init__(self):
self.deltagare = []
self.ledare = []
self.Sammankomster = []
def getAllPersons(self):
return self.ledare + self.deltagare
def getAttendantsCountsPerMeeting(self):
attendantsCounts = []
for m in self.Sammankomster:
personCount = 0
for d in m.getAllPersons():
if d.Attending:
personCount += 1
attendantsCounts.append(personCount)
return attendantsCounts
def getAttendantsHoursPerMeeting(self):
attendantsHours = []
for m in self.Sammankomster:
attendantsHours.append(m.duration/45)
return attendantsHours
class SensusData:
kommunID = ""
foreningsID = ""
foereningsNamn=u""
organisationsnummer=""
verksamhetsAar = ""
listor = []
def __init__(self):
self.listor = []