{"action":"created","comment":{"url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/comments/98804845","pull_request_review_id":19458876,"id":98804845,"diff_hunk":"@@ -45,60 +52,89 @@ class Observation private (val blueprint:Option[BlueprintBase],\n     case None => realTarget\n   }\n \n+  // REL-2985 requires special handling of the times.\n+  // 2017A and earlier: intTimeParam will be None, and calculatedTimesParam will be defined with progTime.\n+  // If a blueprint exists - which it should - we can calculate the intTime from the progTime and then the rest\n+  // of the observation times from the intTime.\n+  val intTime: Option[TimeAmount] = {\n+    if (intTimeParam.nonEmpty) intTimeParam\n+    else for {\n+      b <- blueprint\n+      c <- Overheads(b)\n+      p <- progTimeParam\n+    } yield c.intTimeFromProgTime(p)\n+  }\n+\n+  // 2017B and later: if the blueprint and the intTime are defined, recalculate the calculatedTimes.\n+  val calculatedTimes: Option[ObservationTimes] =  for {\n+    b <- blueprint\n+    c <- Overheads(b)\n+    t <- intTime\n+  } yield c.calculate(t)\n+\n+  def progTime:  Option[TimeAmount] = calculatedTimes.map(_.progTime)\n+  def partTime:  Option[TimeAmount] = calculatedTimes.map(_.partTime)\n+  def totalTime: Option[TimeAmount] = calculatedTimes.map(_.totalTime)\n+\n   def copy(blueprint:Option[BlueprintBase] = blueprint,\n            condition:Option[Condition] = condition,\n            target:Option[Target] = target,\n-           time:Option[TimeAmount] = time,\n+           intTime:Option[TimeAmount] = intTime,\n+           calculatedTimes:Option[ObservationTimes] = calculatedTimes,\n            band:Band = band,\n            meta:Option[ObservationMeta] = None, // metadata resets to None on copy, by default\n            enabled:Boolean = enabled) =\n-    new Observation(blueprint, condition, target, time, band, meta, enabled)\n+    new Observation(blueprint, condition, target, intTime, calculatedTimes.map(_.progTime), band, meta, enabled)\n \n   def this(m:M.Observation) = this (\n-    Option(m.getBlueprint).map(BlueprintBase(_)),\n-    Option(m.getCondition).map(Condition(_)),\n-    Option(m.getTarget).map(Target(_)),\n-    Option(m.getTime).map(TimeAmount(_)),\n-    Option(m.getBand).getOrElse(M.Band.BAND_1_2),\n-    Option(m.getMeta).map(ObservationMeta(_)),\n-    m.isEnabled\n+      Option(m.getBlueprint).map(BlueprintBase(_)),\n+      Option(m.getCondition).map(Condition(_)),\n+      Option(m.getTarget).map(Target(_)),\n+      Option(m.getIntTime).map(TimeAmount(_)),\n+      Option(m.getProgTime).map(TimeAmount(_)),","path":"bundle/edu.gemini.model.p1/src/main/scala/edu/gemini/model/p1/immutable/Observation.scala","position":102,"original_position":102,"commit_id":"934a1f4426c1dd760ff5d418fac4fd8a3c010724","original_commit_id":"26526d00ba85c08b47e7cae7231a7c4c10e19422","user":{"login":"tpolecat","id":1200131,"avatar_url":"https://avatars.githubusercontent.com/u/1200131?v=3","gravatar_id":"","url":"https://api.github.com/users/tpolecat","html_url":"https://github.com/tpolecat","followers_url":"https://api.github.com/users/tpolecat/followers","following_url":"https://api.github.com/users/tpolecat/following{/other_user}","gists_url":"https://api.github.com/users/tpolecat/gists{/gist_id}","starred_url":"https://api.github.com/users/tpolecat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpolecat/subscriptions","organizations_url":"https://api.github.com/users/tpolecat/orgs","repos_url":"https://api.github.com/users/tpolecat/repos","events_url":"https://api.github.com/users/tpolecat/events{/privacy}","received_events_url":"https://api.github.com/users/tpolecat/received_events","type":"User","site_admin":false},"body":"You can't do much better because you have the exceptional case you have to handle. I would probably do it in terms of `align`:\r\n\r\n```scala\r\n(op1 align op2) map {\r\n  case This(a)    => a.left\r\n  case That(b)    => b.right\r\n  case Both(a, b) => error condition\r\n}\r\n```\r\n","created_at":"2017-02-01T00:22:56Z","updated_at":"2017-02-01T00:22:56Z","html_url":"https://github.com/gemini-hlsw/ocs/pull/1154#discussion_r98804845","pull_request_url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/1154","_links":{"self":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/comments/98804845"},"html":{"href":"https://github.com/gemini-hlsw/ocs/pull/1154#discussion_r98804845"},"pull_request":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/1154"}}},"pull_request":{"url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/1154","id":103956880,"html_url":"https://github.com/gemini-hlsw/ocs/pull/1154","diff_url":"https://github.com/gemini-hlsw/ocs/pull/1154.diff","patch_url":"https://github.com/gemini-hlsw/ocs/pull/1154.patch","issue_url":"https://api.github.com/repos/gemini-hlsw/ocs/issues/1154","number":1154,"state":"open","locked":false,"title":"REL-2985: PIT calculation of observing and calibration overheads","user":{"login":"sraaphorst","id":8795653,"avatar_url":"https://avatars.githubusercontent.com/u/8795653?v=3","gravatar_id":"","url":"https://api.github.com/users/sraaphorst","html_url":"https://github.com/sraaphorst","followers_url":"https://api.github.com/users/sraaphorst/followers","following_url":"https://api.github.com/users/sraaphorst/following{/other_user}","gists_url":"https://api.github.com/users/sraaphorst/gists{/gist_id}","starred_url":"https://api.github.com/users/sraaphorst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sraaphorst/subscriptions","organizations_url":"https://api.github.com/users/sraaphorst/orgs","repos_url":"https://api.github.com/users/sraaphorst/repos","events_url":"https://api.github.com/users/sraaphorst/events{/privacy}","received_events_url":"https://api.github.com/users/sraaphorst/received_events","type":"User","site_admin":false},"body":"This is a substantial change, as described in parent task REL-2925:\r\nhttp://jira.gemini.edu:8080/browse/REL-2925\r\n\r\nPreviously, the user would calculate the program time and enter it into the PIT, and this was included for each observation:\r\n`<observation...><time unit=\"hrs\">1.0</time>...</observation>`\r\nfor example.\r\n\r\nREL-2985 requires the following:\r\n\r\n1. Instead of accepting calculated program time, the PIT must now accept integration time, look up overheads from a table (see the `Overheads` class) based on the instrument configuration, and manually perform the calculations to obtain program time, partner time, and total time.\r\n\r\n2. When importing old proposals, the existing time must be assumed to be program time, and the calculations reversed as per the instructions on REL-2985 to calculate integration time, as this is the parameter that determines the other time values along with the instrument configuration.\r\n\r\nThe instrument configuration parameters can be found here:\r\nhttp://jira.gemini.edu:8080/secure/attachment/13761/nightpartnercal_overheads.xlsx\r\n\r\nThis PR includes the majority of the functionality from the PIT side of things (conversion from older proposals, all calculations, schema changes, and PDF generation changes), but probably still needs some work, including tests for the overheads calculations.\r\n\r\nAdditionally, I am hoping to use this PR as an opportunity to:\r\n\r\n1. Begin a discussion with @swalker2m and @cquiroz regarding what need to be done for ITAC and Phase 2 (REL-2927 and REL-2928 respectively), which are currently unassigned, as this will be necessary for the 2017B release, and may require additional handling from the PIT.\r\n\r\n2. Get feedback on the current changes.","created_at":"2017-01-31T15:21:26Z","updated_at":"2017-02-01T00:22:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8a97aded14a8c60949deef5bbf4343af67e0630","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/1154/commits","review_comments_url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/1154/comments","review_comment_url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gemini-hlsw/ocs/issues/1154/comments","statuses_url":"https://api.github.com/repos/gemini-hlsw/ocs/statuses/934a1f4426c1dd760ff5d418fac4fd8a3c010724","head":{"label":"sraaphorst:pit/REL-2985","ref":"pit/REL-2985","sha":"934a1f4426c1dd760ff5d418fac4fd8a3c010724","user":{"login":"sraaphorst","id":8795653,"avatar_url":"https://avatars.githubusercontent.com/u/8795653?v=3","gravatar_id":"","url":"https://api.github.com/users/sraaphorst","html_url":"https://github.com/sraaphorst","followers_url":"https://api.github.com/users/sraaphorst/followers","following_url":"https://api.github.com/users/sraaphorst/following{/other_user}","gists_url":"https://api.github.com/users/sraaphorst/gists{/gist_id}","starred_url":"https://api.github.com/users/sraaphorst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sraaphorst/subscriptions","organizations_url":"https://api.github.com/users/sraaphorst/orgs","repos_url":"https://api.github.com/users/sraaphorst/repos","events_url":"https://api.github.com/users/sraaphorst/events{/privacy}","received_events_url":"https://api.github.com/users/sraaphorst/received_events","type":"User","site_admin":false},"repo":{"id":24112855,"name":"ocs","full_name":"sraaphorst/ocs","owner":{"login":"sraaphorst","id":8795653,"avatar_url":"https://avatars.githubusercontent.com/u/8795653?v=3","gravatar_id":"","url":"https://api.github.com/users/sraaphorst","html_url":"https://github.com/sraaphorst","followers_url":"https://api.github.com/users/sraaphorst/followers","following_url":"https://api.github.com/users/sraaphorst/following{/other_user}","gists_url":"https://api.github.com/users/sraaphorst/gists{/gist_id}","starred_url":"https://api.github.com/users/sraaphorst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sraaphorst/subscriptions","organizations_url":"https://api.github.com/users/sraaphorst/orgs","repos_url":"https://api.github.com/users/sraaphorst/repos","events_url":"https://api.github.com/users/sraaphorst/events{/privacy}","received_events_url":"https://api.github.com/users/sraaphorst/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sraaphorst/ocs","description":null,"fork":true,"url":"https://api.github.com/repos/sraaphorst/ocs","forks_url":"https://api.github.com/repos/sraaphorst/ocs/forks","keys_url":"https://api.github.com/repos/sraaphorst/ocs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sraaphorst/ocs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sraaphorst/ocs/teams","hooks_url":"https://api.github.com/repos/sraaphorst/ocs/hooks","issue_events_url":"https://api.github.com/repos/sraaphorst/ocs/issues/events{/number}","events_url":"https://api.github.com/repos/sraaphorst/ocs/events","assignees_url":"https://api.github.com/repos/sraaphorst/ocs/assignees{/user}","branches_url":"https://api.github.com/repos/sraaphorst/ocs/branches{/branch}","tags_url":"https://api.github.com/repos/sraaphorst/ocs/tags","blobs_url":"https://api.github.com/repos/sraaphorst/ocs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sraaphorst/ocs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sraaphorst/ocs/git/refs{/sha}","trees_url":"https://api.github.com/repos/sraaphorst/ocs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sraaphorst/ocs/statuses/{sha}","languages_url":"https://api.github.com/repos/sraaphorst/ocs/languages","stargazers_url":"https://api.github.com/repos/sraaphorst/ocs/stargazers","contributors_url":"https://api.github.com/repos/sraaphorst/ocs/contributors","subscribers_url":"https://api.github.com/repos/sraaphorst/ocs/subscribers","subscription_url":"https://api.github.com/repos/sraaphorst/ocs/subscription","commits_url":"https://api.github.com/repos/sraaphorst/ocs/commits{/sha}","git_commits_url":"https://api.github.com/repos/sraaphorst/ocs/git/commits{/sha}","comments_url":"https://api.github.com/repos/sraaphorst/ocs/comments{/number}","issue_comment_url":"https://api.github.com/repos/sraaphorst/ocs/issues/comments{/number}","contents_url":"https://api.github.com/repos/sraaphorst/ocs/contents/{+path}","compare_url":"https://api.github.com/repos/sraaphorst/ocs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sraaphorst/ocs/merges","archive_url":"https://api.github.com/repos/sraaphorst/ocs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sraaphorst/ocs/downloads","issues_url":"https://api.github.com/repos/sraaphorst/ocs/issues{/number}","pulls_url":"https://api.github.com/repos/sraaphorst/ocs/pulls{/number}","milestones_url":"https://api.github.com/repos/sraaphorst/ocs/milestones{/number}","notifications_url":"https://api.github.com/repos/sraaphorst/ocs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sraaphorst/ocs/labels{/name}","releases_url":"https://api.github.com/repos/sraaphorst/ocs/releases{/id}","deployments_url":"https://api.github.com/repos/sraaphorst/ocs/deployments","created_at":"2014-09-16T18:48:19Z","updated_at":"2016-01-11T14:32:59Z","pushed_at":"2017-01-31T21:01:11Z","git_url":"git://github.com/sraaphorst/ocs.git","ssh_url":"git@github.com:sraaphorst/ocs.git","clone_url":"https://github.com/sraaphorst/ocs.git","svn_url":"https://github.com/sraaphorst/ocs","homepage":null,"size":363707,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"gemini-hlsw:develop","ref":"develop","sha":"eb26312c3e3788d8d31f081aaec42fceda66e487","user":{"login":"gemini-hlsw","id":8593735,"avatar_url":"https://avatars.githubusercontent.com/u/8593735?v=3","gravatar_id":"","url":"https://api.github.com/users/gemini-hlsw","html_url":"https://github.com/gemini-hlsw","followers_url":"https://api.github.com/users/gemini-hlsw/followers","following_url":"https://api.github.com/users/gemini-hlsw/following{/other_user}","gists_url":"https://api.github.com/users/gemini-hlsw/gists{/gist_id}","starred_url":"https://api.github.com/users/gemini-hlsw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gemini-hlsw/subscriptions","organizations_url":"https://api.github.com/users/gemini-hlsw/orgs","repos_url":"https://api.github.com/users/gemini-hlsw/repos","events_url":"https://api.github.com/users/gemini-hlsw/events{/privacy}","received_events_url":"https://api.github.com/users/gemini-hlsw/received_events","type":"Organization","site_admin":false},"repo":{"id":23963494,"name":"ocs","full_name":"gemini-hlsw/ocs","owner":{"login":"gemini-hlsw","id":8593735,"avatar_url":"https://avatars.githubusercontent.com/u/8593735?v=3","gravatar_id":"","url":"https://api.github.com/users/gemini-hlsw","html_url":"https://github.com/gemini-hlsw","followers_url":"https://api.github.com/users/gemini-hlsw/followers","following_url":"https://api.github.com/users/gemini-hlsw/following{/other_user}","gists_url":"https://api.github.com/users/gemini-hlsw/gists{/gist_id}","starred_url":"https://api.github.com/users/gemini-hlsw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gemini-hlsw/subscriptions","organizations_url":"https://api.github.com/users/gemini-hlsw/orgs","repos_url":"https://api.github.com/users/gemini-hlsw/repos","events_url":"https://api.github.com/users/gemini-hlsw/events{/privacy}","received_events_url":"https://api.github.com/users/gemini-hlsw/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gemini-hlsw/ocs","description":"Observatory Control Software","fork":false,"url":"https://api.github.com/repos/gemini-hlsw/ocs","forks_url":"https://api.github.com/repos/gemini-hlsw/ocs/forks","keys_url":"https://api.github.com/repos/gemini-hlsw/ocs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gemini-hlsw/ocs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gemini-hlsw/ocs/teams","hooks_url":"https://api.github.com/repos/gemini-hlsw/ocs/hooks","issue_events_url":"https://api.github.com/repos/gemini-hlsw/ocs/issues/events{/number}","events_url":"https://api.github.com/repos/gemini-hlsw/ocs/events","assignees_url":"https://api.github.com/repos/gemini-hlsw/ocs/assignees{/user}","branches_url":"https://api.github.com/repos/gemini-hlsw/ocs/branches{/branch}","tags_url":"https://api.github.com/repos/gemini-hlsw/ocs/tags","blobs_url":"https://api.github.com/repos/gemini-hlsw/ocs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gemini-hlsw/ocs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gemini-hlsw/ocs/git/refs{/sha}","trees_url":"https://api.github.com/repos/gemini-hlsw/ocs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gemini-hlsw/ocs/statuses/{sha}","languages_url":"https://api.github.com/repos/gemini-hlsw/ocs/languages","stargazers_url":"https://api.github.com/repos/gemini-hlsw/ocs/stargazers","contributors_url":"https://api.github.com/repos/gemini-hlsw/ocs/contributors","subscribers_url":"https://api.github.com/repos/gemini-hlsw/ocs/subscribers","subscription_url":"https://api.github.com/repos/gemini-hlsw/ocs/subscription","commits_url":"https://api.github.com/repos/gemini-hlsw/ocs/commits{/sha}","git_commits_url":"https://api.github.com/repos/gemini-hlsw/ocs/git/commits{/sha}","comments_url":"https://api.github.com/repos/gemini-hlsw/ocs/comments{/number}","issue_comment_url":"https://api.github.com/repos/gemini-hlsw/ocs/issues/comments{/number}","contents_url":"https://api.github.com/repos/gemini-hlsw/ocs/contents/{+path}","compare_url":"https://api.github.com/repos/gemini-hlsw/ocs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gemini-hlsw/ocs/merges","archive_url":"https://api.github.com/repos/gemini-hlsw/ocs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gemini-hlsw/ocs/downloads","issues_url":"https://api.github.com/repos/gemini-hlsw/ocs/issues{/number}","pulls_url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls{/number}","milestones_url":"https://api.github.com/repos/gemini-hlsw/ocs/milestones{/number}","notifications_url":"https://api.github.com/repos/gemini-hlsw/ocs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gemini-hlsw/ocs/labels{/name}","releases_url":"https://api.github.com/repos/gemini-hlsw/ocs/releases{/id}","deployments_url":"https://api.github.com/repos/gemini-hlsw/ocs/deployments","created_at":"2014-09-12T14:20:23Z","updated_at":"2016-10-23T00:37:21Z","pushed_at":"2017-01-31T21:01:13Z","git_url":"git://github.com/gemini-hlsw/ocs.git","ssh_url":"git@github.com:gemini-hlsw/ocs.git","clone_url":"https://github.com/gemini-hlsw/ocs.git","svn_url":"https://github.com/gemini-hlsw/ocs","homepage":"","size":363505,"stargazers_count":8,"watchers_count":8,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":1,"forks":16,"open_issues":1,"watchers":8,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/1154"},"html":{"href":"https://github.com/gemini-hlsw/ocs/pull/1154"},"issue":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/issues/1154"},"comments":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/issues/1154/comments"},"review_comments":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/1154/comments"},"review_comment":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/1154/commits"},"statuses":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/statuses/934a1f4426c1dd760ff5d418fac4fd8a3c010724"}}}}
{"actor":{"display_login":"tpolecat"}}