Skip to content

Commit

Permalink
Merge pull request #92 from lsst-dm/u/womullan/fixceleb
Browse files Browse the repository at this point in the history
 Foreast for celeb
  • Loading branch information
womullan committed Oct 20, 2022
2 parents 172d3d8 + d53bca8 commit ad79f9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions milestones.py
Expand Up @@ -27,6 +27,7 @@ def parse_args():

subparsers = parser.add_subparsers(title="Output targets")

# Celeb uses fdue forecast date
celeb = subparsers.add_parser("celeb", help="Generate celebratory milestones.")
celeb.add_argument("--output", help="Filename for output", default="milestones.rst")
celeb.add_argument("--inc", help="Top or Y", default="Top")
Expand Down
8 changes: 5 additions & 3 deletions milestones/celeb.py
Expand Up @@ -115,6 +115,7 @@ def get_result(self):

def write_html(top_milestones):
# simple html page for inclusion by communications
# uses fdue - forecast date
file_name = "top_milestones.html"
ofile = open(file_name, 'w')

Expand All @@ -141,7 +142,7 @@ def write_html(top_milestones):
'Name</th></tr>', file=ofile)

for m in top_milestones:
date = m.due.strftime('%d-%b-%Y')
date = m.fdue.strftime('%d-%b-%Y')
print(f'<tr><td>{date}</td> '
f'<td>{m.name}</td>'
'</tr>', file=ofile)
Expand All @@ -153,12 +154,13 @@ def write_html(top_milestones):


def write_list(my_section, milestones):
# uses fdue - forecast date
with my_section.bullet_list() as my_list:
for ms in milestones:
with my_list.bullet() as b:
with b.paragraph() as p:
p.write_line(
f"**{ms.due.strftime('%Y-%m-%d')}** : "
f"**{ms.fdue.strftime('%Y-%m-%d')}** : "
f"{ms.name} ({ms.code})"
)

Expand All @@ -173,7 +175,7 @@ def generate_doc(args, milestones):
if ms.celebrate
]

milestones = sorted(milestones, key=lambda ms: ms.due)
milestones = sorted(milestones, key=lambda ms: ms.fdue)

doc = ReSTDocument(options={"tocdepth": 0})
with doc.section("Provenance") as my_section:
Expand Down

0 comments on commit ad79f9e

Please sign in to comment.