Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule Reports #3510

Merged
merged 273 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
273 commits
Select commit Hold shift + click to select a range
01e01c5
Update documentation
jpbruinsslot Jan 25, 2024
44e415f
Update docs and restructure some code
jpbruinsslot Jan 29, 2024
8968abe
Fix diagram010.svg
jpbruinsslot Jan 29, 2024
86db29b
Fix
jpbruinsslot Jan 29, 2024
04995f7
Merge branch 'main' into chore/mula/update-architecture-doc
jpbruinsslot Jan 29, 2024
e76dc69
Merge branch 'main' into feature/mula/flexible-scheduling
jpbruinsslot Jan 29, 2024
2a7693b
Merge branch 'chore/mula/update-architecture-doc' into feature/mula/f…
jpbruinsslot Jan 29, 2024
a9cd630
Update docs
jpbruinsslot Jan 29, 2024
4416704
Update documentation
jpbruinsslot Jan 30, 2024
e12c0ee
Refactor naming
jpbruinsslot Jan 30, 2024
97b0350
Update docs
jpbruinsslot Jan 31, 2024
85777ea
Merge branch 'main' into feature/mula/flexible-scheduling
jpbruinsslot Mar 5, 2024
245ca61
First round of git pre-commit
jpbruinsslot Mar 5, 2024
2838b45
Fix mypy suggestions
jpbruinsslot Mar 6, 2024
5b2bda7
Restructure of models
jpbruinsslot Mar 7, 2024
1175452
Continue implementing data deduplication fixes
jpbruinsslot Mar 12, 2024
c29a747
Refactoring
jpbruinsslot Mar 13, 2024
47466a0
Fixing sqlalchemy nested, removing TaskSchedule
jpbruinsslot Mar 14, 2024
a82c344
Continue refactoring
jpbruinsslot Mar 18, 2024
4cfbbcb
Refactor filtering
jpbruinsslot Mar 20, 2024
5f9b2bf
Continue with nested queries
jpbruinsslot Mar 21, 2024
a58a69f
Fix filtering with relationship
jpbruinsslot Mar 25, 2024
be79fc6
Fix tests for updated filters
jpbruinsslot Mar 26, 2024
b54bdf8
Testing out queue refactor
jpbruinsslot Mar 27, 2024
4e98e6c
Alternative keeping PrioritizedItem present
jpbruinsslot Apr 1, 2024
e25d1f7
Make priority queue test work
jpbruinsslot Apr 2, 2024
fd29038
Update scheduler.py
jpbruinsslot Apr 2, 2024
ff94126
Update scheduler.py testing
jpbruinsslot Apr 2, 2024
57f30f1
Going through test_scheduler.py
jpbruinsslot Apr 3, 2024
0fa1a55
Clean ups
jpbruinsslot Apr 3, 2024
2fa57b6
Fix naming
jpbruinsslot Apr 3, 2024
652fc2c
Merge branch 'main' into feature/mula/refactor-queue
jpbruinsslot Apr 4, 2024
42dac16
Fix packages
jpbruinsslot Apr 4, 2024
505c38f
Clean up
jpbruinsslot Apr 4, 2024
bb72127
Clean up
jpbruinsslot Apr 4, 2024
171f797
Reset
jpbruinsslot Apr 4, 2024
1b03896
Reset
jpbruinsslot Apr 4, 2024
e788158
Clean up
jpbruinsslot Apr 4, 2024
12e1758
Reset
jpbruinsslot Apr 4, 2024
fc7ccf3
Fix status
jpbruinsslot Apr 4, 2024
fb08bb1
Starting with fixing tests
jpbruinsslot Apr 4, 2024
c5f9f7d
Fix tests
jpbruinsslot Apr 8, 2024
c96de0f
Fix pq
jpbruinsslot Apr 8, 2024
58a0224
Continue with fixing tests
jpbruinsslot Apr 15, 2024
c5d7aae
Continue updating tests
jpbruinsslot Apr 16, 2024
45019f3
Continue with fixing tests
jpbruinsslot Apr 17, 2024
1f46615
Update tests
jpbruinsslot Apr 18, 2024
5275ec4
Fixing tests
jpbruinsslot Apr 22, 2024
88208b4
Fix stalled tests
jpbruinsslot Apr 30, 2024
b729d7c
Remove PrioritizedItem
jpbruinsslot May 1, 2024
3942029
Updating tests
jpbruinsslot May 2, 2024
473199e
Restructure deadline calculation
jpbruinsslot May 20, 2024
8f31c61
Start fixing normalizer scheduler
jpbruinsslot May 20, 2024
cc53a39
Restructure
jpbruinsslot May 27, 2024
a0f4be6
Remove obsolete code
jpbruinsslot May 28, 2024
8c5d7bf
Merge branch 'main' into feature/mula/refactor-queue
jpbruinsslot Jun 11, 2024
c90e216
Some more merge conflict fixes
jpbruinsslot Jun 11, 2024
592270f
Update
jpbruinsslot Jun 24, 2024
5aefdb9
Refactor push task
jpbruinsslot Jun 25, 2024
8d29a3e
Refactor
jpbruinsslot Jun 26, 2024
51f40fd
Start with normalizer refactor
jpbruinsslot Jun 26, 2024
4c46160
Todo
jpbruinsslot Jun 27, 2024
ee9a234
Refactor push task normalizer
jpbruinsslot Jun 27, 2024
25bfe06
Merge branch 'main' into feature/mula/refactor-queue
jpbruinsslot Jun 27, 2024
064d930
Fix conflict
jpbruinsslot Jun 27, 2024
0c27657
Fix server api tests
jpbruinsslot Jul 1, 2024
35c57bb
Refactor server
jpbruinsslot Jul 1, 2024
44c9b8e
Add api endpoints for schedules
jpbruinsslot Jul 2, 2024
5459ccd
Rename method normalizer scheduler
jpbruinsslot Jul 3, 2024
126ab04
Changes
jpbruinsslot Jul 3, 2024
76ad63e
Trying to fix bug
jpbruinsslot Jul 4, 2024
3cb590f
Update normalizer
jpbruinsslot Jul 8, 2024
8e9b401
Fix validation and setting of schedule
jpbruinsslot Jul 8, 2024
3c1c9d3
Bug finally fixed
jpbruinsslot Jul 9, 2024
4820d1b
Continue fixing bugs
jpbruinsslot Jul 10, 2024
c48d93f
Fix retrieving schedules from database
jpbruinsslot Jul 11, 2024
d673789
Make tests work
jpbruinsslot Jul 11, 2024
f2f7ca9
Fixing bugs, updating tests
jpbruinsslot Jul 11, 2024
e9ce420
Fix tests
jpbruinsslot Jul 15, 2024
ec03654
Fixing tests
jpbruinsslot Jul 15, 2024
448b580
For now skip test
jpbruinsslot Jul 16, 2024
78e0101
Merge branch 'main' into feature/mula/refactor-queue
jpbruinsslot Jul 16, 2024
6f6836d
Integration scheduler changes with other services
jpbruinsslot Jul 17, 2024
8f18cd6
Fix normalizer bug
jpbruinsslot Jul 18, 2024
d566317
Start with schedule implementation
jpbruinsslot Jul 18, 2024
8e358a8
Update and fix scripts
jpbruinsslot Jul 18, 2024
09d8861
Add tests
jpbruinsslot Jul 18, 2024
8e67fe3
Fixes
jpbruinsslot Jul 22, 2024
afe8acb
Merge branch 'main' into feature/mula/refactor-queue
jpbruinsslot Jul 23, 2024
64487b4
Add some tests
jpbruinsslot Jul 23, 2024
7a2a938
Update migration
jpbruinsslot Jul 23, 2024
b576a2d
Update migrations
jpbruinsslot Jul 23, 2024
e68a7e7
Update migrations
jpbruinsslot Jul 23, 2024
64e6820
Fix new boefjes
jpbruinsslot Jul 23, 2024
4405160
Add tests
jpbruinsslot Jul 24, 2024
7fb719e
Remove breakpoint
jpbruinsslot Jul 24, 2024
5b360a5
Precommit
jpbruinsslot Jul 24, 2024
260a2f3
Restructure scripts
jpbruinsslot Jul 24, 2024
cd64da4
Restructure storage
jpbruinsslot Jul 24, 2024
395ae2f
Restructure server
jpbruinsslot Jul 24, 2024
81b1a34
Fix new boefjes issue
jpbruinsslot Jul 24, 2024
735d4b4
Merge branch 'feature/mula/refactor-queue' into feature/rocky/schedules
jpbruinsslot Jul 24, 2024
83ef876
Add thread safety tests
jpbruinsslot Jul 24, 2024
ba3a81d
Add additional thread safety test for the other caches
jpbruinsslot Jul 25, 2024
7e4ce13
Add more tests
jpbruinsslot Jul 25, 2024
d90d6d5
Merge branch 'fix/mula/new_boefjes' into feature/mula/refactor-queue
jpbruinsslot Jul 25, 2024
e6c800c
Merge branch 'main' into fix/mula/new_boefjes
underdarknl Jul 25, 2024
88e7bb7
Exclude folder from pre-commit
jpbruinsslot Jul 29, 2024
1d83f0f
Update .pre-commit-config.yaml
jpbruinsslot Jul 29, 2024
8dc860c
Update pyproject.toml
jpbruinsslot Jul 29, 2024
95ed5ed
Update .pre-commit-config.yaml
jpbruinsslot Jul 29, 2024
8c08c9a
Remove logging statements
jpbruinsslot Jul 29, 2024
1a19d77
Precommit
jpbruinsslot Jul 29, 2024
626301d
Merge branch 'main' into feature/mula/server-updates
jpbruinsslot Jul 29, 2024
b9553ad
Merge branch 'main' into feature/mula/storage-updates
jpbruinsslot Jul 29, 2024
35fc046
Fix mypy suggestions
jpbruinsslot Jul 29, 2024
51089dd
Update tests
jpbruinsslot Jul 29, 2024
e5823be
Update
jpbruinsslot Jul 29, 2024
cea7f53
Fix tests
jpbruinsslot Jul 29, 2024
b63faa0
Pre-commit
jpbruinsslot Jul 29, 2024
ff49bc5
Merge branch 'feature/mula/storage-updates' into feature/mula/refacto…
jpbruinsslot Jul 29, 2024
79c860e
Merge branch 'feature/mula/scripts' into feature/mula/refactor-queue
jpbruinsslot Jul 29, 2024
66c2a16
Pre-commit
jpbruinsslot Jul 29, 2024
c446e13
Merge branch 'feature/mula/server-updates' into feature/mula/refactor…
jpbruinsslot Jul 29, 2024
e30ba73
Pre-commit
jpbruinsslot Jul 29, 2024
0b45e49
Merge branch 'feature/mula/scripts' into feature/mula/refactor-queue
jpbruinsslot Jul 29, 2024
408227d
Pre-commit
jpbruinsslot Jul 29, 2024
55e4673
Update mula/scheduler/connectors/services/katalogus.py
jpbruinsslot Jul 30, 2024
f97b196
Updates according to code-review
jpbruinsslot Jul 30, 2024
019752b
Pre-commit
jpbruinsslot Jul 30, 2024
7cdb525
Update filters.py
jpbruinsslot Jul 30, 2024
093276c
Update logging
jpbruinsslot Jul 30, 2024
33bac6e
Update filters.py
jpbruinsslot Jul 30, 2024
4e1dc9e
Pre-commit
jpbruinsslot Jul 30, 2024
da875c5
Fix filters
jpbruinsslot Jul 30, 2024
df4855e
Trying to fix mypy errors
jpbruinsslot Jul 30, 2024
9185597
Merge branch 'main' into feature/mula/storage-updates
jpbruinsslot Jul 30, 2024
e97a460
Fix datastore connection
jpbruinsslot Jul 30, 2024
0633a06
Trying to fix boefje tests
jpbruinsslot Jul 30, 2024
9bfd16b
Fix boefje tests
jpbruinsslot Jul 30, 2024
5a60394
Merge branch 'main' into fix/mula/new_boefjes
ammar92 Jul 31, 2024
de2eef7
Remove unnecessary type hints
jpbruinsslot Jul 31, 2024
c560581
Fix rocky tests
jpbruinsslot Jul 31, 2024
494a558
Fix rocky tests
jpbruinsslot Jul 31, 2024
ad44c02
Fix rocky tests
jpbruinsslot Jul 31, 2024
aa5aa2d
Update filters.py
jpbruinsslot Jul 31, 2024
e9950a9
Pre-commit
jpbruinsslot Jul 31, 2024
bd1a99e
Fix mypy
jpbruinsslot Jul 31, 2024
86901ab
Trying to add stubs
jpbruinsslot Jul 31, 2024
1fbceb6
Update mula/scheduler/context/context.py
jpbruinsslot Jul 31, 2024
4fbbe42
Update mula/scheduler/context/context.py
jpbruinsslot Jul 31, 2024
875cf08
Updates according to code review
jpbruinsslot Jul 31, 2024
7a78358
Add code-review suggestions
jpbruinsslot Jul 31, 2024
48bd09d
Merge branch 'feature/mula/scripts' into feature/mula/refactor-queue
jpbruinsslot Jul 31, 2024
20654d5
Merge remote-tracking branch 'origin/fix/mula/new_boefjes' into featu…
jpbruinsslot Jul 31, 2024
b862117
Merge remote-tracking branch 'origin/feature/mula/server-updates' int…
jpbruinsslot Jul 31, 2024
9f64326
Merge remote-tracking branch 'origin/feature/mula/storage-updates' in…
jpbruinsslot Jul 31, 2024
14fbe54
Merge branch 'main' into feature/mula/refactor-queue
jpbruinsslot Jul 31, 2024
aebb870
Fix for boefje/normalizer runner
jpbruinsslot Aug 1, 2024
f6be13a
Pre-commit
jpbruinsslot Aug 1, 2024
2516b1b
Fix requirements
jpbruinsslot Aug 1, 2024
abf5bf1
Update croniter
jpbruinsslot Aug 1, 2024
f777ef3
Update from croniter types
jpbruinsslot Aug 1, 2024
dc7f1f4
Ignore type
jpbruinsslot Aug 1, 2024
6ed961f
Ignore security-sensitive check of random
jpbruinsslot Aug 1, 2024
beeab12
Fix shadowing of python builtin
jpbruinsslot Aug 1, 2024
c849d0a
Pre-commit
jpbruinsslot Aug 1, 2024
00c126d
Fix linting
jpbruinsslot Aug 1, 2024
7926f53
Fix manual rescheduling
jpbruinsslot Aug 5, 2024
4b46b0c
Fix schedule_id when manual rescheduling
jpbruinsslot Aug 5, 2024
ce073ea
Merge branch 'feature/mula/refactor-queue' into feature/rocky/schedules
jpbruinsslot Aug 6, 2024
6ee70e9
Merge branch 'main' into feature/mula/refactor-queue
jpbruinsslot Aug 6, 2024
5df88d0
Merge branch 'feature/mula/refactor-queue' into feature/rocky/schedules
jpbruinsslot Aug 6, 2024
69e6faf
Merge branch 'main' into feature/mula/refactor-queue
jpbruinsslot Aug 6, 2024
94a25c5
Merge branch 'feature/mula/refactor-queue' into feature/rocky/schedules
jpbruinsslot Aug 6, 2024
0e4b2fa
Merge branch 'main' into feature/mula/refactor-queue
jpbruinsslot Aug 6, 2024
7371c55
Fix formatting
jpbruinsslot Aug 7, 2024
e4daab6
Formatting
jpbruinsslot Aug 7, 2024
bfda8fb
Formatting
jpbruinsslot Aug 7, 2024
299fc22
Updates according to code review
jpbruinsslot Aug 8, 2024
efb871a
Merge branch 'main' into feature/mula/refactor-queue
jpbruinsslot Aug 8, 2024
50c39a2
Fix poetry
jpbruinsslot Aug 8, 2024
c0af1ea
Schedule report forms and validations and corn expressions
Rieven Aug 8, 2024
8efbf8a
Merge branch 'feature/mula/refactor-queue' into feature/rocky/schedules
jpbruinsslot Aug 8, 2024
c3a7854
Add form to reports for shculing
Rieven Aug 8, 2024
15087be
Merge branch 'feature/rocky/schedules' of github.com:minvws/nl-kat-co…
Rieven Aug 8, 2024
8b7c3ca
Add api create schedules functionality
jpbruinsslot Aug 8, 2024
6117eec
Merge branch 'feature/mula/api-create-schedules' into feature/rocky/s…
jpbruinsslot Aug 8, 2024
9f0da80
Update create schedule functionality
jpbruinsslot Aug 12, 2024
d4408fe
Pre-commit
jpbruinsslot Aug 12, 2024
c6f8f9f
Update scheduler client for rocky
jpbruinsslot Aug 12, 2024
265ced6
Fix tests
jpbruinsslot Aug 12, 2024
e985caf
Fix test
jpbruinsslot Aug 13, 2024
54ade75
Merge remote-tracking branch 'origin' into feature/rocky/schedules
jpbruinsslot Aug 13, 2024
d99d2b5
Add create schedule functionality to api
jpbruinsslot Aug 13, 2024
90ae4c8
Update serializers
jpbruinsslot Aug 13, 2024
9141fbf
Add TODO
jpbruinsslot Aug 13, 2024
fddbaf9
Add validation, and hash generation
jpbruinsslot Aug 14, 2024
bb968df
Add tests
jpbruinsslot Aug 14, 2024
11821ea
Pre-commit
jpbruinsslot Aug 14, 2024
061df46
Merge branch 'main' into feature/mula/create-schedule
jpbruinsslot Aug 14, 2024
978656b
Check if hash already exists
jpbruinsslot Aug 14, 2024
ba33e61
Update
jpbruinsslot Aug 14, 2024
d585ce3
Merge branch 'main' into feature/mula/create-schedule
jpbruinsslot Aug 15, 2024
819955a
Merge branch 'main' into feature/mula/create-schedule
jpbruinsslot Aug 19, 2024
1bd0c61
Merge branch 'feature/rocky/schedules' of github.com:minvws/nl-kat-co…
Rieven Aug 19, 2024
700db1f
Merge branch 'feature/mula/create-schedule' of github.com:minvws/nl-k…
Rieven Aug 19, 2024
55c5967
Merge branch 'feature/merge-scheduled-reports' of github.com:minvws/n…
Rieven Aug 19, 2024
a1cde85
Scheduler api integrated
Rieven Aug 19, 2024
35ebc9c
add schedule
Rieven Aug 19, 2024
3904028
Merge branch 'main' of github.com:minvws/nl-kat-coordination into fea…
Rieven Sep 10, 2024
2767329
Merge branch 'main' into feature/schedule-report
Rieven Sep 11, 2024
2189e55
Merge branch 'main' into feature/schedule-report
Rieven Sep 11, 2024
db5798a
Merge remote-tracking branch 'origin' into feature/schedule-report
jpbruinsslot Sep 11, 2024
5671a0d
Rebase
jpbruinsslot Sep 11, 2024
512b2e9
Update report task
jpbruinsslot Sep 11, 2024
780870e
Remove patch method for now to avoid confusion
jpbruinsslot Sep 11, 2024
a59d07b
Merge branch 'feature/report-recipe' of github.com:minvws/nl-kat-coor…
Rieven Sep 11, 2024
41232a8
Merge branch 'feature/report-recipe' of github.com:minvws/nl-kat-coor…
Rieven Sep 11, 2024
7092cde
fix lang
Rieven Sep 11, 2024
74cd0b5
Update scheduler client
jpbruinsslot Sep 11, 2024
b9ce6b0
fix multi report
Rieven Sep 11, 2024
53c55c7
Merge branch 'feature/schedule-report' of github.com:minvws/nl-kat-co…
Rieven Sep 11, 2024
565ac48
Update
jpbruinsslot Sep 11, 2024
18c03e5
Merge branch 'feature/report-recipe' of github.com:minvws/nl-kat-coor…
Rieven Sep 12, 2024
8cbcdc8
Merge branch 'feature/report-recipe' of github.com:minvws/nl-kat-coor…
Rieven Sep 12, 2024
f1795db
fix lang
Rieven Sep 12, 2024
978f35c
Merge branch 'feature/report-recipe' of github.com:minvws/nl-kat-coor…
Rieven Sep 12, 2024
4eac7be
Merge branch 'feature/report-recipe' of github.com:minvws/nl-kat-coor…
Rieven Sep 12, 2024
a7b3d0f
fix precommit
Rieven Sep 12, 2024
33f635e
Merge branch 'feature/report-recipe' of github.com:minvws/nl-kat-coor…
Rieven Sep 18, 2024
5ea561c
fix test
Rieven Sep 18, 2024
35d7190
Add form
Rieven Sep 18, 2024
a591fcf
chaneg names
Rieven Sep 18, 2024
abd8f7e
Fix form validation for cron
Rieven Sep 23, 2024
fde2ff3
Merge branch 'main' of github.com:minvws/nl-kat-coordination into fea…
Rieven Sep 23, 2024
f46ebb1
Fix views for report schedule
Rieven Sep 25, 2024
f68be57
Merge branch 'feature/report-recipe' of github.com:minvws/nl-kat-coor…
Rieven Sep 25, 2024
d214896
Add schdule reports
Rieven Sep 26, 2024
bbc6ecf
Merge branch 'feature/report-recipe' of github.com:minvws/nl-kat-coor…
Rieven Sep 26, 2024
e1c28e8
bundled errors
Rieven Sep 26, 2024
2b4e57e
Merge branch 'feature/report-recipe' of github.com:minvws/nl-kat-coor…
Rieven Sep 26, 2024
883eacf
Fix some bug when change selection
Rieven Sep 26, 2024
a1dcbc2
add text
Rieven Sep 30, 2024
6964e3c
fix test
Rieven Sep 30, 2024
15343db
Merge branch 'feature/report-recipe' of github.com:minvws/nl-kat-coor…
Rieven Sep 30, 2024
2d8b329
merge base
Rieven Sep 30, 2024
f11891f
fix base
Rieven Sep 30, 2024
3afd2ef
fix lang
Rieven Sep 30, 2024
c7f107a
Merge branch 'feature/report-recipe' into feature/schedule-report
underdarknl Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rocky/katalogus/views/change_clearance_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
class ChangeClearanceLevel(OrganizationPermissionRequiredMixin, SchedulerView, SinglePluginView, TemplateView):
template_name = "change_clearance_level.html"
permission_required = "tools.can_set_clearance_level"
task_type = "boefje"

