<commit_before>package publicshame

import grails.converters.JSON

class ApiTimeBasedGroupController {

    def getSinceLastTime() {
        String teamId = params.teamId
        def teamFound = Team.findByLookup(teamId)
        if(!teamFound) {
            render ResponseHelper.getResponseForTeamNotFound(response)
        } else if( !params.id ){
            render ResponseHelper.getResponseForError([error: "Missing ID"], 400, response)
        } else if( !((String)params.id).isNumber() ){
            render ResponseHelper.getResponseForError([error: "Invalid ID"], 400, response)
        } else {
            render getNewPostsSinceLastPost(teamFound, ((String)params.id).toInteger())
        }
    }

    JSON getNewPostsSinceLastPost(Team team, Integer lastId) {
        def sinList = []
        def reuseId = lastId
        SinEntry.findAllByTeamAndIdGreaterThan(team, lastId).each {
            sinList << SinEntryHelper.createEntryMap(it)
        }

        if(sinList.size() != 0) {
            reuseId = sinList[sinList.size() - 1].id
        }

        def responseObj = [ sins: sinList]
        responseObj << [ refreshLink: RequestHelper.getBaseURL(request) + "?id=${reuseId}" ]
        return responseObj as JSON
    }
}<commit_msg>Fixed the URL that's generated<commit_after>package publicshame

import grails.converters.JSON

class ApiTimeBasedGroupController {

    def getSinceLastTime() {
        String teamId = params.teamId
        def teamFound = Team.findByLookup(teamId)
        if(!teamFound) {
            render ResponseHelper.getResponseForTeamNotFound(response)
        } else if( !params.id ){
            render ResponseHelper.getResponseForError([error: "Missing ID"], 400, response)
        } else if( !((String)params.id).isNumber() ){
            render ResponseHelper.getResponseForError([error: "Invalid ID"], 400, response)
        } else {
            render getNewPostsSinceLastPost(teamFound, ((String)params.id).toInteger())
        }
    }

    JSON getNewPostsSinceLastPost(Team team, Integer lastId) {
        def sinList = []
        def reuseId = lastId
        SinEntry.findAllByTeamAndIdGreaterThan(team, lastId).each {
            sinList << SinEntryHelper.createEntryMap(it)
            reuseId = reuseId < it.id ? it.id : reuseId
        }

        def responseObj = [ sins: sinList]
        responseObj << [ refreshLink: RequestHelper.getBaseURL(request) + "?id=${reuseId}" ]
        return responseObj as JSON
    }
}
{'fraction_non_alphanumeric': 0.10496568429551877, 'fraction_numerical': 0.005651998385143318, 'mean_word_length': 2.6820208023774144, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2405435', 'n_tokens_mistral': 727, 'n_tokens_neox': 695, 'n_words': 144}