     if not data
         logger.error("Can't find statement for problem " + href)
         return undefined
-    
+
     re = new RegExp '.*view3.php\\?id=\\d+&chapterid=(\\d+)'
     res = re.exec href
     id = res[1]
-    
+
     name = document.getElementsByTagName("title")[0]
     if not name
         logger.error("Can't find name for problem " + href)
         return undefined
-    
+
     text = "<h1>" + name.innerHTML + "</h1>"
     for tag in data
         text += "<div>" + tag.innerHTML + "</div>"
-    
+
     material = new Material
         _id: "p" + id,
         order: order,

        logger.error("Found resource with >2 children " + activity.innerHTML)
        return undefined
    a = activity.children[1]
    
    hrefs = await getProblemsHrefsFromStatements(a.href)
    hrefs2 = await getProblemsHrefsFromStatements(hrefs[0])
    hrefs.splice(0, 0, hrefs2[0])
    
    name = a.innerHTML
    logger.info(name + ": found " + hrefs.length + " problems: " + hrefs.join(" "))
    
    materials = []
    for href, i in hrefs
        materials.push(getProblem(href, i))
        
    materials = await finalizeMaterialsList(materials)
    
    material = new Material
        _id: activity.id
        order: order
        type: "problems"
        text: name
        materials: materials
    await material.upsert()
    return material
    

parseActivity = (activity, order) ->
    if activity.classList.contains("label")

            hrefs.push(tag.href)
        else
            logger.error("Strange link in statements toc: " + tag.href + " " + href)

    return hrefs

parseStatements = (activity, order) ->