def setup(self, request, *args, **kwargs):
super().setup(request, *args, **kwargs)
Expand Down
109 changes: 108 additions & 1 deletion rocky/reports/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from datetime import datetime, timezone

from django import forms
from django.utils.translation import gettext_lazy as _
from tools.forms.base import BaseRockyForm
from tools.forms.base import BaseRockyForm, DateInput

from reports.report_types.definitions import Report

Expand Down Expand Up @@ -28,3 +30,108 @@ def __init__(self, report_types: set[Report], *args, **kwargs):
super().__init__(*args, **kwargs)
report_types_choices = ((report_type.id, report_type.name) for report_type in report_types)
self.fields["report_type"].choices = report_types_choices


class ReportScheduleStartDateChoiceForm(BaseRockyForm):
choose_date = forms.ChoiceField(
label="",
required=False,
widget=forms.RadioSelect(attrs={"class": "submit-on-click"}),
choices=(("today", _("Today")), ("schedule", _("Different date"))),
initial="today",
)


class ReportScheduleStartDateForm(BaseRockyForm):
start_date = forms.DateField(
label="",
widget=DateInput(format="%Y-%m-%d"),
initial=lambda: datetime.now(tz=timezone.utc).date(),
required=True,
)


class ReportRecurrenceChoiceForm(BaseRockyForm):
choose_recurrence = forms.ChoiceField(
label="",
required=False,
widget=forms.RadioSelect(attrs={"class": "submit-on-click"}),
choices=(("once", _("No, just once")), ("repeat", _("Yes, repeat"))),
initial="once",
)


