-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from django.utils import timezone | ||
import dramatiq | ||
import logging | ||
|
||
from observation_portal.proposals.models import Proposal | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@dramatiq.actor() | ||
def time_allocation_reminder(): | ||
for proposal in Proposal.current_proposals().filter(active=True): | ||
# Only send an email if we are within 3 months of the end of the semester | ||
# and the proposal has at least one allocation. | ||
if (proposal.current_semester.end - timezone.now()).days <= 93 and \ | ||
len(proposal.current_allocation) > 0: | ||
logger.info('Sending time allocation reminder for {}'.format(proposal)) | ||
proposal.send_time_allocation_reminder() |
50 changes: 50 additions & 0 deletions
50
observation_portal/proposals/templates/proposals/timeallocationreminder.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{% load i18n %} | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<title>Time Allocation Notification</title> | ||
</head> | ||
|
||
<body> | ||
<p> | ||
Dear {{ proposal.pi.first_name}} {{ proposal.pi.last_name }}, | ||
</p> | ||
|
||
<p> | ||
The following table shows your network time allocation and usage of {{ proposal }} so far (through {% now "F j, Y" %}) for | ||
{{ proposal.current_semester }}. Note that the semester ends on | ||
{{ proposal.current_semester.end|date:"F j, Y" }}, and unused time does not carry over. | ||
Also, be aware that the end of the semester generally sees higher contention for observing resources. | ||
</p> | ||
|
||
<table cellpadding=10> | ||
<thead> | ||
<tr> | ||
<th></th><th colspan="3">Hours Allocated</th><th colspan="3">Hours Used</th> | ||
</tr> | ||
<tr> | ||
<th></th><th>Queue</th><th>Time Critical</th><th>Rapid Response</th> | ||
<th>Queue</th><th>Time Critical</th><th>Rapid Response</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for ta in allocations %} | ||
<tr> | ||
<td>{{ ta.instrument_type }}</td> | ||
<td>{{ ta.std_allocation }}</td> | ||
<td>{{ ta.tc_allocation }}</td> | ||
<td>{{ ta.rr_allocation }}</td> | ||
<td>{{ ta.std_time_used|floatformat }}</td> | ||
<td>{{ ta.tc_time_used|floatformat }}</td> | ||
<td>{{ ta.rr_time_used|floatformat }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
<p> | ||
Sincerely,<br/> | ||
LCO Science Support | ||
</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters