UB-ES-2018 / picturest

[DISCONTINUED]
0 stars 1 forks source link

US-04-Backend-Add tag #7

Closed JoseManuelVasquez closed 5 years ago

jordipainan commented 5 years ago

@JoseManuelVasquez

Last hashtag of a text is invalid after processing

Input --> "A new image US-04 #hello #hello2" Output --> [ 'hello', 'hello2"' ] Bug: Output[1]

I suggest to do it with a regular expr. Like:

function findHashtags(searchText) {
    var regexp = /\B\#\w\w+\b/g
    result = searchText.match(regexp);
    if (result) {
        a = []
        result.forEach((tag) => {
            a.push(tag.substring(1, tag.length))
        })
        return a
    } else {
        return []
    }
}

tags = findHashtags(desc)
jordipainan commented 5 years ago

Please review code. Changed route POST to PUT for convenience in endpoint namespace.

jordipainan commented 5 years ago

I didnt comment this before, bug fixing done for Sprint1, just added 2 lines of code, i think its not necessary another branch, so its fine to merge here. Pls put in sprint review ^^

jordipainan commented 5 years ago

This closes #6