class ReportScheduleRecurrenceForm(BaseRockyForm):
recurrence = forms.ChoiceField(
label="",
required=False,
widget=forms.Select(attrs={"form": "generate_report"}),
choices=[
("daily", _("Daily")),
("weekly", _("Weekly")),
("monthly", _("Monthly")),
("yearly", _("Yearly")),
],
)


class CustomReportScheduleForm(BaseRockyForm):
start_date = forms.DateField(
label=_("Start date"),
widget=DateInput(format="%Y-%m-%d"),
initial=lambda: datetime.now(tz=timezone.utc).date(),
required=False,
)
repeating_number = forms.IntegerField(initial=1, required=False, min_value=1, max_value=100)
repeating_term = forms.ChoiceField(
widget=forms.Select,
choices=[
("day", _("day")),
("week", _("week")),
("month", _("month")),
("year", _("year")),
],
)
on_weekdays = forms.ChoiceField(
widget=forms.RadioSelect,
choices=[
("monday", "M"),
("tuesday", "T"),
("wednesday", "W"),
("thursday", "T"),
("friday", "F"),
("saturday", "S"),
("sunday", "S"),
],
)
recurrence_ends = forms.ChoiceField(
widget=forms.RadioSelect,
choices=[
("never", _("Never")),
("on", _("On")), # user choses a specific date
("after", _("After")), # after how many occurrences? Shows drop down with occurrences
],
)

