Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Digitaler 3G-Nachweis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor 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
AStA
Digitaler 3G-Nachweis
Commits
112090a3
Commit
112090a3
authored
3 years ago
by
Leon Tappe
Browse files
Options
Downloads
Patches
Plain Diff
add setting for age of recovered proof
parent
78afe1fe
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
management/lib/pages/server_settings_page.dart
+39
-0
39 additions, 0 deletions
management/lib/pages/server_settings_page.dart
management/lib/widgets/user_view.dart
+4
-1
4 additions, 1 deletion
management/lib/widgets/user_view.dart
with
43 additions
and
1 deletion
management/lib/pages/server_settings_page.dart
+
39
−
0
View file @
112090a3
...
...
@@ -15,6 +15,7 @@ const List<String> settingNames = [
'runtime_recovered'
,
'runtime_tested'
,
'runtime_vaccinated'
,
'min_age_recovered'
,
'motd_public'
,
'motd_internal'
,
];
...
...
@@ -23,6 +24,7 @@ const Map<String, String> settingTitles = {
'runtime_recovered'
:
'Nachweislaufzeit (Genesen)'
,
'runtime_tested'
:
'Nachweislaufzeit (Getestet)'
,
'runtime_vaccinated'
:
'Nachweislaufzeit (Geimpft)'
,
'min_age_recovered'
:
'Mindestalter Genesenenbescheinigung'
,
'motd_public'
:
'Infotext (Öffentlich)'
,
'motd_internal'
:
'Infotext (Intern)'
,
};
...
...
@@ -31,6 +33,7 @@ final Map<String, dynamic> settingDefaults = {
'runtime_recovered'
:
RuntimeSetting
(
RuntimeType
.
duration
,
duration:
const
Duration
(
days:
90
)),
'runtime_tested'
:
RuntimeSetting
(
RuntimeType
.
duration
,
duration:
const
Duration
(
hours:
24
)),
'runtime_vaccinated'
:
RuntimeSetting
(
RuntimeType
.
nextSemester
),
'min_age_recovered'
:
31
,
'motd_public'
:
''
,
'motd_internal'
:
''
,
};
...
...
@@ -100,6 +103,9 @@ class _ServerSettingsPageState extends State<ServerSettingsPage> {
if
(
setting
.
contains
(
'runtime'
))
{
_settings
[
setting
]
=
RuntimeSetting
.
fromMap
(
json
.
decode
(
_settings
[
setting
]));
}
if
(
setting
.
contains
(
'min_age'
))
{
_settings
[
setting
]
=
int
.
tryParse
(
_settings
[
setting
]);
}
}
setState
(()
=
>
_settings
);
...
...
@@ -126,6 +132,11 @@ class _ServerSettingsPageState extends State<ServerSettingsPage> {
}
else
if
(
result
is
RuntimeSetting
)
{
final
response
=
await
_adminApi
!.
updateSetting
(
key
,
result
.
toString
());
_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> {
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
{
return
ContentDialog
(
title:
const
Text
(
'Unbekannt bearbeiten'
),
...
...
This diff is collapsed.
Click to expand it.
management/lib/widgets/user_view.dart
+
4
−
1
View file @
112090a3
...
...
@@ -70,6 +70,7 @@ class _UserViewState extends State<UserView> {
RuntimeSetting
_testedRuntime
=
RuntimeSetting
(
RuntimeType
.
duration
,
duration:
const
Duration
(
hours:
24
));
RuntimeSetting
_recoveredRuntime
=
RuntimeSetting
(
RuntimeType
.
months
,
months:
3
);
int
_recoveredMinAge
=
31
;
RuntimeSetting
_vaccinatedRuntime
=
RuntimeSetting
(
RuntimeType
.
nextSemester
);
@override
...
...
@@ -226,7 +227,7 @@ class _UserViewState extends State<UserView> {
if
(
form
.
isTested
)
{
return
_calculateForType
(
form
,
_testedRuntime
);
}
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'
);
}
return
_calculateForType
(
form
,
_recoveredRuntime
);
...
...
@@ -303,6 +304,8 @@ class _UserViewState extends State<UserView> {
_recoveredRuntime
=
settings
[
'runtime_recovered'
]
as
RuntimeSetting
;
_vaccinatedRuntime
=
settings
[
'runtime_vaccinated'
]
as
RuntimeSetting
;
_recoveredMinAge
=
settings
[
'min_age_recovered'
]
as
int
;
_motd
=
settings
[
'motd_internal'
]
??
''
;
if
(
mounted
)
setState
(()
=
>
true
);
...
...
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