Exemplo n.º 1
0
def front_osm():
    if 'osm_token' not in session:
        redirect(url_for('login'))
    user = get_user()
    task_obj = get_or_create_task_for_user(user)
    task = load_task(task_obj.task)
    return render_template('front.html',
                           task=render_task(task),
                           user=user,
                           tobj=task_obj,
                           timeleft=time_until_day_ends())
Exemplo n.º 2
0
 def _print_task(self):
     tg = self._get_tg()
     task_obj = ch.get_or_create_task_for_user(tg.user)
     if task_obj.changeset:
         self.sender.sendMessage(self.t('task_complete'))
     else:
         task = ch.load_task(task_obj.task, self.lang['tasks'])
         self.sender.sendMessage(u'{} {}\n\n{}\n\n{}: {}\n\n{}'.format(
             task['emoji'], task['t_title'], desc_to_markdown(task),
             self.t('time_left'), ch.time_until_day_ends(self.lang),
             self.t('post_changeset')),
                                 parse_mode='Markdown')
Exemplo n.º 3
0
def front():
    user = get_user()
    if not user:
        task = ch.load_task(ch.random_task_for_ip(get_ip()), g.lang['tasks'])
        msg = html_esc(g.lang['please_sign_in']).replace(
            '[', '<a href="' + html_esc(url_for('login')) + '">').replace(
                ']', '</a>')
        return render_template('index.html',
                               task=render_task(task),
                               msg=msg,
                               lang=g.lang)

    task_obj = ch.get_or_create_task_for_user(user)
    task = ch.load_task(task_obj.task, g.lang['tasks'])
    return render_template('front.html',
                           task=render_task(task),
                           user=user,
                           tobj=task_obj,
                           lang=g.lang,
                           timeleft=ch.time_until_day_ends(g.lang))