<commit_before>const express = require('express');
const app = express();
const bodyParser = require('body-parser')
const fs = require('fs');

const SECRET = 'irvine';

app.use(express.static('build'));
app.use(bodyParser.json());

app.get('/guestlist', function(req, res) {
    const dataFile = fs.readFileSync('data.json');
    let guestList = JSON.parse(dataFile);
    guestList._total = guestList.guests.length;
    guestList._responded = guestList.guests.filter((o) => o.attending).length;
    guestList._responsePercentage = Math.floor(guestList._responded / guestList._total * 100);
    res.json(guestList);
});

app.post('/rsvp', function(req, res) {
    const reqData = req.body;
    console.log('Request Data:', reqData);

    if (!reqData.secret || !reqData.firstName || !reqData.lastName || !reqData.attending) {
        res.sendStatus(400); // Bad Request
        return;
    }

    if (reqData.secret.trim().toLowerCase() !== SECRET) {
        res.sendStatus(403); // Forbidden
        return;
    }

    const dataFile = fs.readFileSync('data.json');
    let guestList = JSON.parse(dataFile);<commit_msg>add some meta data to guestlist request<commit_after>const express = require('express');
const app = express();
const bodyParser = require('body-parser')
const fs = require('fs');

const SECRET = 'irvine';

app.use(express.static('build'));
app.use(bodyParser.json());

app.get('/guestlist', function(req, res) {
    const dataFile = fs.readFileSync('data.json');
    let guestList = JSON.parse(dataFile);
    guestList._total = guestList.guests.length;
    guestList._responded = guestList.guests.filter((o) => o.attending).length;
    guestList._attending = guestList.guests.filter((o) => o.attending === 'yes').length;
    guestList._extras = guestList.guests.reduce((a, o, i) => {
        return a + o.extras;
    }, 0);
    guestList._responsePercentage = Math.floor(guestList._responded / guestList._total * 100);
    res.json(guestList);
});

app.post('/rsvp', function(req, res) {
    const reqData = req.body;
    console.log('Request Data:', reqData);

    if (!reqData.secret || !reqData.firstName || !reqData.lastName || !reqData.attending) {
        res.sendStatus(400); // Bad Request
        return;
    }

    if (reqData.secret.trim().toLowerCase() !== SECRET) {
        res.sendStatus(403); // Forbidden
        return;
    }

    const dataFile = fs.readFileSync('data.json');
    let guestList = JSON.parse(dataFile);
{'fraction_non_alphanumeric': 0.16408794788273615, 'fraction_numerical': 0.007736156351791531, 'mean_word_length': 3.706896551724138, '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': '4835706', 'n_tokens_mistral': 809, 'n_tokens_neox': 799, 'n_words': 149}