def post(self):
		post_args = self.request.arguments()
		bugId = self.request.get('bug_id')
		bug = Bug.get_by_id(long(bugId))
		issues = []
		if bug:
			if "find_issue" in post_args:
				# Scan for matching issue
				issues = bug.findIssue()
			elif "save_issue" in post_args:
				# Save the entered issue
				issueName = self.request.get('issue')
				if re.search(r"^[0-9]*$", issueName):
					if issueName:
						bug.issueName = long(issueName)
						bug.linked = True
						bug.updateStatusPriority()
					else:
						bug.issueName = None
						bug.linked = False
						bug.status = ''
						bug.priority = ''
					bug.fixed = False
					bug.put()
					logging.debug("Saving issue - value: '" + issueName + "'")
				else:
					logging.warning("Saving issue - non numeric value: '" + issueName + "'")
		else:
			logging.warning("Saving issue - not valid bug ID: '" + bugId + "'")
		single_result = ''
		if len(issues) == 1:
			single_result = issues[0]['id']
		template_values = {'bg': bug, 'issues': issues, 'single_result': single_result}
		path = os.path.join(os.path.dirname(__file__), 'templates/bug_view.html')
		self.response.out.write(template.render(path, template_values))
	def get(self):
		versions = Lst.get('all_version_names_list')
		selectedVersion = self.request.get('filter_version', '')

		crashes = []
		crashes_query = CrashReport.all()
		bugId = self.request.get('bug_id')
		if not bugId and not selectedVersion:
			selectedVersion = versions[0]

		cacheId = "CrashReport"
		if selectedVersion:
			crashes_query.filter("versionName =", selectedVersion)
		if bugId:
			bug = Bug.get_by_id(long(bugId))
			crashes_query.filter("bugKey =", bug)
			cacheId += bugId
			if not selectedVersion:
				versions.insert(0, '')
		cacheId += selectedVersion
		cacheId += "_counter"
		crashes_query.order("-crashTime")

		logging.info("version: " + selectedVersion)
		page = int(self.request.get('page', 0))
		crashes = crashes_query.fetch(20, int(page)*20)
		template_values = {'crashes_list': crashes,
				'versions_list': versions,
				'filter_version': selectedVersion,
				'page_size': 20,
				'page': page,
				'bug_id': bugId}
		path = os.path.join(os.path.dirname(__file__), 'templates/crash_list.html')
		self.response.out.write(template.render(path, template_values))
	def get(self):
		hospital_query = HospitalizedReport.all()
		total_hospital = hospital_query.count()
		hospital_query = HospitalizedReport.all()
		hospital_query.filter('processed =', False)
		sick_hospital = hospital_query.count()

		crashes_query = CrashReport.all()
		bugId = self.request.get('bug_id')
		page = int(self.request.get('page', 0))

		crashes = []
		if bugId:
			bug = Bug.get_by_id(long(bugId))
			crashes_query.filter("bugKey =", bug)
		crashes_query.order("-crashTime")
		total_results = crashes_query.count(1000000)
		last_page = max((total_results - 1) // 20, 0)

		if page > last_page:
			page = last_page
		crashes = crashes_query.fetch(20, int(page)*20)
		template_values = {'crashes_list': crashes,
				'total_results': total_results,
				'page_size': 20,
				'page': page,
				'last_page': last_page,
				'bug_id': bugId,
				'total_hospital': total_hospital,
				'sick_hospital': sick_hospital}
		path = os.path.join(os.path.dirname(__file__), 'templates/crash_list.html')
		self.response.out.write(template.render(path, template_values))
 def get(self):
     bugId = self.request.get('bug_id')
     bug = Bug.get_by_id(long(bugId))
     template_values = {'bg': bug}
     path = os.path.join(os.path.dirname(__file__),
                         'templates/bug_view.html')
     self.response.out.write(template.render(path, template_values))
	def get(self):
		crashes_query = CrashReport.all()
		bugId = self.request.get('bug_id')

		crashes = []
		if bugId:
			bug = Bug.get_by_id(long(bugId))
			crashes_query.filter("bugKey =", bug)
		crashes_query.order("-crashTime")
		total_results = crashes_query.count(1000000)

		crashes = crashes_query.fetch(total_results, 0)
		template_values = {'crashes_list': crashes,
				'total_results': total_results,
				'bug_id': bugId}
		path = os.path.join(os.path.dirname(__file__), 'templates/crash_list.csv')
		self.response.out.write(template.render(path, template_values))
	def get(self):
		versions_query = AppVersion.all()
		versions_query.order("-activeFrom")
		versions_objs = versions_query.fetch(2000)
		versions = [v.name for v in versions_objs]
		versions.insert(0, "all")

		hospital_query = HospitalizedReport.all()
		total_hospital = hospital_query.count()
		hospital_query = HospitalizedReport.all()
		hospital_query.filter('processed =', False)
		sick_hospital = hospital_query.count()

		crashes_query = CrashReport.all()
		bugId = self.request.get('bug_id')
		page = int(self.request.get('page', 0))
		selectedVersion = self.request.get('filter_version', "all")
		logging.info("version: " + selectedVersion)

		crashes = []
		if bugId:
			bug = Bug.get_by_id(long(bugId))
			crashes_query.filter("bugKey =", bug)
		if selectedVersion != "all":
			crashes_query.filter("versionName =", selectedVersion)
		crashes_query.order("-crashTime")
		total_results = crashes_query.count(1000000)
		last_page = max((total_results - 1) // 20, 0)

		if page > last_page:
			page = last_page
		crashes = crashes_query.fetch(20, int(page)*20)
		template_values = {'crashes_list': crashes,
				'versions_list': versions,
				'filter_version': selectedVersion,
				'total_results': total_results,
				'page_size': 20,
				'page': page,
				'last_page': last_page,
				'bug_id': bugId,
				'total_hospital': total_hospital,
				'sick_hospital': sick_hospital}
		path = os.path.join(os.path.dirname(__file__), 'templates/crash_list.html')
		self.response.out.write(template.render(path, template_values))
 def post(self):
     post_args = self.request.arguments()
     bugId = self.request.get('bug_id')
     bug = Bug.get_by_id(long(bugId))
     issues = []
     if bug:
         if "find_issue" in post_args:
             # Scan for matching issue
             issues = bug.findIssue()
         elif "save_issue" in post_args:
             # Save the entered issue
             issueName = self.request.get('issue')
             if re.search(r"^[0-9]*$", issueName):
                 if issueName:
                     bug.issueName = long(issueName)
                     bug.linked = True
                     bug.updateStatusPriority()
                 else:
                     bug.issueName = None
                     bug.linked = False
                     bug.status = ''
                     bug.priority = ''
                 bug.fixed = False
                 bug.put()
                 logging.debug("Saving issue - value: '" + issueName + "'")
             else:
                 logging.warning("Saving issue - non numeric value: '" +
                                 issueName + "'")
     else:
         logging.warning("Saving issue - not valid bug ID: '" + bugId + "'")
     single_result = ''
     if len(issues) == 1:
         single_result = issues[0]['id']
     template_values = {
         'bg': bug,
         'issues': issues,
         'single_result': single_result
     }
     path = os.path.join(os.path.dirname(__file__),
                         'templates/bug_view.html')
     self.response.out.write(template.render(path, template_values))
    def get(self):
        versions = Lst.get('all_version_names_list')
        selectedVersion = self.request.get('filter_version', '')

        crashes = []
        crashes_query = CrashReport.all()
        bugId = self.request.get('bug_id')
        if not bugId and not selectedVersion:
            selectedVersion = versions[0]

        cacheId = "CrashReport"
        if selectedVersion:
            crashes_query.filter("versionName =", selectedVersion)
        if bugId:
            bug = Bug.get_by_id(long(bugId))
            crashes_query.filter("bugKey =", bug)
            cacheId += bugId
            if not selectedVersion:
                versions.insert(0, '')
        cacheId += selectedVersion
        cacheId += "_counter"
        crashes_query.order("-crashTime")

        logging.info("version: " + selectedVersion)
        page = int(self.request.get('page', 0))
        crashes = crashes_query.fetch(20, int(page) * 20)
        template_values = {
            'crashes_list': crashes,
            'versions_list': versions,
            'filter_version': selectedVersion,
            'page_size': 20,
            'page': page,
            'bug_id': bugId
        }
        path = os.path.join(os.path.dirname(__file__),
                            'templates/crash_list.html')
        self.response.out.write(template.render(path, template_values))
	def get(self):
		bugId = self.request.get('bug_id')
		bug = Bug.get_by_id(long(bugId))
		template_values = {'bg': bug}
		path = os.path.join(os.path.dirname(__file__), 'templates/bug_view.html')
		self.response.out.write(template.render(path, template_values))