Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
AStA
Digitaler 3G-Nachweis
Commits
112090a3
Commit
112090a3
authored
Jan 20, 2022
by
Leon Tappe
🔥
Browse files
add setting for age of recovered proof
parent
78afe1fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
management/lib/pages/server_settings_page.dart
View file @
112090a3
...
@@ -15,6 +15,7 @@ const List<String> settingNames = [
...
@@ -15,6 +15,7 @@ const List<String> settingNames = [
'runtime_recovered'
,
'runtime_recovered'
,
'runtime_tested'
,
'runtime_tested'
,
'runtime_vaccinated'
,
'runtime_vaccinated'
,
'min_age_recovered'
,
'motd_public'
,
'motd_public'
,
'motd_internal'
,
'motd_internal'
,
];
];
...
@@ -23,6 +24,7 @@ const Map<String, String> settingTitles = {
...
@@ -23,6 +24,7 @@ const Map<String, String> settingTitles = {
'runtime_recovered'
:
'Nachweislaufzeit (Genesen)'
,
'runtime_recovered'
:
'Nachweislaufzeit (Genesen)'
,
'runtime_tested'
:
'Nachweislaufzeit (Getestet)'
,
'runtime_tested'
:
'Nachweislaufzeit (Getestet)'
,
'runtime_vaccinated'
:
'Nachweislaufzeit (Geimpft)'
,
'runtime_vaccinated'
:
'Nachweislaufzeit (Geimpft)'
,
'min_age_recovered'
:
'Mindestalter Genesenenbescheinigung'
,
'motd_public'
:
'Infotext (Öffentlich)'
,
'motd_public'
:
'Infotext (Öffentlich)'
,
'motd_internal'
:
'Infotext (Intern)'
,
'motd_internal'
:
'Infotext (Intern)'
,
};
};
...
@@ -31,6 +33,7 @@ final Map<String, dynamic> settingDefaults = {
...
@@ -31,6 +33,7 @@ final Map<String, dynamic> settingDefaults = {
'runtime_recovered'
:
RuntimeSetting
(
RuntimeType
.
duration
,
duration:
const
Duration
(
days:
90
)),
'runtime_recovered'
:
RuntimeSetting
(
RuntimeType
.
duration
,
duration:
const
Duration
(
days:
90
)),
'runtime_tested'
:
RuntimeSetting
(
RuntimeType
.
duration
,
duration:
const
Duration
(
hours:
24
)),
'runtime_tested'
:
RuntimeSetting
(
RuntimeType
.
duration
,
duration:
const
Duration
(
hours:
24
)),
'runtime_vaccinated'
:
RuntimeSetting
(
RuntimeType
.
nextSemester
),
'runtime_vaccinated'
:
RuntimeSetting
(
RuntimeType
.
nextSemester
),
'min_age_recovered'
:
31
,
'motd_public'
:
''
,
'motd_public'
:
''
,
'motd_internal'
:
''
,
'motd_internal'
:
''
,
};
};
...
@@ -100,6 +103,9 @@ class _ServerSettingsPageState extends State<ServerSettingsPage> {
...
@@ -100,6 +103,9 @@ class _ServerSettingsPageState extends State<ServerSettingsPage> {
if
(
setting
.
contains
(
'runtime'
))
{
if
(
setting
.
contains
(
'runtime'
))
{
_settings
[
setting
]
=
RuntimeSetting
.
fromMap
(
json
.
decode
(
_settings
[
setting
]));
_settings
[
setting
]
=
RuntimeSetting
.
fromMap
(
json
.
decode
(
_settings
[
setting
]));
}
}
if
(
setting
.
contains
(
'min_age'
))
{
_settings
[
setting
]
=
int
.
tryParse
(
_settings
[
setting
]);
}
}
}
setState
(()
=>
_settings
);
setState
(()
=>
_settings
);
...
@@ -126,6 +132,11 @@ class _ServerSettingsPageState extends State<ServerSettingsPage> {
...
@@ -126,6 +132,11 @@ class _ServerSettingsPageState extends State<ServerSettingsPage> {
}
else
if
(
result
is
RuntimeSetting
)
{
}
else
if
(
result
is
RuntimeSetting
)
{
final
response
=
await
_adminApi
!.
updateSetting
(
key
,
result
.
toString
());
final
response
=
await
_adminApi
!.
updateSetting
(
key
,
result
.
toString
());
_settings
[
key
]
=
RuntimeSetting
.
fromMap
(
json
.
decode
(
response
.
values
.
single
));
_settings
[
key
]
=
RuntimeSetting
.
fromMap
(
json
.
decode
(
response
.
values
.
single
));
}
else
if
(
result
is
int
)
{
print
(
result
.
toString
());
final
response
=
await
_adminApi
!.
updateSetting
(
key
,
result
.
toString
());
print
(
response
);
setState
(()
=>
_settings
[
key
]
=
int
.
tryParse
(
response
.
values
.
single
));
}
}
}
}
}
}
...
@@ -252,6 +263,34 @@ class _SettingDialogState extends State<SettingDialog> {
...
@@ -252,6 +263,34 @@ class _SettingDialogState extends State<SettingDialog> {
onPressed:
()
=>
Navigator
.
of
(
context
).
pop
(
text
),
child:
const
Text
(
'Speichern'
)),
onPressed:
()
=>
Navigator
.
of
(
context
).
pop
(
text
),
child:
const
Text
(
'Speichern'
)),
],
],
);
);
}
else
if
(
widget
.
setting
.
value
is
int
)
{
int
?
days
=
widget
.
setting
.
value
as
int
;
return
ContentDialog
(
title:
const
Text
(
'Nummer bearbeiten'
),
children:
[
Text
(
settingTitles
[
widget
.
setting
.
key
]
??
''
,
style:
Theme
.
of
(
context
).
textTheme
.
subtitle2
,
),
ListTile
(
title:
const
Text
(
'Tage'
),
trailing:
SizedBox
(
width:
128.0
,
child:
TextFormField
(
initialValue:
days
.
toString
(),
keyboardType:
TextInputType
.
number
,
onChanged:
(
String
input
)
=>
days
=
int
.
tryParse
(
input
),
),
),
),
],
actions:
[
ElevatedButton
(
onPressed:
()
=>
Navigator
.
of
(
context
).
pop
(),
child:
const
Text
(
'Abbrechen'
)),
ElevatedButton
(
onPressed:
()
=>
Navigator
.
of
(
context
).
pop
(
days
),
child:
const
Text
(
'Speichern'
)),
],
);
}
else
{
}
else
{
return
ContentDialog
(
return
ContentDialog
(
title:
const
Text
(
'Unbekannt bearbeiten'
),
title:
const
Text
(
'Unbekannt bearbeiten'
),
...
...
management/lib/widgets/user_view.dart
View file @
112090a3
...
@@ -70,6 +70,7 @@ class _UserViewState extends State<UserView> {
...
@@ -70,6 +70,7 @@ class _UserViewState extends State<UserView> {
RuntimeSetting
_testedRuntime
=
RuntimeSetting
_testedRuntime
=
RuntimeSetting
(
RuntimeType
.
duration
,
duration:
const
Duration
(
hours:
24
));
RuntimeSetting
(
RuntimeType
.
duration
,
duration:
const
Duration
(
hours:
24
));
RuntimeSetting
_recoveredRuntime
=
RuntimeSetting
(
RuntimeType
.
months
,
months:
3
);
RuntimeSetting
_recoveredRuntime
=
RuntimeSetting
(
RuntimeType
.
months
,
months:
3
);
int
_recoveredMinAge
=
31
;
RuntimeSetting
_vaccinatedRuntime
=
RuntimeSetting
(
RuntimeType
.
nextSemester
);
RuntimeSetting
_vaccinatedRuntime
=
RuntimeSetting
(
RuntimeType
.
nextSemester
);
@override
@override
...
@@ -226,7 +227,7 @@ class _UserViewState extends State<UserView> {
...
@@ -226,7 +227,7 @@ class _UserViewState extends State<UserView> {
if
(
form
.
isTested
)
{
if
(
form
.
isTested
)
{
return
_calculateForType
(
form
,
_testedRuntime
);
return
_calculateForType
(
form
,
_testedRuntime
);
}
else
if
(
form
.
isRecovered
)
{
}
else
if
(
form
.
isRecovered
)
{
if
(
DateTime
.
now
().
difference
(
form
.
certificationDate
!)
<
const
Duration
(
days:
29
))
{
if
(
DateTime
.
now
().
difference
(
form
.
certificationDate
!)
<
Duration
(
days:
_recoveredMinAge
))
{
throw
Exception
(
'test'
);
throw
Exception
(
'test'
);
}
}
return
_calculateForType
(
form
,
_recoveredRuntime
);
return
_calculateForType
(
form
,
_recoveredRuntime
);
...
@@ -303,6 +304,8 @@ class _UserViewState extends State<UserView> {
...
@@ -303,6 +304,8 @@ class _UserViewState extends State<UserView> {
_recoveredRuntime
=
settings
[
'runtime_recovered'
]
as
RuntimeSetting
;
_recoveredRuntime
=
settings
[
'runtime_recovered'
]
as
RuntimeSetting
;
_vaccinatedRuntime
=
settings
[
'runtime_vaccinated'
]
as
RuntimeSetting
;
_vaccinatedRuntime
=
settings
[
'runtime_vaccinated'
]
as
RuntimeSetting
;
_recoveredMinAge
=
settings
[
'min_age_recovered'
]
as
int
;
_motd
=
settings
[
'motd_internal'
]
??
''
;
_motd
=
settings
[
'motd_internal'
]
??
''
;
if
(
mounted
)
setState
(()
=>
true
);
if
(
mounted
)
setState
(()
=>
true
);
...
...
Write
Preview
Supports
Markdown
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