<commit_before>import { AllocationsDAO } from "../data/allocations-dao";

function AllocationsHandler(db) {
    "use strict";

    const allocationsDAO = new AllocationsDAO(db);

    this.displayAllocations = (req, res, next) => {
        // Fix for A4 Insecure DOR -  take user id from session instead of from URL param
        const userId = req.session.userId;

        allocationsDAO.getByUserId(userId, (err, docs) => {
            if (err) return next(err);

            docs.userId = userId; //set for nav menu items

            return res.render("allocations", docs);
        });
    };

    this.displayAllocationsThreshold = (req, res, next) => {

        const userId = req.session.userId;
        const threshold = req.query.threshold || 0;

        allocationsDAO.getThresholdByUserId(userId, threshold, (err, docs) => {

            if (err) return next(err);

            docs.userId = userId; //set for nav menu items

            return res.render("allocations", docs);
        });
    };
}

module.exports = AllocationsHandler;<commit_msg>indentation<commit_after>import {AllocationsDAO} from "../data/allocations-dao";

function AllocationsHandler(db) {
  "use strict";

  const allocationsDAO = new AllocationsDAO(db);

  this.displayAllocations = (req, res, next) => {
    // Fix for A4 Insecure DOR -  take user id from session instead of from URL param
    const userId = req.session.userId;

    allocationsDAO.getByUserId(userId, (err, docs) => {
      if (err) return next(err);

      docs.userId = userId; //set for nav menu items

      return res.render("allocations", docs);
    });
  };

  this.displayAllocationsThreshold = (req, res, next) => {

    const userId = req.session.userId;
    const threshold = req.query.threshold || 0;

    allocationsDAO.getThresholdByUserId(userId, threshold, (err, docs) => {

      if (err) return next(err);

      docs.userId = userId; //set for nav menu items

      return res.render("allocations", docs);
    });
  };
}

module.exports = AllocationsHandler;
{'fraction_non_alphanumeric': 0.12303149606299213, 'fraction_numerical': 0.001968503937007874, 'mean_word_length': 2.771799628942486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '4006021', 'n_tokens_mistral': 625, 'n_tokens_neox': 606, 'n_words': 163}