def process_title(self, subject, region, conclusion_type, cell, presence, comment_counts): title = [] title.append( 'Species: {species}, Region: {region}'.format( species=subject, region=region)) if presence['present']: title.append('Reported as present by: ' + presence['present']) if presence['occasional']: title.append('Reported as occasional by: ' + presence['occasional']) title.append('Assessment {type} : {details}'.format( type=conclusion_type, details=COUNTRY_ASSESSMENTS.get(cell['conclusion'], '') )) if current_user.has_role('etc') or current_user.has_role('admin'): title.append('Decision: {main} ({details})'.format( main=cell['main_decision'], details=self.DECISION_DETAILS.get(cell['main_decision'], 'Auto') )) title.append('Method {method} ({details})'.format( method=cell['method'], details=self.METHOD_DETAILS.get(cell['method'], '') )) if current_user.has_role('etc') or current_user.has_role('admin'): comms = get_counts(comment_counts, subject, region) title.append(( "Unread comments for my conclusions: {user}\n" + "Unread comments for all conclusions: {all}\n" + "Unread comments for data sheet info: {wiki}").format(**comms) ) return '\n'.join(title)
def can_preview_progress(): if consultation_ended(): return True if not current_user.is_authenticated(): return False return current_user.has_role('etc') or current_user.has_role('admin')
def hide_adm_etc_username(name): name = name or '' author = (RegisteredUser.query.filter( or_( RegisteredUser.name == name, RegisteredUser.id == name, )).first()) if not (current_user.has_role('etc') or current_user.has_role('admin')): if author: if author.has_role('etc'): name = 'EEA-ETC/BD' elif author.has_role('admin'): name = 'Admin' return name
def hide_adm_etc_username(name): name = name or '' author = ( RegisteredUser.query .filter(or_( RegisteredUser.name == name, RegisteredUser.id == name, )) .first() ) if not (current_user.has_role('etc') or current_user.has_role('admin')): if author: if author.has_role('etc'): name = 'EEA-ETC/BD' elif author.has_role('admin'): name = 'Admin' return name
def can_select_assessor(): if not current_user.is_authenticated(): return False return current_user.has_role('admin')
def can_view_details(): if not current_user.is_authenticated(): return False # return current_user.has_role('etc') or current_user.has_role('admin') return current_user.has_role('admin')