Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "builds" stat that includes skills #194

Open
amoeba opened this issue Aug 26, 2020 · 1 comment
Open

Add "builds" stat that includes skills #194

amoeba opened this issue Aug 26, 2020 · 1 comment

Comments

@amoeba
Copy link
Owner

amoeba commented Aug 26, 2020

I want to create a graph for builds that includes specialized skills and not just creation attributes. So I need to create a pipeline that produces a string like "100/0/100/100/0/0-melee_defense" for grouping.

I almost have it with this but not quite there because the skills aren't sorted:

[{
    $match: {
        "a": {
            "$exists": true
        }
    }
}, {
    $project: {
        sks: {
            "$objectToArray": "$sk"
        }
    }
}, {
    $project: {
        specialized: {
            "$filter": {
                input: "$sks",
                as: "skill",
                cond: {
                    "$eq": ["$$skill.v.training", "Specialized"]
                }
            }
        }
    }
}, {
    $match: {
        "specialized": {
            "$gte": ["$size", 1]
        }
    }
}, {
    $project: {
        specialized: "$specialized.k"
    }
}, {
    $project: {
        "specskillstring": {
            "$reduce": {
                input: "$specialized",
                initialValue: "",
                in: {
                    "$concat": ["$$value", "-", "$$this"]
                }
            }
        }
    }
}]
@amoeba
Copy link
Owner Author

amoeba commented Aug 26, 2020

Tried an approach that starts with $unwind and it takes too long so this isn't a good option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant