<commit_before>View = require './view'

Request = require '../models/Request'

class RequestsView extends View

    templateRequestsActive: require './templates/requestsActive'
    templateRequestsPaused: require './templates/requestsPaused'
    templateRequestsPending: require './templates/requestsPending'
    templateRequestsCleaning: require './templates/requestsCleaning'

    removeRequestTemplate: require './templates/vex/removeRequest'

    initialize: ->
        @lastRequestsFilter = @options.requestsFilter
        @lastRequestsSubFilter = @options.requestsSubFilter

    fetch: ->
        if @lastRequestsFilter is 'active'
            @collection = app.collections.requestsActive

        if @lastRequestsFilter is 'paused'
            @collection = app.collections.requestsPaused

        if @lastRequestsFilter is 'pending'
            @collection = app.collections.requestsPending

        if @lastRequestsFilter is 'cleaning'
            @collection = app.collections.requestsCleaning

        @collection.fetch()

    refresh: ->
        return @ if @$el.find('input[type="search"]').val() isnt '' or @$el.find('[data-sorted-direction]').length

        @fetch(@lastRequestsFilter).done =>
            @render(@lastRequestsFilter, @lastRequestsSubFilter, refresh = true)

        @

    render: (requestsFilter, requestsSubFilter, refresh) =>
        @lastRequestsFilter = requestsFilter
        @lastRequestsSubFilter = requestsSubFilter

        if @lastRequestsFilter is 'active'
            @collection = app.collections.requestsActive
            template = @templateRequestsActive

        if @lastRequestsFilter is 'paused'
            @collection = app.collections.requestsPaused
            template = @templateRequestsPaused

        if @lastRequestsFilter is 'pending'
            @collection = app.collections.requestsPending
            template = @templateRequestsPending

        if @lastRequestsFilter is 'cleaning'
            @collection = app.collections.requestsCleaning
            template = @templateRequestsCleaning<commit_msg>Update requests.coffee<commit_after>View = require './view'

Request = require '../models/Request'

class RequestsView extends View

    templateRequestsActive: require './templates/requestsActive'
    templateRequestsPaused: require './templates/requestsPaused'
    templateRequestsPending: require './templates/requestsPending'
    templateRequestsCleaning: require './templates/requestsCleaning'

    removeRequestTemplate: require './templates/vex/removeRequest'

    initialize: ->
        @lastRequestsFilter = @options.requestsFilter
        @lastRequestsSubFilter = @options.requestsSubFilter

    fetch: ->
        @collection = switch @lastRequestsFilter
            when 'active'
                app.collections.requestsActive
            when 'paused'
                app.collections.requestsPaused
            when 'pending'
                app.collections.requestsPending
            when 'cleaning'
                app.collections.requestsCleaning

        @collection.fetch()

    refresh: ->
        return @ if @$el.find('input[type="search"]').val() isnt '' or @$el.find('[data-sorted-direction]').length

        @fetch(@lastRequestsFilter).done =>
            @render(@lastRequestsFilter, @lastRequestsSubFilter, refresh = true)

        @

    render: (requestsFilter, requestsSubFilter, refresh) =>
        @lastRequestsFilter = requestsFilter
        @lastRequestsSubFilter = requestsSubFilter

        if @lastRequestsFilter is 'active'
            @collection = app.collections.requestsActive
            template = @templateRequestsActive

        if @lastRequestsFilter is 'paused'
            @collection = app.collections.requestsPaused
            template = @templateRequestsPaused

        if @lastRequestsFilter is 'pending'
            @collection = app.collections.requestsPending
            template = @templateRequestsPending

        if @lastRequestsFilter is 'cleaning'
            @collection = app.collections.requestsCleaning
            template = @templateRequestsCleaning
{'fraction_non_alphanumeric': 0.08999755441428223, 'fraction_numerical': 0.0, 'mean_word_length': 2.808193668528864, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5816853', 'n_tokens_mistral': 1003, 'n_tokens_neox': 1005, 'n_words': 207}