def resolve_history(self, info, url): versions = PointModel.getFullHistory(url) if (versions): return [ Version(point=version['point'], supportingPoints=version['supportingPoints'], counterPoints=version['counterPoints'], sources=version['sources']) for version in versions ] else: return []
def get(self): pointData = Point.getFullHistory(self.request.get('pointUrl')) template_values = { 'latestPoint': pointData[0]["point"] if pointData else None, 'numPoints': len(pointData) if pointData else 0, 'pointData': pointData, 'user': self.current_user, 'currentArea':self.session.get('currentArea') } path = os.path.join(constants.ROOT, 'templates/pointHistory.html') self.response.headers.add_header('content-type', 'application/json', charset='utf-8') self.response.out.write(json.dumps(template.render(path, template_values)))
def get(self): pointData = Point.getFullHistory(self.request.get('pointUrl')) template_values = { 'latestPoint': pointData[0]["point"] if pointData else None, 'numPoints': len(pointData) if pointData else 0, 'pointData': pointData, 'user': self.current_user, 'currentArea':self.session.get('currentArea'), 'currentAreaDisplayName':self.session.get('currentAreaDisplayName') } self.response.headers["Content-Type"] = 'application/json; charset=utf-8' json_values = { 'historyHTML': self.template_render('pointHistory.html', template_values) } self.response.out.write(json.dumps(json_values))
def get(self): pointData = Point.getFullHistory(self.request.get('pointUrl')) template_values = { 'latestPoint': pointData[0]["point"] if pointData else None, 'numPoints': len(pointData) if pointData else 0, 'pointData': pointData, 'user': self.current_user, 'currentArea': self.session.get('currentArea'), 'currentAreaDisplayName': self.session.get('currentAreaDisplayName') } self.response.headers[ "Content-Type"] = 'application/json; charset=utf-8' json_values = { 'historyHTML': self.template_render('pointHistory.html', template_values) } self.response.out.write(json.dumps(json_values))
def cleanMultipleCurrent(self, pointURL): pointData = Point.getFullHistory(pointURL) lastVersion = 0 message = '' logging.info(pointData) if pointData: # Find the maximum version for fullPoint in pointData: point = fullPoint['point'] if point.version > lastVersion: lastVersion = point.version message = message + 'Last Version is %d. ' % lastVersion # Set anything that is not the maximum version to be not current pointsCleaned = 0 for fullPoint in pointData: point = fullPoint['point'] if point.version < lastVersion: logging.info('V %d ' % point.version) if point.current: point.current = False point.put() pointsCleaned = pointsCleaned + 1 elif point.version == lastVersion: point.current = True point.put() message = message + 'Updated to turn off current on %d versions' % pointsCleaned else: message = 'Unable to retrieve history' template_values = { 'message': message, 'user': self.current_user, 'currentArea': self.session.get('currentArea') } self.response.out.write( self.template_render('message.html', template_values))
def cleanMultipleCurrent(self, pointURL): pointData = Point.getFullHistory(pointURL) lastVersion = 0 message = '' logging.info(pointData) if pointData: # Find the maximum version for fullPoint in pointData: point = fullPoint['point'] if point.version > lastVersion: lastVersion = point.version message = message + 'Last Version is %d. ' % lastVersion # Set anything that is not the maximum version to be not current pointsCleaned = 0 for fullPoint in pointData: point = fullPoint['point'] if point.version < lastVersion: logging.info('V %d ' % point.version) if point.current: point.current = False point.put() pointsCleaned = pointsCleaned + 1 elif point.version == lastVersion: point.current = True point.put() message = message + 'Updated to turn off current on %d versions' % pointsCleaned else: message = 'Unable to retrieve history' template_values = { 'message': message, 'user': self.current_user, 'currentArea':self.session.get('currentArea') } self.response.out.write(self.template_render('message.html', template_values))