end_date = forms.DateField(
label=_(""),
widget=forms.HiddenInput(),
initial=lambda: datetime.now(tz=timezone.utc).date(),
required=False,
)


class ParentReportNameForm(BaseRockyForm):
parent_report_name = forms.CharField(
label=_("Report name format"), required=False, initial="{report type} for {ooi}"
)


class ChildReportNameForm(BaseRockyForm):
child_report_name = forms.CharField(
label=_("Subreports name format"), required=True, initial="{report type} for {ooi}"
)


class ReportNameForm(ParentReportNameForm, ChildReportNameForm):
pass
5 changes: 5 additions & 0 deletions rocky/reports/templates/forms/report_form_fields.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@
{% for required_optional_plugin, plugins_ in plugins.items %}
{% for plugin in plugins_ %}<input type="hidden" name="plugin" value="{{ plugin.id }}">{% endfor %}
{% endfor %}
{% if request.POST.choose_recurrence %}
<input type="hidden"
name="choose_recurrence"
value="{{ request.POST.choose_recurrence }}">
{% endif %}
95 changes: 40 additions & 55 deletions rocky/reports/templates/partials/export_report_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,68 +7,52 @@
<section>
<div>
{% if selected_oois and selected_report_types %}
<h2>{% translate "Report name" %}</h2>
{% include "partials/return_button.html" with btn_text="Change selection" %}

