EmilStenstrom / mybgg

A template that lets you quickly set up a site for searching and filtering your boardgames.
https://games.emilstenstrom.se
MIT License
61 stars 132 forks source link

Ability to include pre-ordered and want to buy? #8

Closed sgall23 closed 6 years ago

sgall23 commented 6 years ago

This is probably only really specific to me, but I wanted to use this so my group and I can keep track of the games we have pre-ordered and what games we're interested in getting as well. How would I go about adding those options? I don't have much experience or skill with this stuff, so I don't really know where to even begin.

EmilStenstrom commented 6 years ago

Hi! I see three different feature requests here:

  1. You want to filter games that are preordered.
  2. You want to filter games that are on your wishlist
  3. You want to add games from more than one user's collection

Which one of them would you need? All three of them?

sgall23 commented 6 years ago

Sorry, I should've been more clear. My collection on BGG has games I own, preordered, and want to buy. So I'd just like the games I have preordered and want to buy to show up on my site along with the ones I own. And no, I'm the only user. My group just shares the collection so that's why I thought it'd be nice to include preordered and want to buy.

EmilStenstrom commented 6 years ago

I see! I saw your commits to your project, and you are on the right track. The problem is that the parameters in config.json are all applied simultaneously. So you tried filtering on games you both own, have preordered, and are on your wishlist. I think you might get what you want by first just setting preorder: 1 (and none of the other ones), run the script, and then only want_to_buy: 1, and run the script again (no need to commit those changes, you run the script locally anyway).

Of course, that means you wouldn't be able to see which games come from want to buy list, and which ones are preordered...

sgall23 commented 6 years ago

So when I run the scripts for the others ones, it turns out that it erases the other games that were indexed for the other categories. Indexed 25 games in algolia, and removed everything else. How would I stop it from removing the other ones?

EmilStenstrom commented 6 years ago

Ah, didn't remember I added deletion too. It's needed so you can remove a game from BGG, and have it removed from your site too.

So instead, I've added a new way to configure the search parameters in the latest version (be sure to update first!). Try this:

"extra_params": [{"preorder": 1}, {"want_to_buy": 1}]

Specifying a list to extra_params like this means "give me games that are preordered OR want_to_buy". Hope this will work for you!

EmilStenstrom commented 6 years ago

Ah, while i was at it, I added "tags" to games too, so you can see in the search results which game came from which list. Example:

skarmavbild 2018-05-16 kl 10 19 09
sgall23 commented 6 years ago

Thank you so much for the new additions to help this along, I really appreciate it!

Since I'm kinda dumb with this stuff, how should config.json look with "extra_params": [{"preorder": 1}, {"want_to_buy": 1}] added? I'm not exactly sure where to put it.

EmilStenstrom commented 6 years ago

Oh, great question, sorry for being vague:

The default config.json looks like this:

{
    "project": {
        "name": "mybgg",
        "title": ""
    },
    "boardgamegeek": {
        "user_name": "YOUR_BGG_USERNAME",
        "extra_params": {
            "own": 1
        }
    },
    "algolia": {
        "app_id": "YOUR_APP_ID",
        "api_key_search_only": "YOUR_PUBLIC_API_KEY",
        "index_name": "YOUR_INDEX_NAME"
    }
}

My suggestion is to change the dictionary (that's the thing between { and } inside extra_params, so the end results looks like this instead:

{
    "project": {
        "name": "mybgg",
        "title": ""
    },
    "boardgamegeek": {
        "user_name": "YOUR_BGG_USERNAME",
        "extra_params": [
            {"own": 1},
            {"preorder": 1},
            {"want_to_buy": 1}
        ]
    },
    "algolia": {
        "app_id": "YOUR_APP_ID",
        "api_key_search_only": "YOUR_PUBLIC_API_KEY",
        "index_name": "YOUR_INDEX_NAME"
    }
}
sgall23 commented 6 years ago

No worries, not your fault I have no clue what I'm doing. haha

But it worked perfectly. Thank you again for all your help!