models
main.models
¤
Models module for main app.
Classes¤
AnalysisCode
¤
Capacity
¤
Bases: Model
Proportion of working time that team members are able to work on projects.
Classes¤
Meta
¤
Meta class for the model.
Functions¤
__str__()
¤
String representation of the Capacity object.
Source code in main/models.py
663 664 665 | |
Department
¤
Bases: Model
Model to manage the departments.
You can find the faculties and potential departments in:
https://www.imperial.ac.uk/faculties-and-departments/
FullTimeEquivalent
¤
Bases: Model
Full-time-equivalent model for user and projects.
Attributes¤
days
property
¤
Convert FTE to days using the working days in a year in the settings.
Classes¤
Meta
¤
Model metadata.
Functions¤
clean()
¤
Ensure start date comes before end date and that value 0 or positive.
Source code in main/models.py
874 875 876 877 878 879 880 881 882 883 | |
from_days(days, start_date, end_date, **kwargs)
classmethod
¤
Creates an FTE object given a number of days time period.
Source code in main/models.py
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | |
trace(timerange=None)
¤
Convert the FTE to a dataframe.
If timerange is provided, those dates are used, otherwise a datetime index is created using the start and end dates of the FTE object.
Source code in main/models.py
861 862 863 864 865 866 867 868 869 870 871 872 | |
Funding
¤
Bases: Model
Funding associated with a project.
Attributes¤
effort
property
¤
Provide the effort in days, calculated based on the budget and daily rate.
Returns:
| Type | Description |
|---|---|
float
|
The total number of days of effort provided by the funding. |
effort_left
property
¤
Provide the effort left in days.
Returns:
| Type | Description |
|---|---|
float
|
The number of days worth of effort left. |
funding_left
property
¤
Provide the funding left in currency.
Funding left is calculated based on 'Confirmed' monthly charges.
Returns:
| Type | Description |
|---|---|
Decimal
|
The amount of funding left. |
monthly_pro_rata_charge
property
¤
Calculate the charge per month if the project has Pro-rata charging.
Calculates the number of months between project start and end date regardless of the day of the month so the monthly charge will be the same regardless of the number of days in the month.
project_code
property
¤
Provide the project code, containing the cost centre and activity code.
Returns:
| Type | Description |
|---|---|
str
|
The designated project code. |
Classes¤
Meta
¤
Meta class for the model.
Functions¤
__str__()
¤
String representation of the Funding object.
Source code in main/models.py
518 519 520 | |
clean()
¤
Ensure that the activity code has a valid value.
Source code in main/models.py
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
is_complete()
¤
Checks if funding record is complete.
This is only relevant to funding where source is external.
Source code in main/models.py
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | |
MonthlyCharge
¤
Bases: Model
Monthly charge for a specific project, account and analysis code.
Functions¤
__str__()
¤
String representation of the MonthlyCharge object.
Source code in main/models.py
725 726 727 | |
clean()
¤
Ensure the charge has valid funding attached and description if Manual.
Source code in main/models.py
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | |
Project
¤
Bases: Warning, Model
Software project details.
Attributes¤
days_left
property
¤
Provide the days worth of effort left.
Returns:
| Type | Description |
|---|---|
tuple[float, float] | None
|
The number of days and percentage worth of effort left, or None if there is |
tuple[float, float] | None
|
no funding information. |
effort_per_day
property
¤
Calculate the estimated effort per day.
Considers only working (business) days.
Returns:
| Type | Description |
|---|---|
float | None
|
Float representing the estimated effort per day over project lifespan. |
percent_effort_left
property
¤
Provide the percentage of effort left.
Returns:
| Type | Description |
|---|---|
float | None
|
The percentage of effort left, or None if there is no funding information. |
total_effort
property
¤
Provide the total days worth of effort available from funding.
Returns:
| Type | Description |
|---|---|
float | None
|
The total number of days effort, or None if there is no funding information. |
total_funding_left
property
¤
Provide the total funding left after deducting confirmed charges.
Returns:
| Type | Description |
|---|---|
Decimal | None
|
The total monetary amount of funding left, or none if there is no funding |
Decimal | None
|
information. |
total_working_days
property
¤
Provide the total number of working (business) days given the dates.
Returns:
| Type | Description |
|---|---|
int | None
|
Number of working days between the project start and end date. |
weeks_to_deadline
property
¤
Provide the number of weeks left until project deadline.
Only relevant for active projects.
Returns:
| Type | Description |
|---|---|
tuple[int, float] | None
|
The number of weeks left or None if the project is Tentative or Not done. |
Functions¤
__str__()
¤
String representation of the Project object.
Source code in main/models.py
196 197 198 | |
check_and_notify_status()
¤
Check the project status and notify accordingly.
Source code in main/models.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
clean()
¤
Ensure all fields have a value unless status is 'Tentative' or 'Not done'.
It also checks that, if present, the end date is after the start date.
Source code in main/models.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
ProjectPhase
¤
Bases: FullTimeEquivalent
Phases associated with a project.
Functions¤
__str__()
¤
String representation of the ProjectPhase object.
Source code in main/models.py
893 894 895 | |
check_overlapping_phases()
¤
Check the phase doesn't overlap with another phase (by 1 day).
Source code in main/models.py
935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 | |
check_phase_alignment()
¤
Ensures phases are aligned but separated by 1 day.
Source code in main/models.py
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 | |
check_phase_in_project()
¤
Ensure the start phase dates are within the project dates.
Source code in main/models.py
922 923 924 925 926 927 928 929 930 931 932 933 | |
check_project_funding()
¤
Check the project has funding before the phase can be added.
Source code in main/models.py
983 984 985 986 987 988 | |
clean()
¤
Ensures that phase dates are sensible.
Ensures start is before the end date (from FTE clean). Ensures phase within project period. Ensures the phase isn't covered by any other phases. Ensures at least phase start or end date aligns with other phases or project dates. Ensures project has funding before phase added.
Source code in main/models.py
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 | |
save(**kwargs)
¤
Saves the object to the database.
This overwrites models.Model.save() to keep the days constant if the start or
end date changes, modifying the FTE value. Except if value has also changed in
the same modification.
Source code in main/models.py
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | |
TimeEntry
¤
Bases: Model
Time entry for a user.
User
¤
Bases: AbstractUser
Custom user model.