def StoreIssueSnapshots(self, cnxn, issues, commit=True):
    'Adds an IssueSnapshot and updates the previous one for each issue.'
    for issue in issues:
        right_now = self._currentTime()
        self.issuesnapshot_tbl.Update(cnxn, delta={'period_end': right_now}, where=[('IssueSnapshot.issue_id = %s', [issue.issue_id]), ('IssueSnapshot.period_end = %s', [settings.maximum_snapshot_period_end])], commit=commit)
        config = self.config_service.GetProjectConfig(cnxn, issue.project_id)
        period_end = settings.maximum_snapshot_period_end
        is_open = tracker_helpers.MeansOpenInProject(tracker_bizobj.GetStatus(issue), config)
        shard = (issue.issue_id % settings.num_logical_shards)
        status = tracker_bizobj.GetStatus(issue)
        status_id = (self.config_service.LookupStatusID(cnxn, issue.project_id, status) or None)
        owner_id = (tracker_bizobj.GetOwnerId(issue) or None)
        issuesnapshot_rows = [(issue.issue_id, shard, issue.project_id, issue.local_id, issue.reporter_id, owner_id, status_id, right_now, period_end, is_open)]
        ids = self.issuesnapshot_tbl.InsertRows(cnxn, ISSUESNAPSHOT_COLS[1:], issuesnapshot_rows, replace=True, commit=commit, return_generated_ids=True)
        issuesnapshot_id = ids[0]
        label_rows = [(issuesnapshot_id, self.config_service.LookupLabelID(cnxn, issue.project_id, label)) for label in tracker_bizobj.GetLabels(issue)]
        self.issuesnapshot2label_tbl.InsertRows(cnxn, ISSUESNAPSHOT2LABEL_COLS, label_rows, replace=True, commit=commit)
        cc_rows = [(issuesnapshot_id, cc_id) for cc_id in tracker_bizobj.GetCcIds(issue)]
        self.issuesnapshot2cc_tbl.InsertRows(cnxn, ISSUESNAPSHOT2CC_COLS, cc_rows, replace=True, commit=commit)
        component_rows = [(issuesnapshot_id, component_id) for component_id in issue.component_ids]
        self.issuesnapshot2component_tbl.InsertRows(cnxn, ISSUESNAPSHOT2COMPONENT_COLS, component_rows, replace=True, commit=commit)
        cnxn.Execute('\n        INSERT INTO IssueSnapshot2Hotlist (issuesnapshot_id, hotlist_id)\n        SELECT %s, hotlist_id FROM Hotlist2Issue WHERE issue_id = %s\n      ', [issuesnapshot_id, issue.issue_id])
Adds an IssueSnapshot and updates the previous one for each issue.
def StoreIssueSnapshots(self, cnxn, issues, commit=True):
    
    for issue in issues:
        right_now = self._currentTime()
        self.issuesnapshot_tbl.Update(cnxn, delta={'period_end': right_now}, where=[('IssueSnapshot.issue_id = %s', [issue.issue_id]), ('IssueSnapshot.period_end = %s', [settings.maximum_snapshot_period_end])], commit=commit)
        config = self.config_service.GetProjectConfig(cnxn, issue.project_id)
        period_end = settings.maximum_snapshot_period_end
        is_open = tracker_helpers.MeansOpenInProject(tracker_bizobj.GetStatus(issue), config)
        shard = (issue.issue_id % settings.num_logical_shards)
        status = tracker_bizobj.GetStatus(issue)
        status_id = (self.config_service.LookupStatusID(cnxn, issue.project_id, status) or None)
        owner_id = (tracker_bizobj.GetOwnerId(issue) or None)
        issuesnapshot_rows = [(issue.issue_id, shard, issue.project_id, issue.local_id, issue.reporter_id, owner_id, status_id, right_now, period_end, is_open)]
        ids = self.issuesnapshot_tbl.InsertRows(cnxn, ISSUESNAPSHOT_COLS[1:], issuesnapshot_rows, replace=True, commit=commit, return_generated_ids=True)
        issuesnapshot_id = ids[0]
        label_rows = [(issuesnapshot_id, self.config_service.LookupLabelID(cnxn, issue.project_id, label)) for label in tracker_bizobj.GetLabels(issue)]
        self.issuesnapshot2label_tbl.InsertRows(cnxn, ISSUESNAPSHOT2LABEL_COLS, label_rows, replace=True, commit=commit)
        cc_rows = [(issuesnapshot_id, cc_id) for cc_id in tracker_bizobj.GetCcIds(issue)]
        self.issuesnapshot2cc_tbl.InsertRows(cnxn, ISSUESNAPSHOT2CC_COLS, cc_rows, replace=True, commit=commit)
        component_rows = [(issuesnapshot_id, component_id) for component_id in issue.component_ids]
        self.issuesnapshot2component_tbl.InsertRows(cnxn, ISSUESNAPSHOT2COMPONENT_COLS, component_rows, replace=True, commit=commit)
        cnxn.Execute('\n        INSERT INTO IssueSnapshot2Hotlist (issuesnapshot_id, hotlist_id)\n        SELECT %s, hotlist_id FROM Hotlist2Issue WHERE issue_id = %s\n      ', [issuesnapshot_id, issue.issue_id])