<h2>{% translate "Report schedule" %}</h2>
<p>
{% blocktranslate trimmed %}
Give your report a custom name and optionally add the reports' reference date
to the name. To do so you can select a standard option or use a <a href="https://strftime.org/" target="_blank">Python
strftime code</a> in the report name.
When scheduling your report, you have two options. You can either choose to generate it just once now,
or set it to run automatically at regular intervals, like daily, weekly,
or monthly. If you need the report just for a single occasion, select the one-time option.
{% endblocktranslate %}
</p>
{% include "partials/return_button.html" with btn_text="Change selection" %}

<form class="inline" method="post" action="{{ current }}">
{% csrf_token %}
{% include "forms/report_form_fields.html" %}

<h3>{% translate "Recurrence" %}</h3>
{% include "partials/form/fieldset.html" with fields=report_schedule_form_recurrence_choice %}

{% if is_scheduled_report %}
{% include "partials/form/fieldset.html" with fields=report_schedule_form_recurrence %}

{% endif %}
</form>
<form id="generate_report" class="inline" method="post" action="{{ next }}">
<table id="report-name-table">
<caption class="visually-hidden">{% translate "Report names:" %}</caption>
<thead>
<tr>
<th scope="col" colspan="2">
{% translate "Name" %} <span class="nota-bene" aria-hidden>{% translate "(Required)" %}</span>
</th>
<th scope="col">{% translate "Add reference date" %}</th>
</tr>
</thead>
<tbody>
{% for report_name in reports %}
{% with report_id=report_name|slugify %}
<input type="hidden" name="old_report_name" value="{{ report_name }}" />
<tr>
<td>
<div>
<input id="{{ report_id }}"
class="name-input"
name="report_name"
type="text"
value="{{ report_name }}"
required
minlength="3" />
</div>
</td>
<td>
<button type="button"
class="icon ti-arrow-back-up action-button reset-button hidden"
aria-label="{% translate "Reset" %}"></button>
</td>
<td>
<select class="reference-date" name="reference_date">
<option value="">{% translate "No reference date" %}</option>
<option value="%b %d %Y, %H:%M">{% translate "Day" %} ({{ created_at|date:"N jS Y, H:i" }})</option>
<option value="week">{% translate "Week" %} ({% translate "Week" %} {{ created_at|date:"W, Y" }})</option>
<option value="%b, %Y">{% translate "Month" %} ({{ created_at|date:"N, Y" }})</option>
<option value="%Y">{% translate "Year" %} ({{ created_at|date:"Y" }})</option>
</select>
</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
{% csrf_token %}
<button type="submit" form="generate_report">
{% include "forms/report_form_fields.html" %}
{% include "forms/report_form_fields.html" %}

