<commit_before>import { Template } from 'meteor/templating'
import { Auctions, UserData, Currencies } from '/imports/api/indexDB.js'
import { FlowRouter } from 'meteor/staringatlights:flow-router'

import './allAuctions.template.html'

Template.allAuctions.onCreated(function() {
    this.autorun(() => {
        SubsCache.subscribe('auctions')
        SubsCache.subscribe('publicUserData')
        SubsCache.subscribe('approvedcurrencies')
    })

    this.open = new ReactiveVar(true)
    this.closed = new ReactiveVar()
})

Template.allAuctions.helpers({
    highest: function() {
        return this.options.highest || 0
    },
    needsUSD: function(curr) {
        return ~['ETH', 'XMR'].indexOf(curr)
    },
    USDprice: function(curr, amount) {
        let currency = Currencies.findOne({
            currencySymbol: curr
        })

        if (currency && currency.price) {
            return (amount * currency.price).toFixed(2)
        }

        return 0
    },
    pricePerKZR: function() {
        if (this.options.baseCurrency === 'KZR') {
            return ((this.options.highest || 0) / this.options.amount).toFixed(5)
        } else {
            return (this.options.highest || 0) !== 0 ? (this.options.amount / (this.options.highest || 0)).toFixed(5) : '0.00000'
        }
    },
    currency: function() {
        return this.options.baseCurrency === 'KZR' ? this.options.acceptedCurrency : this.options.baseCurrency
    },
    auctions: () => {

        var query = {}


        if (Template.instance().open.get() && Template.instance().closed.get()) {
            var query = {

                $or: [{ closed: true }, { closed: { $exists: false } }]
            }
        } else if (Template.instance().open.get()) {
            var query = {
                closed: null
            }
        } else if (Template.instance().closed.get()) {
            var query = {
                closed: true
            }
        }

        return Auctions.find(_.extend({
            _id: {
                $ne: 'top-currency'
            }
        }, query), {
            sort: {
                'options.timeout': -1<commit_msg>problem: new auctions are missing<commit_after>import { Template } from 'meteor/templating'
import { Auctions, UserData, Currencies } from '/imports/api/indexDB.js'
import { FlowRouter } from 'meteor/staringatlights:flow-router'

import './allAuctions.template.html'

Template.allAuctions.onCreated(function() {
    this.autorun(() => {
        SubsCache.subscribe('auctions')
        SubsCache.subscribe('publicUserData')
        SubsCache.subscribe('approvedcurrencies')
    })

    this.open = new ReactiveVar(true)
    this.closed = new ReactiveVar()
})

Template.allAuctions.helpers({
    highest: function() {
        return this.options.highest || 0
    },
    needsUSD: function(curr) {
        return ~['ETH', 'XMR'].indexOf(curr)
    },
    USDprice: function(curr, amount) {
        let currency = Currencies.findOne({
            currencySymbol: curr
        })

        if (currency && currency.price) {
            return (amount * currency.price).toFixed(2)
        }

        return 0
    },
    pricePerKZR: function() {
        if (this.options.baseCurrency === 'KZR') {
            return ((this.options.highest || 0) / this.options.amount).toFixed(5)
        } else {
            return (this.options.highest || 0) !== 0 ? (this.options.amount / (this.options.highest || 0)).toFixed(5) : '0.00000'
        }
    },
    currency: function() {
        return this.options.baseCurrency === 'KZR' ? this.options.acceptedCurrency : this.options.baseCurrency
    },
    auctions: () => {

        var query = {}


        if (Template.instance().open.get() && Template.instance().closed.get()) {
            var query = {

                $or: [{ closed: true }, { closed: { $exists: false } }]
            }
        } else if (Template.instance().open.get()) {
            var query = {
                closed: {$in: [null,false]} //we should be able to remove null on this later on when data is clean
  
            }
        } else if (Template.instance().closed.get()) {
            var query = {
                closed: true
            }
        }

        return Auctions.find(_.extend({
            _id: {
                $ne: 'top-currency'
            }
        }, query), {
            sort: {
                'options.timeout': -1
{'fraction_non_alphanumeric': 0.14399273222802633, 'fraction_numerical': 0.0072677719736543266, 'mean_word_length': 1.9399198931909212, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6527287', 'n_tokens_mistral': 1339, 'n_tokens_neox': 1269, 'n_words': 251}