add page numbers to deliverables

This commit is contained in:
Min RK 2015-09-08 15:37:24 +02:00
parent 528afe6373
commit d57cfc44dd

View File

@ -134,6 +134,7 @@ def load_pdata(proposal_dir)
deliv_data = File.join(proposal_dir, "#{TARGET}.deliverables") deliv_data = File.join(proposal_dir, "#{TARGET}.deliverables")
workpackages = {} # mapping of workpackage id => wp info workpackages = {} # mapping of workpackage id => wp info
deliverables = {}
File.readlines(pdata).each do |line| File.readlines(pdata).each do |line|
key, *args = split_line line key, *args = split_line line
@ -176,6 +177,14 @@ def load_pdata(proposal_dir)
tasks[name] = {} tasks[name] = {}
end end
tasks[name][key] = value tasks[name][key] = value
when 'deliv'
name, key, value = args
value = transform_value(key, value)
if not deliverables.include? name
deliverables[name] = {}
end
deliverables[name][key] = value
else else
# DEBUG: # DEBUG:
@ -183,14 +192,18 @@ def load_pdata(proposal_dir)
end end
end end
# get deliverable data from proposal.deliverables # get deliverable data, workpackage id from proposal.deliverables
File.readlines(deliv_data).each do |line| File.readlines(deliv_data).each do |line|
args = split_line line args = split_line line
name = args[3]
if deliverables.include? name
deliverable = deliverables[name]
else
deliverable = {}
end
month = args[0].to_i month = args[0].to_i
wpid = scrub_tex(args[7]) deliverable = (deliverables[name] or {}).merge({
deliverable = {
"month" => month, "month" => month,
# deliverables[deliv_id]['month'] = month
# due date is last day of the given month, so subtract one day # due date is last day of the given month, so subtract one day
"due_date" => (START_DATE >> month) - 1, "due_date" => (START_DATE >> month) - 1,
"label" => scrub_tex(args[2]), "label" => scrub_tex(args[2]),
@ -199,9 +212,13 @@ def load_pdata(proposal_dir)
"nature" => transform_value('nature', args[5]), "nature" => transform_value('nature', args[5]),
"title" => scrub_tex(args[6]), "title" => scrub_tex(args[6]),
"lead" => SITES[scrub_tex(args[8])], "lead" => SITES[scrub_tex(args[8])],
} })
wpid = scrub_tex(args[7])
wp = workpackages.values.find {|wp| wp['label'] == wpid} wp = workpackages.values.find {|wp| wp['label'] == wpid}
wp['deliverables'].push(deliverable) wp['deliverables'].push(deliverable)
end
workpackages.values.each do |wp|
wp['deliverables'].sort_by! {|d| d['label']} wp['deliverables'].sort_by! {|d| d['label']}
end end
@ -280,6 +297,8 @@ DELIV_TPL = <<-END
- **Lead Institution:** %{lead} - **Lead Institution:** %{lead}
- **Due:** %{date} (month %{month}) - **Due:** %{date} (month %{month})
- **Nature:** %{nature} - **Nature:** %{nature}
See page %{page} of the [proposal](#{PROPOSAL_URL}) for the full description.
END END
DELIV_MILESTONE_TPL = "# %{title}\n\n#{DELIV_TPL}" DELIV_MILESTONE_TPL = "# %{title}\n\n#{DELIV_TPL}"
@ -329,6 +348,7 @@ def make_deliverable_issue(github, repo, deliverable, workpackage, options)
date: deliverable['due_date'], date: deliverable['due_date'],
month: deliverable['month'], month: deliverable['month'],
nature: deliverable['nature'], nature: deliverable['nature'],
page: deliverable['page'],
} }
puts "\n\nMaking Issue on #{repo}: #{title}" puts "\n\nMaking Issue on #{repo}: #{title}"
puts body puts body
@ -362,6 +382,7 @@ def make_deliverable_milestone(github, repo, deliverable, workpackage)
date: deliverable['due_date'], date: deliverable['due_date'],
month: deliverable['month'], month: deliverable['month'],
nature: deliverable['nature'], nature: deliverable['nature'],
page: deliverable['page'],
} }
milestone = github.create_milestone(repo, title, milestone = github.create_milestone(repo, title,