Exemple #1
0
    def get(self):
        (template_data,
         template) = get_template('templates/wall_of_shame.html')

        all_users = [k.id() for k in UserProfile.query().fetch(keys_only=True)]
        current_week = (datetime.today() -
                        SnippetHandler.SNIPPET_START_DATE).days / 7

        snippet_stats = {}
        for user in all_users:
            snippet_stats[user] = {}

        all_snippets = []
        RANGE = range(36, current_week)
        for i in RANGE:
            all_snippets.extend(UserSnippet.getAllSnippetsByWeek(i))
        for snippet in all_snippets:
            (week, user) = snippet.getWeekAndUser()
            snippet_stats.setdefault(user, {})[int(week)] = '1'

        all_users_stats = [
            (u, [snippet_stats[u].setdefault(k, '-1') for k in RANGE])
            for u in all_users
        ]

        # We check snippets from last week.
        snippets_good = [
            k.key.id()
            for k in UserSnippet.getAllSnippetsByWeek(current_week - 1)
        ]
        template_data['snippets_good'] = sorted(snippets_good)
        template_data['snippets_bad'] = sorted(
            list(set(all_users) - set(snippets_good)))
        template_data['all_users_stats'] = all_users_stats
        self.response.out.write(template.render(template_data))
Exemple #2
0
	def get(self):
		(template_data, template) = get_template('templates/wall_of_shame.html')
		
		all_users = [k.id() for k in UserProfile.query().fetch(keys_only=True)]
		current_week = (datetime.today() - SnippetHandler.SNIPPET_START_DATE).days / 7

		snippet_stats = {}
		for user in all_users:
			snippet_stats [user] = {}

		all_snippets = []
		RANGE = range(36, current_week)
		for i in RANGE:
			all_snippets.extend(UserSnippet.getAllSnippetsByWeek(i))
		for snippet in all_snippets:
			(week, user) = snippet.getWeekAndUser()
			snippet_stats.setdefault(user, {})[int(week)] = '1'

		all_users_stats = [ (u, [ snippet_stats[u].setdefault(k, '-1') for k in RANGE ]) for u in all_users ]

		# We check snippets from last week.
		snippets_good = [k.key.id() for k in UserSnippet.getAllSnippetsByWeek(current_week-1)]
		template_data['snippets_good'] = sorted(snippets_good)
		template_data['snippets_bad'] = sorted(list(set(all_users) - set(snippets_good)))
		template_data['all_users_stats'] = all_users_stats
		self.response.out.write(template.render(template_data))
Exemple #3
0
	def get(self):
		(template_data, template) = get_template('templates/update_users.html')
		from domain_services import getDomainUsers
		currentUsers = [ k.id() for k in UserProfile.query().fetch(keys_only=True)]
		domainUsers = [ k for k in getDomainUsers() if k['orgUnitPath'] == '/']
		missingUsers = [k for k in domainUsers if k['primaryEmail'] not in currentUsers]
		template_data['new_users'] = [k['primaryEmail'] for k in missingUsers]
		self.response.out.write(template.render(template_data))
Exemple #4
0
 def get(self):
     (template_data, template) = get_template('templates/update_users.html')
     from domain_services import getDomainUsers
     currentUsers = [
         k.id() for k in UserProfile.query().fetch(keys_only=True)
     ]
     domainUsers = [k for k in getDomainUsers() if k['orgUnitPath'] == '/']
     missingUsers = [
         k for k in domainUsers if k['primaryEmail'] not in currentUsers
     ]
     template_data['new_users'] = [k['primaryEmail'] for k in missingUsers]
     self.response.out.write(template.render(template_data))
Exemple #5
0
 def get(self, _week=None):
   current_week = ((datetime.today() - SnippetHandler.SNIPPET_START_DATE).days / 7) - 1
   if _week:
     current_week = int(_week)
   # We get all the snipptet for the week before.
   # 
   snippets = []
   for s in sorted(UserSnippet.getAllSnippetsByWeek(current_week), key=lambda x: x.key.id()):
     snippets.append((s.key.id(), s.content))
   (template_data, template) = get_template('templates/all_snippets.html')
   template_data['snippets'] = snippets
   template_data['prev_week'] = current_week -1
   template_data['next_week'] = current_week +1
   template_data['start_date'] = SnippetHandler.weekRange(current_week)['start']
   template_data['end_date'] = SnippetHandler.weekRange(current_week)['end']
   self.response.out.write(template.render(template_data))
