Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
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')
Esempio n. 4
0
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')
Esempio n. 5
0
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
Esempio n. 6
0
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
Esempio n. 7
0
def can_select_assessor():
    if not current_user.is_authenticated():
        return False

    return current_user.has_role('admin')
Esempio n. 8
0
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')
Esempio n. 9
0
def can_select_assessor():
    if not current_user.is_authenticated():
        return False

    return current_user.has_role('admin')
Esempio n. 10
0
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')