<commit_before>package models;
 
import javax.persistence.*;
import java.util.List;

import play.db.jpa.*;
 
@Entity
public class Weight extends Model {
 
    public int kg;
    public int lb;
    
    // date
    
    @ManyToOne
    public User user;

    public Weight(User user, int quantity, String type) {
        
        // add user
        this.user = user;
        
        if (type.equals("kg")) {
            this.kg = quantity;
            this.lb = kgToLb(quantity);
        } else {
            this.kg = lbToKg(quantity);
            this.lb = quantity;
        }
    }
    
    // convenience - default to kg
    public Weight(User user, int quantity) {
        this(user, quantity, "kg");
    }
    
    /*
     * Conversions - always return ints
     */
     
    private int kgToLb(int quantity) {<commit_msg>added date stamp to weight entry<commit_after>package models;
 
import javax.persistence.*;
import java.util.List;
import java.util.Date;

import play.db.jpa.*;
 
@Entity
public class Weight extends Model {
 
    public int kg;
    public int lb;
    public Date date;
    
    @ManyToOne
    public User user;

    public Weight(User user, int quantity, String type) {
        
        // add user
        this.user = user;
        // add date as now
        this.date = new Date();
        
        if (type.equals("kg")) {
            this.kg = quantity;
            this.lb = kgToLb(quantity);
        } else {
            this.kg = lbToKg(quantity);
            this.lb = quantity;
        }
    }
    
    // convenience - default to kg
    public Weight(User user, int quantity) {
        this(user, quantity, "kg");
    }
    
    /*
     * Conversions - always return ints
     */
     
    private int kgToLb(int quantity) {
{'fraction_non_alphanumeric': 0.10272417707150965, 'fraction_numerical': 0.0, 'mean_word_length': 1.6392215568862276, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6501410', 'n_tokens_mistral': 532, 'n_tokens_neox': 519, 'n_words': 150}