<commit_before>import idcard from './idcardModel';
import pws from './pwsModel';
import groups from './groupModel';
import config from '../config.json';

// Fill out model, this could be very spammy and slow with a long attendee list
function verbosifyMemberList(groupInfo) {
    var promises = groupInfo.users.map((user) => {
        return pws.get(user.netid).then((u) => {
            return {
                "netid": u.UWNetID,
                "regid": u.UWRegID,
                "preferredName": u.PreferredFirstName + ' ' + u.PreferredSurname
            }
        })
    });
    return Promise.all(promises).then((people) => {
        var imagePromises = people.map((p) => {
            return idcard.getPhoto(p.regid).then((image) => {
                p.base64image = image;
                return p;
            });
        });
        return Promise.all(imagePromises).then((result) => {
            groupInfo.users = result;
            return groupInfo;
        });
    });
    
}

export default {
    add: (cardId) => {
        return idcard.get(cardId).then((regId) => {
            return pws.get(regId).then((result) => {
                return result;
            })
        })
        .then((personDetails) => {
            return groups.addMember("", personDetails.UWNetID).then((result) => {
                return { "updated": true };
            });
        });
    },
    list: () => {
        if(config.registerListVerbose) {
            return groups.getMembers().then(verbosifyMemberList);
        } else {
            return groups.getMembers();
        }
        
    },
    remove: (netid, groupName) => {
        return groups.removeMember(netid, groupName);
    }
}<commit_msg>fix missing photos in verbose output<commit_after>import idcard from './idcardModel';
import pws from './pwsModel';
import groups from './groupModel';
import config from '../config.json';

// Fill out model, this could be very spammy and slow with a long attendee list
function verbosifyMemberList(groupInfo) {
    var promises = groupInfo.users.map((user) => {
        return pws.get(user.netid).then((u) => {
            return {
                "netid": u.UWNetID,
                "regid": u.UWRegID,
                "preferredName": u.PreferredFirstName + ' ' + u.PreferredSurname
            }
        })
    });
    return Promise.all(promises).then((people) => {
        var imagePromises = people.map((p) => {
            return idcard.getPhoto(p.regid).then((image) => {
                p.base64image = image;
                return p;
            })
            .catch(() => {
                return p;
            })
        });
        return Promise.all(imagePromises).then((result) => {
            groupInfo.users = result;
            return groupInfo;
        });
    });
    
}

export default {
    add: (cardId) => {
        return idcard.get(cardId).then((regId) => {
            return pws.get(regId).then((result) => {
                return result;
            })
        })
        .then((personDetails) => {
            return groups.addMember("", personDetails.UWNetID).then((result) => {
                return { "updated": true };
            });
        });
    },
    list: () => {
        if(config.registerListVerbose) {
            return groups.getMembers().then(verbosifyMemberList);
        } else {
            return groups.getMembers();
        }
        
    },
    remove: (netid, groupName) => {
        return groups.removeMember(netid, groupName);
    }
}
{'fraction_non_alphanumeric': 0.13717913331493237, 'fraction_numerical': 0.0011040574109853713, 'mean_word_length': 1.5738636363636365, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 30, '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': '7029937', 'n_tokens_mistral': 1041, 'n_tokens_neox': 1003, 'n_words': 194}