Tab Mapper

The tab mapper is a handy little tool that will render a guitar tab file with graphic chord diagrams displayed alongside. This comes in handy for people who just don't have every single chord shape memorized. Just plug in the web site address of a valid .tab or .crd file and hit "Go". In general, the tab mapper does a better job with printer friendly URLs. If there is more than one way to play a chord, the tab mapper will choose the most common shape. To see other fingerings, click on the chord diagram and you will be taken to the chord calculator.

Original file located @ https://www.mongodb.com/community/forums/t/problem-updating-multiple-documents-on-different-collections/208017/2.

function delete_game(game) {
  games = games.filter(item => item !== game);
  db.update_listing(game.game_id, {
    p1_score: game.p1.score,
    p2_score: game.p2.score,
    moves: game.moves,
    winner_id: game.winner_id
  }, "game");
  // Update player statistics based on last game (MMR, FILLED CELLS etc)
  db.update_listing([game.p1, game.p2], null, "player_game");
  game = null;
  console.log(`Game deleted. New active game count is: ${games.length}`)
}
async update_listing(_id_listing, _new_listing, _type) {
        let result = null;
        let update_completed = false
        try {
            // Connect the client to the server
            await client.connect();
            // Establish and verify connection
            await client.db("admin").command({ ping: 1 });

            switch(_type) {
                case "player":
                    result = await client.db("game_data").collection("players").updateOne({ _id: ObjectId(_id_listing) }, { $set: _new_listing });
                    console.log(`Sono stati aggiornati ${result.modifiedCount} documenti.`);
                    update_completed = result.modifiedCount > 0 ? true : false;
                    break;
                case "game":
                    result = await client.db("game_data").collection("games").updateOne({ _id: ObjectId(_id_listing) }, { $set: _new_listing });
                    console.log(`Sono stati aggiornati ${result.modifiedCount} documenti.`);
                    update_completed = result.modifiedCount > 0 ? true : false;
                    break;
                case "player_game":
                    for (let i = 0; i < _id_listing.length; ++i) {
                        result = await client.db("game_data").collection("players").updateOne({ _id: ObjectId(_id_listing[i].id) }, { 
                            $inc: {
                                filled_cells: _id_listing[i].filled_cells,
                                stolen_cells: _id_listing[i].stolen_cells,
                                closed_lines: _id_listing[i].closed_lines
                            },
                            $set: {
                                mmr: _id_listing[i].mmr
                            }
                        });
                        console.log(`Sono stati aggiornati ${result.modifiedCount} documenti.`);
                        update_completed = result.modifiedCount > 0 ? true : false;
                    }
                    break;
                default:
                    break;
            }
        }
        catch (e) {
            console.log(e);
            return null;
        }
        finally {
            // Ensures that the client will close when you finish/error
            await client.close();
            console.log("DB disconnected successfully to server");
        }
        return update_completed;
    }
©2024 JGuitar.com