# Path: api/issue_utils.py
# def _get(db, err_id=None, uuid=None):
# def _expand_tags(tags, links, short = False):


from bottle import default_app, route, response, abort
from modules import utils
from modules import OsmSax
from modules.query import fixes_default
from .issue_utils import t2l, _get, _expand_tags
import io, copy
    for fix_index, fix_group in enumerate(marker['fixes'] or []):
      for fix in fix_group:
        if fix['type']:
            found = False
            for e in elems:
                if (e["type"] == data_type[fix['type']] and
                    e["id"] == fix['id']):

                    found = True
                    break
            if not found:
                new_elems.append({"num": fix_index,
                                  "add": _expand_tags(fix['create'], t2l.checkTags(fix['create'])),
                                  "mod": _expand_tags(fix['modify'], t2l.checkTags(fix['modify'])),
                                  "del": _expand_tags(fix['delete'], {}, True),
                                 })

    if version == 2:
        return {
            "lat":lat, "lon":lon,
            "minlat": float(lat) - 0.002, "maxlat": float(lat) + 0.002,
            "minlon": float(lon) - 0.002, "maxlon": float(lon) + 0.002,
            "error_id":marker['id'],
            "title":title and title['auto'], "subtitle":subtitle and subtitle['auto'],
            "b_date":b_date.strftime("%Y-%m-%d"),
            "item":item,
            "class":classs,
            "elems":elems, "new_elems":new_elems,
            "elems_id":','.join(map(lambda elem: elem['type_long'] + str(elem['id']), marker["elems"])),
            "url_help":"" # Keep for retro compatibility

# Path: api/issue_utils.py
# def _get(db, err_id=None, uuid=None):
# def _expand_tags(tags, links, short = False):


# Path: api/issue.py
from bottle import default_app, route, response, abort
from modules import utils
from modules import OsmSax
from modules.query import fixes_default
from .issue_utils import t2l, _get, _expand_tags
import io, copy

    for fix_index, fix_group in enumerate(marker['fixes'] or []):
      for fix in fix_group:
        if fix['type']:
            found = False
            for e in elems:
                if (e["type"] == data_type[fix['type']] and
                    e["id"] == fix['id']):

                    found = True
                    break
            if not found:
                new_elems.append({"num": fix_index,
                                  "add": _expand_tags(fix['create'], t2l.checkTags(fix['create'])),
                                  "mod": _expand_tags(fix['modify'], t2l.checkTags(fix['modify'])),
                                  "del": _expand_tags(fix['delete'], {}, True),
                                 })

    if version == 2:
        return {
            "lat":lat, "lon":lon,
            "minlat": float(lat) - 0.002, "maxlat": float(lat) + 0.002,
            "minlon": float(lon) - 0.002, "maxlon": float(lon) + 0.002,
            "error_id":marker['id'],
            "title":title and title['auto'], "subtitle":subtitle and subtitle['auto'],
            "b_date":b_date.strftime("%Y-%m-%d"),
            "item":item,
            "class":classs,
            "elems":elems, "new_elems":new_elems,
            "elems_id":','.join(map(lambda elem: elem['type_long'] + str(elem['id']), marker["elems"])),
            "url_help":"" # Keep for retro compatibility

        }