{% if show_listed_report_names %}
{% include "partials/report_names_header.html" %}
{% include "partials/report_names_form.html" %}

<button type="submit" form="generate_report">
{% translate "Generate report" %}<span class="icon ti-chevron-right" aria-hidden="true"></span>
</button>
{% endif %}
{% if is_scheduled_report %}
{% include "partials/report_names_header.html" %}
{% include "partials/form/fieldset.html" with fields=report_parent_name_form %}

{% if reports|length > 1 %}
{% include "partials/form/fieldset.html" with fields=report_child_name_form %}

{% translate "Generate report" %}<span class="icon ti-chevron-right" aria-hidden="true"></span>
</button>
{% endif %}
<button type="submit" form="generate_report">
{% translate "Generate report" %}<span class="icon ti-chevron-right" aria-hidden="true"></span>
</button>
{% endif %}
</form>
{% else %}
{% include "partials/return_button.html" with btn_text="Go back" %}
Expand All @@ -79,5 +63,6 @@ <h2>{% translate "Report name" %}</h2>
{% block html_at_end_body %}
{% compress js %}
<script src="{% static "js/renameReports.js" %}" nonce="{{ request.csp_nonce }}" type="module"></script>
<script src="{% static "js/autoSubmit.js" %}" nonce="{{ request.csp_nonce }}" type="module"></script>
{% endcompress %}
{% endblock html_at_end_body %}
52 changes: 52 additions & 0 deletions rocky/reports/templates/partials/report_names_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{% load i18n %}
{% load static %}
{% load report_extra %}
{% load ooi_extra %}
{% load compress %}

