<commit_before>/**
 * window.c.ContributionActivities component
 * Render a component that pass on confirmed contributions in 24hours interval
 *
 *
 * Example of use:
 * view: () => {
 *     ...
 *     m.component(c.ContributionActivities)
 *     ...
 * }
 */
window.c.ContributionActivities = ((m, h, models, _) => {
    return {
        controller: (args) => {
            let interval;
            const collection = m.prop([]),
                  resource = m.prop(),
                  collectionIndex = m.prop(0),
                  collectionSize = m.prop(),
                  collectionL = m.postgrest.loader(
                      models.contributionActivity.getPageOptions()),
                  nextResource = () => {
                      if ((collectionIndex() + 1) > collectionSize()) {
                          collectionIndex(0);
                      }

                      collectionIndex(collectionIndex() + 1);
                      resource(collection()[collectionIndex()]);
                      m.redraw();
                  },
                  startConfig = (el, isinitialized, context) => {
                      context.onunload = () => clearInterval(interval);
                  },
                  startTimer = () => {
                      interval = setInterval(nextResource, 15000);
                  };

            collectionL.load().then((data) => {
                collection(data);
                collectionSize(data.length);
                resource(_.first(data));
            });

            startTimer();

            return {
                collection: collection,
                collectionL: collectionL,
                resource: resource,
                collectionSize: collectionSize
            };
        },

        view: (ctrl, args) => {
            if (!ctrl.collectionL() && !_.isUndefined(ctrl.resource()) && (ctrl.collectionSize() || 0) > 0) {
                let resource = ctrl.resource(),
                    elapsed = h.translatedTime(resource.elapsed_time),
                    project_link = `https://catarse.me/${resource.permalink}?ref=ctrse_home_activities`;

                return m('.w-section.section.bg-backs-carrosel', {config: ctrl.startConfig}, [
                    m('.w-container.u-text-center.fontcolor-negative', [
                        m('.fontsize-large.u-marginbottom-30', `há ${elapsed.total} ${elapsed.unit}...`),
                        m('.w-clearfix.w-inline-block.u-marginbottom-10', [
                            m('a', {href: project_link}, [
                                m('img.thumb-author.u-round', {src: resource.thumbnail, width: 80}),
                            ]),
                            m('img.thumb-author.u-round', {src: 'https://daks2k3a4ib2z.cloudfront.net/54b440b85608e3f4389db387/56d646f7710a7126338b46ff_logo-catarse-back-carrosel.png'}),
                            m('a', {href: project_link}, [<commit_msg>use parseInt to avoid float numbers like 33.988898<commit_after>/**
 * window.c.ContributionActivities component
 * Render a component that pass on confirmed contributions in 24hours interval
 *
 *
 * Example of use:
 * view: () => {
 *     ...
 *     m.component(c.ContributionActivities)
 *     ...
 * }
 */
window.c.ContributionActivities = ((m, h, models, _) => {
    return {
        controller: (args) => {
            let interval;
            const collection = m.prop([]),
                  resource = m.prop(),
                  collectionIndex = m.prop(0),
                  collectionSize = m.prop(),
                  collectionL = m.postgrest.loader(
                      models.contributionActivity.getPageOptions()),
                  nextResource = () => {
                      if ((collectionIndex() + 1) > collectionSize()) {
                          collectionIndex(0);
                      }

                      collectionIndex(collectionIndex() + 1);
                      resource(collection()[collectionIndex()]);
                      m.redraw();
                  },
                  startConfig = (el, isinitialized, context) => {
                      context.onunload = () => clearInterval(interval);
                  },
                  startTimer = () => {
                      interval = setInterval(nextResource, 15000);
                  };

            collectionL.load().then((data) => {
                collection(data);
                collectionSize(data.length);
                resource(_.first(data));
            });

            startTimer();

            return {
                collection: collection,
                collectionL: collectionL,
                resource: resource,
                collectionSize: collectionSize
            };
        },

        view: (ctrl, args) => {
            if (!ctrl.collectionL() && !_.isUndefined(ctrl.resource()) && (ctrl.collectionSize() || 0) > 0) {
                let resource = ctrl.resource(),
                    elapsed = h.translatedTime(resource.elapsed_time),
                    project_link = `https://catarse.me/${resource.permalink}?ref=ctrse_home_activities`;

                return m('.w-section.section.bg-backs-carrosel', {config: ctrl.startConfig}, [
                    m('.w-container.u-text-center.fontcolor-negative', [
                        m('.fontsize-large.u-marginbottom-30', `há ${parseInt(elapsed.total)} ${elapsed.unit}...`),
                        m('.w-clearfix.w-inline-block.u-marginbottom-10', [
                            m('a', {href: project_link}, [
                                m('img.thumb-author.u-round', {src: resource.thumbnail, width: 80}),
                            ]),
                            m('img.thumb-author.u-round', {src: 'https://daks2k3a4ib2z.cloudfront.net/54b440b85608e3f4389db387/56d646f7710a7126338b46ff_logo-catarse-back-carrosel.png'}),
                            m('a', {href: project_link}, [
{'fraction_non_alphanumeric': 0.13327688399661303, 'fraction_numerical': 0.021337849280270958, 'mean_word_length': 1.4334569427276473, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 4, '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': '3724225', 'n_tokens_mistral': 1643, 'n_tokens_neox': 1483, 'n_words': 235}