Exemple #6
0
	def get(self):
		if self.request.get('user_email'):
			userProfile = UserProfile.getFromEmail(self.request.get('user_email'))
			if userProfile is None:
				self.abort(404)
		else:
			userProfile = getMyProfile()
		(template_data, template) = get_template('templates/profile.html')
		userProfileData = {}
		profile_data = json.loads(userProfile.profile) if userProfile.profile else {}
		for field in UserProfile.getJsonFields():
			userProfileData[field] = profile_data.setdefault(field, '')
		template_data['user'] = userProfile
		template_data['user_profile'] = userProfileData
		template_data['profileId'] = userProfile.email
		template_data['readonly'] = not(canEditThisProfile(userProfile))
		self.response.out.write(template.render(template_data))
Exemple #7
0
 def get(self):
     if self.request.get('user_email'):
         userProfile = UserProfile.getFromEmail(
             self.request.get('user_email'))
         if userProfile is None:
             self.abort(404)
     else:
         userProfile = getMyProfile()
     (template_data, template) = get_template('templates/profile.html')
     userProfileData = {}
     profile_data = json.loads(
         userProfile.profile) if userProfile.profile else {}
     for field in UserProfile.getJsonFields():
         userProfileData[field] = profile_data.setdefault(field, '')
     template_data['user'] = userProfile
     template_data['user_profile'] = userProfileData
     template_data['profileId'] = userProfile.email
     template_data['readonly'] = not (canEditThisProfile(userProfile))
     self.response.out.write(template.render(template_data))
Exemple #8
0
 def get(self, _week=None):
     current_week = (
         (datetime.today() - SnippetHandler.SNIPPET_START_DATE).days /
         7) - 1
     if _week:
         current_week = int(_week)
     # We get all the snipptet for the week before.
     #
     snippets = []
     for s in sorted(UserSnippet.getAllSnippetsByWeek(current_week),
                     key=lambda x: x.key.id()):
         snippets.append((s.key.id(), s.content))
     (template_data, template) = get_template('templates/all_snippets.html')
     template_data['snippets'] = snippets
     template_data['prev_week'] = current_week - 1
     template_data['next_week'] = current_week + 1
     template_data['start_date'] = SnippetHandler.weekRange(
         current_week)['start']
     template_data['end_date'] = SnippetHandler.weekRange(
         current_week)['end']
     self.response.out.write(template.render(template_data))
Exemple #9
0
 def get(self):
     (template_data, template) = get_template('templates/project.html')
     template_data['project'] = {}
     self.response.out.write(template.render(template_data))
Exemple #10
0
	def get(self, projectId):
		project = Project.getFromId(projectId)
		(template_data, template) = get_template('templates/project.html')
		template_data['project'] = project
		self.response.out.write(template.render(template_data))
Exemple #11
0
	def get(self):
		(template_data, template) = get_template('templates/project.html')
		template_data['project'] = {}
		self.response.out.write(template.render(template_data))
Exemple #12
0
 def get(self):
     (template_data, template) = get_template('templates/main.html')
     template_data['test'] = 'test'
     self.response.out.write(template.render(template_data))
Exemple #13
0
	def get(self):
		(template_data, template) = get_template('templates/all_projects.html')
		all_projects = Project.query().order(Project.title).fetch()
		template_data['projects'] = all_projects
		self.response.out.write(template.render(template_data))
Exemple #14
0
	def get(self):
		(template_data, template) = get_template('templates/main.html')
		template_data['test'] = 'test'
		self.response.out.write(template.render(template_data))
Exemple #15
0
	def get(self):
		govlabUsers = UserProfile.query().order(UserProfile.lname, UserProfile.fname).fetch(limit=50)
		(template_data, template) = get_template('templates/team.html')
		template_data['team'] = govlabUsers 
		self.response.out.write(template.render(template_data))
Exemple #16
0
 def get(self):
     (template_data,
      template) = get_template('templates/project_resource.html')
     self.response.out.write(template.render(template_data))
Exemple #17
0
	def get(self):
		(template_data, template) = get_template('templates/project_resource.html')
		self.response.out.write(template.render(template_data))
Exemple #18
0
 def get(self):
     govlabUsers = UserProfile.query().order(
         UserProfile.lname, UserProfile.fname).fetch(limit=50)
     (template_data, template) = get_template('templates/team.html')
     template_data['team'] = govlabUsers
     self.response.out.write(template.render(template_data))
Exemple #19
0
 def get(self):
     (template_data, template) = get_template('templates/all_projects.html')
     all_projects = Project.query().order(Project.title).fetch()
     template_data['projects'] = all_projects
     self.response.out.write(template.render(template_data))
Exemple #20
0
 def get(self, projectId):
     project = Project.getFromId(projectId)
     (template_data, template) = get_template('templates/project.html')
     template_data['project'] = project
     self.response.out.write(template.render(template_data))