<table id="report-name-table">
<caption class="visually-hidden">{% translate "Report names:" %}</caption>
<thead>
<tr>
<th scope="col" colspan="2">
{% translate "Name" %} <span class="nota-bene" aria-hidden>{% translate "(Required)" %}</span>
</th>
<th scope="col">{% translate "Add reference date" %}</th>
</tr>
</thead>
<tbody>
{% for report_name in reports %}
{% with report_id=report_name|slugify %}
<input type="hidden" name="old_report_name" value="{{ report_name }}" />
<tr>
<td>
<div>
<input id="{{ report_id }}"
class="name-input"
name="report_name"
type="text"
value="{{ report_name }}"
required
minlength="3" />
</div>
</td>
<td>
<button type="button"
class="icon ti-arrow-back-up action-button reset-button hidden"
aria-label="{% translate "Reset" %}"></button>
</td>
<td>
<select class="reference-date" name="reference_date">
<option value="">{% translate "No reference date" %}</option>
<option value="%b %d %Y, %H:%M">{% translate "Day" %} ({{ created_at|date:"N jS Y, H:i" }})</option>
<option value="week">{% translate "Week" %} ({% translate "Week" %} {{ created_at|date:"W, Y" }})</option>
<option value="%b, %Y">{% translate "Month" %} ({{ created_at|date:"N, Y" }})</option>
<option value="%Y">{% translate "Year" %} ({{ created_at|date:"Y" }})</option>
</select>
</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
{% csrf_token %}
11 changes: 11 additions & 0 deletions rocky/reports/templates/partials/report_names_header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% load i18n %}
{% load static %}

<h2>{% translate "Report name" %}</h2>
<p>
{% blocktranslate trimmed %}
Give your report a custom name and optionally add the reports' reference date
to the name. To do so you can select a standard option or use a <a href="https://strftime.org/" target="_blank">Python
strftime code</a> in the report name.
{% endblocktranslate %}
</p>
Loading