Commit 110b309
authored
Clinics refactoring: clinic setup model relationships (#255)
Switched the storage of clinic vaccination periods from a foreign key-based approach to using embedded objects in the session. This will allow simplification of sessions checking and using values in the vaccination periods during wizard journeys, as well as simplification of providing data to summaryRows, reducing duplication and complexity.
* Reduce dependencies in ClinicVaccinationPeriod
Removed the session_id foreign key and the getter to return the object, as neither was being used.
* Remove references to vaccination period's session ID
* Embed clinic vaccination periods in Session
This is side-by-side with existing array of IDs for now, but will ultimately replace that.
Added add and remove method for these embedded vaccination periods too.
* Replace vaccination period IDs array with embedded periods
Note: this is not a working build; I'm still part way through the wider refactoring of clinic session models.
* Stop creating an empty file of vaccination period data
* Directly access a session's vaccination periods in Nunjucks
Also renamed the Session class's clinicVaccinationPeriods to just vaccinationPeriods.
* Update session with vaccination period details
This commit fixes earlier ones that still had attempts to use ClinicVaccinationPeriod.update (which no longer exists). It also fixes a couple of linter issues.
* Set clinic session vaccinator count correctly
Was previously trying to call a non-existent method that I expected to create but decided against.
* Fix editing of vaccination periods in clinic sessions
Previously, when editing an existing clinic, the addition of a new vaccination period left its vaccinator count uninitialised, which caused an inability to calculate the total number of appointments, littering the UI with NaN in places.1 parent e13ddf6 commit 110b309
8 files changed
Lines changed: 112 additions & 247 deletions
File tree
- app
- controllers
- generators
- models
- views/session/form
- lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
496 | 495 | | |
497 | 496 | | |
498 | 497 | | |
499 | | - | |
| 498 | + | |
500 | 499 | | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | 500 | | |
509 | 501 | | |
510 | 502 | | |
511 | 503 | | |
512 | 504 | | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
| 505 | + | |
518 | 506 | | |
519 | 507 | | |
520 | 508 | | |
| |||
533 | 521 | | |
534 | 522 | | |
535 | 523 | | |
536 | | - | |
537 | | - | |
538 | | - | |
| 524 | + | |
539 | 525 | | |
540 | 526 | | |
541 | 527 | | |
| |||
559 | 545 | | |
560 | 546 | | |
561 | 547 | | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | 548 | | |
574 | 549 | | |
575 | 550 | | |
| |||
597 | 572 | | |
598 | 573 | | |
599 | 574 | | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | 575 | | |
608 | 576 | | |
609 | 577 | | |
| |||
670 | 638 | | |
671 | 639 | | |
672 | 640 | | |
673 | | - | |
| 641 | + | |
674 | 642 | | |
675 | 643 | | |
676 | | - | |
| 644 | + | |
677 | 645 | | |
678 | 646 | | |
679 | 647 | | |
| |||
731 | 699 | | |
732 | 700 | | |
733 | 701 | | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
742 | 705 | | |
743 | 706 | | |
744 | 707 | | |
745 | 708 | | |
746 | 709 | | |
747 | | - | |
| 710 | + | |
748 | 711 | | |
749 | 712 | | |
| 713 | + | |
750 | 714 | | |
751 | 715 | | |
752 | 716 | | |
753 | | - | |
754 | | - | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
762 | 728 | | |
763 | 729 | | |
764 | 730 | | |
765 | 731 | | |
766 | 732 | | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
| 733 | + | |
| 734 | + | |
776 | 735 | | |
777 | 736 | | |
778 | 737 | | |
779 | 738 | | |
780 | | - | |
781 | | - | |
782 | | - | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
790 | 743 | | |
791 | 744 | | |
792 | 745 | | |
793 | 746 | | |
794 | 747 | | |
795 | | - | |
| 748 | + | |
796 | 749 | | |
797 | 750 | | |
798 | 751 | | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
810 | 757 | | |
811 | 758 | | |
812 | 759 | | |
813 | | - | |
| 760 | + | |
814 | 761 | | |
815 | 762 | | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
| 763 | + | |
| 764 | + | |
821 | 765 | | |
822 | 766 | | |
| 767 | + | |
823 | 768 | | |
824 | 769 | | |
825 | 770 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
38 | | - | |
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 9 | + | |
12 | 10 | | |
13 | | - | |
| 11 | + | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
| |||
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
| 28 | + | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 44 | + | |
| 45 | + | |
48 | 46 | | |
49 | 47 | | |
50 | 48 | | |
| |||
57 | 55 | | |
58 | 56 | | |
59 | 57 | | |
60 | | - | |
61 | | - | |
62 | 58 | | |
63 | 59 | | |
0 commit comments