Skip to content
Snippets Groups Projects
Select Git revision
  • 4c155cc5c6537eb427d453e9321ec589188d9e57
  • master default
  • rtde
  • tmp-gpg-key-workaround-2
  • tmp-gpg-key-workaround
  • 68-git-lfs-error-in-ddeploy-job
  • split-build-and-test
  • 66-jazzy-support
  • 62-deploy-jobs-do-not-pull-files-from-lfs-manual-lfs-pull
  • 62-deploy-jobs-do-not-pull-files-from-lfs-custom-docker-image
  • py3-without-industrial-ci-test
  • 58-add-yolo-pip-package-support
  • 55-collision-between-test-jobs-due-to-dds-autodiscovery-ros2
  • 52-ddeploy-job-failing-when-enforcing-labels-alt-quick-dind-test
  • 48-python3_syntax
  • 46-default-docker-image-name-too-long
  • 45-double-pipeline-triggered-if-merge-request-has-melodic-branch-name
  • 40-repo-is-ros-testing
  • test-badges
  • test-lfs-concept
  • add-packages
21 results

catkin_ws_init.sh

Blame
  • lib.js 1.21 KiB
    // COPYRIGHT: FUNDACIÓN TECNALIA RESEARCH & INNOVATION, 2022.
    
    const inquirer = require("inquirer")
    
    const { promptAssetSelection } = require("@hypercog/utils")
    
    const bidAsset = async (
      apiClient,
      { assetId: paramAssetId, quantity, price }
    ) => {
      const biddableAssets = await apiClient.getBiddableAssets()
    
      const assetId = paramAssetId || (await promptAssetSelection(biddableAssets))
      const assetToBid = biddableAssets.find(({ id }) => id === assetId)
    
      let chosenQuantity = quantity
      if (!quantity) {
        const { inputQuantity } = await inquirer.prompt([
          {
            type: "number",
            name: "inputQuantity",
            message: `Choose an ammount of slag (max: ${assetToBid.quantity} ${assetToBid.units}):`
          }
        ])
        chosenQuantity = inputQuantity
      }
    
      let chosenPrice = price
      if (!price) {
        const { inputPrice } = await inquirer.prompt([
          {
            type: "number",
            name: "inputPrice",
            message: "Provide the offered price (in €):"
          }
        ])
        chosenPrice = inputPrice
      }
    
      await apiClient.bidForAsset(assetId, chosenQuantity, chosenPrice)
      console.log("Bid for slag stock", assetId)
    }
    
    // To be reused as a library in @hypercog/batch-sim
    module.exports = { bidAsset }