| {"instance_id": "filllabs__dependi__2432031126", "annotation_by": "human", "repo_full_name": "filllabs/dependi", "repo_language": "TypeScript", "language": "typescript", "language_category": "frontend", "base_commit": "9077bdc44f803ddcb1d0c3227b7c63b7b77c58bd", "issue_title": "[Rust] Alert not displayed when minor version is outdated", "issue_body": "**Describe the bug**\r\n```\r\n[dependencies]\r\nuuid = \"1.4\" \r\n```\r\nLast version is 1.10.0, but no alert is displayed (green mark is shown).\r\n\r\n**To Reproduce**\r\nSee above.\r\n\r\n**Expected behavior**\r\nExpected behavior: alert shown (red icon) for minor version (X.Y) number mismatch.\r\n\r\n**Screenshots**\r\nMinor version mismatch isn't detected as shown on screenshot below:\r\n<image>\r\n\r\n\r\n\r\n**Desktop (please complete the following information):**\r\nWindows 10\r\n\r\n**Additional context**\r\nVisual Studio Code v1.91.1 (current)\r\nDependi v0.7.5 (current)\r\n", "images": [{"local_path": "images/issue_2432031126_0.png", "alt": "dependi", "source": "body"}], "image_category": "rendering_result", "relevance_score": 1, "difficulty": "easy", "diff": "diff --git a/vscode/src/core/parsers/TomlParser.ts b/vscode/src/core/parsers/TomlParser.ts\nindex d586def..bde3ed2 100644\n--- a/vscode/src/core/parsers/TomlParser.ts\n+++ b/vscode/src/core/parsers/TomlParser.ts\n@@ -138,9 +138,7 @@ export class TomlParser implements Parser {\n const commentIndex = line.indexOf(\"#\");\n item.key = clearText(line.substring(0, eqIndex));\n item.key = item.key.replace(\".version\", \"\");\n- item.value = clearText(\n- line.substring(eqIndex + 1, commentIndex > -1 ? commentIndex : line.length)\n- );\n+ item.value = line.substring(eqIndex + 1, commentIndex > -1 ? commentIndex : line.length).trim().replace(/^\"|\"$|'/g, '');\n \n if (isBoolean(item.value) || item.value.includes(\"path\")) {\n return undefined;\n@@ -206,7 +204,7 @@ function parseVersionValue(line: string, item: Item) {\n if (isBoolean(found)) {\n return;\n }\n- item.value = clearText(found);\n+ item.value = found;\n item.start = foundAt;\n item.end = item.start + item.value.length;\n }", "diff_files": ["vscode/src/core/parsers/TomlParser.ts"], "diff_status": "ok", "edit_files": ["vscode/src/core/parsers/TomlParser.ts"], "edit_functions": ["vscode/src/core/parsers/TomlParser.ts:parseVersionValue"], "added_functions": [], "supports_function_level": true, "additions": 2, "deletions": 4, "changed_files": 1, "patch_count": 1, "repo_stars": 202, "repo_license": ""} |
| {"instance_id": "heroui-inc__tailwind-variants__1747755915", "annotation_by": "human", "repo_full_name": "heroui-inc/tailwind-variants", "repo_language": "TypeScript", "language": "typescript", "language_category": "frontend", "base_commit": "6df5a52c534844105615a165a1a9f49bc70bff77", "issue_title": "`TWMConfig[\"twMergeConfig\"]` does not allow partial configurations", "issue_body": "<!--\r\n\r\nIf your issue doesn't follow the templates provided, it will be closed without\r\ncomment – no exceptions.\r\n\r\nFor feature requests, please create a \"Discussion\" with the category \"Ideas\":\r\nhttps://github.com/jrgarciadev/tailwind-variants/discussions/new\r\n\r\n-->\r\n\r\n**Describe the bug**\r\n\r\nSince the use of `TWMConfig[\"twMergeConfig\"]` is to be passed to `extendTailwindMerge` that takes configs partially, the type of `TWMConfig[\"twMergeConfig\"]` should be also partial.\r\n\r\n```js\r\nconst twMerge = !isEmptyObject(config.twMergeConfig)\r\n ? extendTailwindMerge(config.twMergeConfig)\r\n : twMergeBase;\r\n```\r\nhttps://github.com/nextui-org/tailwind-variants/blob/main/src/index.js#LL29C24-L29C24\r\n\r\n```js\r\nexport function extendTailwindMerge(\r\n configExtension: Partial<Config> | CreateConfigSubsequent,\r\n ...createConfig: CreateConfigSubsequent[]\r\n) {\r\n return typeof configExtension === 'function'\r\n ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig)\r\n : createTailwindMerge(\r\n () => mergeConfigs(getDefaultConfig(), configExtension),\r\n ...createConfig,\r\n )\r\n}\r\n```\r\nhttps://github.com/dcastil/tailwind-merge/blob/main/src/lib/extend-tailwind-merge.ts#LL8C1-L18C2\r\n\r\n```ts\r\nexport type TWMConfig = {\r\n /**\r\n * Whether to merge the class names with `tailwind-merge` library.\r\n * It's avoid to have duplicate tailwind classes. (Recommended)\r\n * @see https://github.com/dcastil/tailwind-merge/blob/v1.8.1/README.md\r\n * @default true\r\n */\r\n twMerge?: boolean;\r\n /**\r\n * The config object for `tailwind-merge` library.\r\n * @see https://github.com/dcastil/tailwind-merge/blob/v1.8.1/docs/configuration.md\r\n */\r\n twMergeConfig?: TwMergeConfig;\r\n};\r\n```\r\nhttps://github.com/nextui-org/tailwind-variants/blob/main/src/config.d.ts#L20\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n\r\n1. Install the package\r\n2. Pass `tv` an empty configuration object as shown below:\r\n```js\r\ntv(options, {\r\n ...config,\r\n twMerge: true,\r\n twMergeConfig: {},\r\n });\r\n```\r\n3. Now you reproduced the type error.\r\n\r\n\r\n**Expected behavior**\r\n\r\n`TWMConfig[\"twMergeConfig\"]` should be typed partially.\r\n\r\n```ts\r\nexport type TWMConfig = {\r\n /**\r\n * Whether to merge the class names with `tailwind-merge` library.\r\n * It's avoid to have duplicate tailwind classes. (Recommended)\r\n * @see https://github.com/dcastil/tailwind-merge/blob/v1.8.1/README.md\r\n * @default true\r\n */\r\n twMerge?: boolean;\r\n /**\r\n * The config object for `tailwind-merge` library.\r\n * @see https://github.com/dcastil/tailwind-merge/blob/v1.8.1/docs/configuration.md\r\n */\r\n twMergeConfig?: Partial<TwMergeConfig>;\r\n};\r\n```\r\n\r\n**Screenshots**\r\nIf applicable, add screenshots to help explain your problem.\r\n<image>\r\n\r\n**Desktop (please complete the following information):**\r\n\r\nAll desktop environments\r\n\r\n**Smartphone (please complete the following information):**\r\n\r\nAll smartphone environments\r\n\r\n**Additional context**\r\nNone\r\n", "images": [{"local_path": "images/issue_1747755915_0.png", "alt": "image", "source": "body"}], "image_category": "error_message", "relevance_score": 1, "difficulty": "easy", "diff": "diff --git a/src/index.js b/src/index.js\nindex 0d95543..abe2875 100644\n--- a/src/index.js\n+++ b/src/index.js\n@@ -20,7 +20,7 @@ export const cnBase = (...classes) => voidEmpty(classes.flat(Infinity).filter(Bo\n \n export const cn =\n (...classes) =>\n- (config = defaultConfig) => {\n+ (config) => {\n if (!config.twMerge) {\n return cnBase(classes);\n }\n@@ -46,7 +46,7 @@ const joinObjects = (obj1, obj2) => {\n return mergedObj;\n };\n \n-export const tv = (options, config = defaultConfig) => {\n+export const tv = (options, configProp) => {\n const {\n slots: slotProps = {},\n variants: variantsProps = {},\n@@ -55,6 +55,8 @@ export const tv = (options, config = defaultConfig) => {\n defaultVariants: defaultVariantsProps = {},\n } = options;\n \n+ const config = Object.assign({}, defaultConfig, configProp);\n+\n const base = cnBase(options?.extend?.base, options?.base);\n const variants = mergeObjects(variantsProps, options?.extend?.variants);\n const defaultVariants = Object.assign({}, options?.extend?.defaultVariants, defaultVariantsProps);", "diff_files": ["src/index.js"], "diff_status": "ok", "edit_files": ["src/index.js"], "edit_functions": ["src/index.js:tv", "src/index.js:joinObjects", "src/index.js:cn"], "added_functions": [], "supports_function_level": true, "additions": 4, "deletions": 2, "changed_files": 1, "patch_count": 1, "repo_stars": 2926, "repo_license": "MIT"} |
| {"instance_id": "privatenumber__snap-tweet__1139055572", "annotation_by": "human", "repo_full_name": "privatenumber/snap-tweet", "repo_language": "TypeScript", "language": "typescript", "language_category": "frontend", "base_commit": "7866cdff9d1bfba26613b45d14b7c66ecb6001a0", "issue_title": "Produced image/snap doesn't show replies, RT's and likes... instead shows \"Read 10.1k replies\"", "issue_body": "## Bug description\r\n<!--\r\n What did you do? (Provide code in next section)\r\n\r\n What did you expect to happen?\r\n\r\n What happened instead?\r\n\r\n Do you have an error stack-trace?\r\n-->\r\n What did you do? (Provide code in next section)\r\nTook a snap of a tweet of one of the built-in examples. @jack's tweet #20.\r\n\r\n What did you expect to happen?\r\nFor the snap to appear as in the READ.ME on the git page.\r\n\r\n What happened instead?\r\nThe program executes correctly on the CLI.\r\nBut, in the produced snap, instead of there showing an <hr> separator and then the replies, rt's and likes.. there's a button that says Read XX replies.\r\n\r\n Do you have an error stack-trace?\r\nDon't know what this is, but I'll get it if it can be explained to me :)\r\n\r\n## Reproduction\r\n<!--\r\n Provide one of the following:\r\n 1. A code-snippet that reproduces the issue\r\n 2. A reproduction repo that reproduces the issue\r\n 3. A PR with a failing test-case\r\n\r\n Remove irrelevant code to make it easier for others to read and debug.\r\n\r\n -- Why?\r\n The goal is to maximize communication efficiency.\r\n\r\n When an issue is immediately reproducible, others can start debugging instead of following-up with questions.\r\n-->\r\n Provide one of the following:\r\n 1. snap-tweet https://twitter.com/jack/status/20\r\n 2. ??\r\n 3. Sharing snap instead:\r\n\r\n<image>\r\nFYI I am not logged in to twitter on the browser, but I doubt that has any effect.\r\n\r\n## Environment\r\n\r\n- snap-tweet version: snap-tweet/1.2.1 win32-x64 node-v16.14.0\r\n- Operating System: Microsoft Windows 10 Home 10.0.19044 N/A Build 19044\r\n- Node version: v16.14.0\r\n- Package manager (npm/yarn/pnpm) and version: npm 8.5.0 \r\n", "images": [{"local_path": "images/issue_1139055572_0.png", "alt": "snap-tweet-jack-20", "source": "body"}], "image_category": "ui_screenshot", "relevance_score": 1, "difficulty": "easy", "diff": "diff --git a/src/tweet-camera.ts b/src/tweet-camera.ts\nindex cd7c690..c587006 100644\n--- a/src/tweet-camera.ts\n+++ b/src/tweet-camera.ts\n@@ -4,7 +4,6 @@ import CDP from 'chrome-remote-interface';\n import exitHook from 'exit-hook';\n import {\n \tquerySelector,\n-\txpath,\n \twaitForNetworkIdle,\n \thideNode,\n \tscreenshotNode,\n@@ -157,16 +156,31 @@ class TweetCamera {\n \t\tconst { root } = await client.DOM.getDocument();\n \t\tconst tweetContainerNodeId = await querySelector(client.DOM, root.nodeId, '#app > div > div > div:last-child');\n \n-\t\tconst [tweetLinkNodeId] = await xpath(client.DOM, '//a[starts-with(@href, \"https://twitter.com/intent/tweet\")]/..');\n-\n \t\tawait Promise.all([\n \t\t\t// \"Copy link to Tweet\" button\n-\t\t\thideNode(client.DOM, await querySelector(client.DOM, tweetContainerNodeId, '[role=\"button\"]')),\n+\t\t\thideNode(\n+\t\t\t\tclient.DOM,\n+\t\t\t\tawait querySelector(client.DOM, tweetContainerNodeId, '[role=\"button\"]'),\n+\t\t\t),\n \n \t\t\t// Info button - can't use aria-label because of i18n\n-\t\t\thideNode(client.DOM, await querySelector(client.DOM, tweetContainerNodeId, 'a[href$=\"twitter-for-websites-ads-info-and-privacy\"]')),\n-\n-\t\t\tclient.DOM.removeNode({ nodeId: tweetLinkNodeId }),\n+\t\t\thideNode(\n+\t\t\t\tclient.DOM,\n+\t\t\t\tawait querySelector(\n+\t\t\t\t\tclient.DOM,\n+\t\t\t\t\ttweetContainerNodeId,\n+\t\t\t\t\t'a[href$=\"twitter-for-websites-ads-info-and-privacy\"]',\n+\t\t\t\t),\n+\t\t\t),\n+\n+\t\t\t// Remove the \"Read 10K replies\" button\n+\t\t\tclient.DOM.removeNode({\n+\t\t\t\tnodeId: await querySelector(\n+\t\t\t\t\tclient.DOM,\n+\t\t\t\t\ttweetContainerNodeId,\n+\t\t\t\t\t'.css-1dbjc4n.r-kzbkwu.r-1h8ys4a',\n+\t\t\t\t),\n+\t\t\t}),\n \n \t\t\t// Unset max-width to fill window width\n \t\t\tclient.DOM.setAttributeValue({", "diff_files": ["src/tweet-camera.ts"], "diff_status": "ok", "edit_files": ["src/tweet-camera.ts"], "edit_functions": ["src/tweet-camera.ts:TweetCamera.snapTweet"], "added_functions": [], "supports_function_level": true, "additions": 21, "deletions": 7, "changed_files": 1, "patch_count": 1, "repo_stars": 355, "repo_license": "MIT"} |
| {"instance_id": "heroui-inc__tailwind-variants__1744195027", "annotation_by": "human", "repo_full_name": "heroui-inc/tailwind-variants", "repo_language": "TypeScript", "language": "typescript", "language_category": "frontend", "base_commit": "ce043d3dda692954350504d00351c0989ed462e6", "issue_title": "VariantProps are of type `any`", "issue_body": "<!--\r\n\r\nIf your issue doesn't follow the templates provided, it will be closed without\r\ncomment – no exceptions.\r\n\r\nFor feature requests, please create a \"Discussion\" with the category \"Ideas\":\r\nhttps://github.com/jrgarciadev/tailwind-variants/discussions/new\r\n\r\n-->\r\n\r\n**Describe the bug**\r\nWhen using the VariantProps generic all of the returned types are `any` instead of being literals. \r\n\r\n**To Reproduce**\r\n1. Create a basic `tv` function in Typescript that includes variants.\r\n```ts\r\nconst circle = tv({\r\n variants: {\r\n size: {\r\n md: [\"w-[580px] h-[580px]\"],\r\n lg: [\"w-[1280px] h-[1280px]\"],\r\n },\r\n contrast: {\r\n low: [\"bg-gray-100\", \"dark:bg-purple-900\"],\r\n high: [\"bg-gray-200\", \"dark:bg-purple-800\"],\r\n },\r\n },\r\n defaultVariants: {\r\n size: \"md\",\r\n contrast: \"high\",\r\n },\r\n})\r\n```\r\n2. Import and use the VariantProps generic \r\n```ts\r\ntype CircleType = VariantProps<typeof circle> \r\n```\r\n3. Check intellisense on either type, or component, and see `any`\r\n<image>\r\n<image>\r\n\r\n\r\n**Expected behavior**\r\nvariant props to be literals. ie: `size: 'md' | 'lg'`\r\n\r\n**Screenshots**\r\nScreenshots are added above in description\r\n\r\n**Desktop (please complete the following information):**\r\n\r\n- OS: Mac 12.6.6\r\n- Browser: Not applicable\r\n- Typescript Version: 5.1\r\n\r\n**Smartphone (please complete the following information):**\r\n\r\n- Device: n/a\r\n- OS: n/a\r\n- Browser: n/a\r\n- Version: n/a\r\n\r\n**Additional context**\r\nThe actual `tv` function isn't strongly typed either. I can add whatever I want to `defaultVariants` whether its a variant or not. \r\n", "images": [{"local_path": "images/issue_1744195027_0.png", "alt": "Screen Shot 2023-06-06 at 9 16 56 AM", "source": "body"}, {"local_path": "images/issue_1744195027_1.png", "alt": "Screen Shot 2023-06-06 at 9 16 26 AM", "source": "body"}], "image_category": "code_screenshot", "relevance_score": 1, "difficulty": "easy", "diff": "diff --git a/src/index.d.ts b/src/index.d.ts\nindex 1cd9ec4..62f918d 100644\n--- a/src/index.d.ts\n+++ b/src/index.d.ts\n@@ -267,7 +267,8 @@ export declare const tv: TV;\n \n export declare const defaultConfig: TVConfig;\n \n-export type VariantProps<Component extends (...args: any) => any> = Omit<\n- OmitUndefined<Parameters<Component>[0]>,\n- \"class\" | \"className\"\n->;\n+export type VariantProps<T> = T extends {variants: infer V}\n+ ? V extends TVVariantsDefault<any, undefined>\n+ ? {[K in TVVariantKeys<V, any>[number]]?: keyof V[K]}\n+ : never\n+ : never;", "diff_files": ["src/index.d.ts"], "diff_status": "ok", "edit_files": ["src/index.d.ts"], "edit_functions": [], "added_functions": [], "supports_function_level": true, "additions": 5, "deletions": 4, "changed_files": 1, "patch_count": 1, "repo_stars": 2926, "repo_license": "MIT"} |
| {"instance_id": "SDClowen__RSBot__1446535193", "annotation_by": "human", "repo_full_name": "SDClowen/RSBot", "repo_language": "C#", "language": "c#", "language_category": "backend", "base_commit": "8d1319685d30ac68b7822788bd8e3131b2ca1436", "issue_title": "South Alexandria town loop bug[Bug]", "issue_body": "**Version (please complete the following information):**\r\n - SRO version: Vietnam \r\n - RSBot version: 2.5.1\r\n\r\n**Describe the bug**\r\nSouth Alexandria town loop doesn't work if you wear low durability item, and you have \"back to town if durability low\" ticked on\r\n\r\nBot will think it's outside town on its way to storage and use recall scroll\r\n\r\n**To reproduce the behavior:**\r\nSteps to reproduce the behavior:\r\n1. Set south Alexandria as your recall point\r\n2. Activate \"back to town if durability low\" in protection tab\r\n3. Fight monsters till your durability is low\r\n4. Bot will automatically recall to town and activate town loop\r\n5. On the way to storage NPC bot will think it's outside town and recall again\r\n\r\n\r\n**(Optional) Screenshots**\r\nIt starts to recall around here <image>\r\n", "images": [{"local_path": "images/issue_1446535193_0.png", "alt": "sro_client_CB3f6ZrCwV", "source": "body"}], "image_category": "behavior_demo", "relevance_score": 1, "difficulty": "easy", "diff": "diff --git a/Dependencies/Scripts/Towns/23088.rbs b/Dependencies/Scripts/Towns/23088.rbs\nindex 0d25a167..3f12855e 100644\n--- a/Dependencies/Scripts/Towns/23088.rbs\n+++ b/Dependencies/Scripts/Towns/23088.rbs\n@@ -9,14 +9,16 @@ move 1173 857 863 48 90\n move 1173 993 863 48 90\n move 1228 1072 863 48 90\n buy NPC_SD_M_AREA_ACCESSORY\n-move 1321 1171 863 48 90\n-move 1432 1262 863 48 90\n-move 1564 1351 863 48 90\n-move 1836 1237 863 48 90\n-move 1908 1196 863 48 90\n-move 136 1101 785 49 90\n-move 138 959 789 49 90\n-move 284 840 786 49 90\n+move 1299 1162 863 48 90\n+move 1370 1252 863 48 90\n+move 1505 1344 863 48 90\n+move 1623 1343 863 48 90\n+move 1751 1308 863 48 90\n+move 1860 1268 863 48 90\n+move 1918 1233 863 48 90\n+move 60 1186 843 49 90\n+move 164 1114 785 49 90\n+move 305 859 786 49 90\n store NPC_SD_M_AREA_WAREHOUSE\n move 429 1041 785 49 90\n move 515 1128 814 49 90", "diff_files": ["Dependencies/Scripts/Towns/23088.rbs"], "diff_status": "ok", "edit_files": ["Dependencies/Scripts/Towns/23088.rbs"], "edit_functions": [], "added_functions": [], "supports_function_level": false, "additions": 10, "deletions": 8, "changed_files": 1, "patch_count": 1, "repo_stars": 146, "repo_license": "AGPL-3.0"} |
| {"instance_id": "OpenEnergyPlatform__ontology__2307825533", "annotation_by": "ai", "repo_full_name": "OpenEnergyPlatform/ontology", "repo_language": "Python", "language": "python", "language_category": "", "base_commit": "a5c2995508ba4f894b5158b7424a727e415b9879", "issue_title": "check warnings in building routine", "issue_body": "## Description of the issue\r\nThere occured a couple of warnings in the [building routine](https://github.com/OpenEnergyPlatform/ontology/actions/runs/9172004175) of the latest release.\r\n\r\n\r\n\r\nToDo: check if there is a need to update the routines.\r\n\r\n## Ideas of solution\r\n\r\nIf you already have ideas for the solution describe them here\r\n\r\n## Workflow checklist\r\n\r\n- [ ] I am aware of the [workflow](https://github.com/OpenEnergyPlatform/ontology/blob/dev/CONTRIBUTING.md) for this repository\r\n\r\n", "images": [{"local_path": "images/issue_2307825533_0.png", "source": "body", "alt": ""}], "image_category": "log_output", "relevance_score": 2, "difficulty": "easy", "diff": "diff --git a/.github/workflows/automated-testing.yml b/.github/workflows/automated-testing.yml\nindex 9e10fed78..d29d1a2c4 100644\n--- a/.github/workflows/automated-testing.yml\n+++ b/.github/workflows/automated-testing.yml\n@@ -4,8 +4,8 @@ jobs:\n build:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/checkout@v2\n- - uses: actions/setup-java@v2\n+ - uses: actions/checkout@v4\n+ - uses: actions/setup-java@v4\n with:\n distribution: 'adopt'\n java-version: '11'\n@@ -19,7 +19,7 @@ jobs:\n - name: verify\n run: |\n java -jar build/robot.jar verify --input build/oeo/$(cat VERSION)/oeo-full.owl --queries tests/verify/*\n- - uses: actions/upload-artifact@master\n+ - uses: actions/upload-artifact@v4\n with:\n name: build-artifacts\n path: build/oeo\n@@ -27,16 +27,16 @@ jobs:\n runs-on: ubuntu-latest\n needs: build\n steps:\n- - uses: actions/checkout@v2\n+ - uses: actions/checkout@v4\n - uses: actions/setup-python@v4\n with:\n python-version: '3.7.17'\n architecture: x64\n- - uses: actions/setup-java@v2\n+ - uses: actions/setup-java@v4\n with:\n distribution: 'adopt'\n java-version: '11'\n- - uses: actions/download-artifact@master\n+ - uses: actions/download-artifact@v4\n with:\n name: build-artifacts\n path: build/oeo\n@@ -68,7 +68,7 @@ jobs:\n exit 1\n - name: Upload Ontology\n if: always()\n- uses: actions/upload-artifact@v3\n+ uses: actions/upload-artifact@v4\n with:\n name: build-files\n path: |\n@@ -82,7 +82,7 @@ jobs:\n # bash tests/competency_questions/run_questions.sh \"java -jar build/hermit.jar\" $(pwd)/build/oeo/$(cat VERSION)/oeo-full.owl false\n - name: Upload Artifacts\n if: always()\n- uses: actions/upload-artifact@v3\n+ uses: actions/upload-artifact@v4\n with:\n name: test-report\n path: build/report.json\n@@ -94,7 +94,7 @@ jobs:\n BRANCH_NAME=\"${PATHS[1]}_${PATHS[2]}\"\n echo \"BRANCH=$(echo ${BRANCH_NAME})\" >> $GITHUB_ENV\n - name: Coverage Badge\n- uses: schneegans/dynamic-badges-action@v1.0.0\n+ uses: schneegans/dynamic-badges-action@v1.7.0\n with:\n auth: ${{ secrets.GIST_SECRET }}\n gistID: 6d00affa9fbc89c79684d62091d96551", "diff_files": [".github/workflows/automated-testing.yml"], "diff_status": "ok", "edit_files": [".github/workflows/automated-testing.yml"], "edit_functions": [], "added_functions": [], "supports_function_level": false, "additions": 0, "deletions": 0, "changed_files": 1, "patch_count": 1, "repo_stars": 0, "repo_license": ""} |
| {"instance_id": "lancaster-university__codal-microbit-v2__1046002728", "annotation_by": "human", "repo_full_name": "lancaster-university/codal-microbit-v2", "repo_language": "C++", "language": "c++", "language_category": "systems", "base_commit": "bd5e46eb78cf41029e678f07915a2fbe06d003f6", "issue_title": "if a `uBit.sleep()` is used followed by `target_wait_us()` the delays do not match", "issue_body": "I expect the 4ms resolution of `uBit.sleep()` as that is the ticker configuration, however it'd expect `target_wait_us()` to not have this limitation as it spin waits using the timer peripheral.\r\n\r\nTo test via pin toggle with a logic analyser we can first confirm that `target_wait_us()` works fine on its own:\r\n\r\n```cpp\r\nwhile (true) {\r\n uBit.io.P15.setDigitalValue(1);\r\n target_wait_us(4000);\r\n uBit.io.P15.setDigitalValue(0);\r\n target_wait_us(5000);\r\n uBit.io.P15.setDigitalValue(1);\r\n target_wait_us(6000);\r\n uBit.io.P15.setDigitalValue(0);\r\n target_wait_us(7000);\r\n uBit.io.P15.setDigitalValue(1);\r\n target_wait_us(8000);\r\n uBit.io.P15.setDigitalValue(0);\r\n target_wait_us(9000);\r\n}\r\n```\r\n\r\nIgnoring the inaccuracy of `target_wait_us` (4ms delay is measured as 3.85ms), we can clearly see the delay increasing proportionaly:\r\n<image>\r\n\r\n\r\nAdding a `uBit.sleep(4)`, as that is minimum delay due to the 4ms ticket, with each `target_wait_us()` and the results change (measurement results added in the comments of this snippet):\r\n```cpp\r\nwhile (true) {\r\n uBit.io.P15.setDigitalValue(1);\r\n // This delay is 7.85ms -> looks \"fine\", similar inaccuracy as the previous test\r\n uBit.sleep(4);\r\n target_wait_us(4000);\r\n uBit.io.P15.setDigitalValue(0);\r\n // This delay is 8.95ms -> this looks good too\r\n uBit.sleep(4);\r\n target_wait_us(5000);\r\n uBit.io.P15.setDigitalValue(1);\r\n // This delay is ~13ms ❌\r\n uBit.sleep(4);\r\n target_wait_us(6000);\r\n uBit.io.P15.setDigitalValue(0);\r\n // This delay is ~13ms ❌\r\n uBit.sleep(4);\r\n target_wait_us(7000);\r\n uBit.io.P15.setDigitalValue(1);\r\n // This delay is ~13ms ❌\r\n uBit.sleep(4);\r\n target_wait_us(8000);\r\n uBit.io.P15.setDigitalValue(0);\r\n // This delay is ~13ms -> I guess this is finally correct\r\n uBit.sleep(4);\r\n target_wait_us(9000);\r\n uBit.io.P15.setDigitalValue(1);\r\n // This delay is ~17ms ❌\r\n uBit.sleep(4);\r\n target_wait_us(10000);\r\n\r\n // Stay low for 40ms to easily find the start of the next iteration\r\n uBit.io.P15.setDigitalValue(0);\r\n uBit.sleep(40);\r\n}\r\n```\r\n\r\n<image>\r\n", "images": [{"local_path": "images/issue_1046002728_0.png", "alt": "image", "source": "body"}, {"local_path": "images/issue_1046002728_1.png", "alt": "Screenshot 2021-11-05 at 15 23 07", "source": "body"}], "image_category": "data_visualization", "relevance_score": 1, "difficulty": "easy", "diff": "diff --git a/model/MicroBit.h b/model/MicroBit.h\nindex f1106ebf..089d585e 100644\n--- a/model/MicroBit.h\n+++ b/model/MicroBit.h\n@@ -215,8 +215,13 @@ namespace codal\n *\n * @param milliseconds the amount of time, in ms, to wait for. This number cannot be negative.\n *\n- * @return MICROBIT_OK on success, MICROBIT_INVALID_PARAMETER milliseconds is less than zero.\n+ * @code\n+ * uBit.sleep(20); //sleep for 20ms\n+ * @endcode\n *\n+ * @note This operation is currently limited by the rate of the system timer, therefore\n+ * the granularity of the sleep operation is limited to 4 ms, unless the rate of\n+ * the system timer is modified.\n */\n void sleep(uint32_t milliseconds);\n \n@@ -289,8 +294,13 @@ namespace codal\n *\n * @param milliseconds the amount of time, in ms, to wait for. This number cannot be negative.\n *\n- * @return MICROBIT_OK on success, MICROBIT_INVALID_PARAMETER milliseconds is less than zero.\n+ * @code\n+ * uBit.sleep(20); //sleep for 20ms\n+ * @endcode\n *\n+ * @note This operation is currently limited by the rate of the system timer, therefore\n+ * the granularity of the sleep operation is limited to 4 ms, unless the rate of\n+ * the system timer is modified.\n */\n inline void MicroBit::sleep(uint32_t milliseconds)\n {", "diff_files": ["model/MicroBit.h"], "diff_status": "ok", "edit_files": ["model/MicroBit.h"], "edit_functions": [], "added_functions": [], "supports_function_level": true, "additions": 12, "deletions": 2, "changed_files": 1, "patch_count": 1, "repo_stars": 51, "repo_license": "MIT"} |
| {"instance_id": "sfepy__sfepy__2350500234", "annotation_by": "human", "repo_full_name": "sfepy/sfepy", "repo_language": "Python", "language": "python", "language_category": "backend", "base_commit": "200ed7a04de5ac9052cd6f07ebdb25a289a27354", "issue_title": "search function is broken for docs", "issue_body": "Hi,\r\nI really like the sfepy docs, but it seems that the search function is broken.\r\nCould you please look into this?\r\nE.g. when searching https://sfepy.org/doc-devel/search.html?q=neumann&check_keywords=yes&area=default\r\n\r\nI see a problem in the Javascript console related to jQuery:\r\n<image>\r\n\r\nThank you for your help!\r\nRegards,\r\nFlorian\r\n", "images": [{"local_path": "images/issue_2350500234_0.png", "alt": "image", "source": "body"}], "image_category": "error_message", "relevance_score": 1, "difficulty": "medium", "diff": "diff --git a/doc/conf.py b/doc/conf.py\nindex 415d676a3..e5fc94e8d 100644\n--- a/doc/conf.py\n+++ b/doc/conf.py\n@@ -43,10 +43,16 @@\n \n # Add any Sphinx extension module names here, as strings. They can be extensions\n # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\n-extensions = ['sphinx.ext.autosummary', 'sphinx.ext.autodoc',\n- 'sphinx.ext.doctest', 'sphinx.ext.imgmath',\n- 'sphinx.ext.viewcode', 'numpydoc',\n- 'gen_field_table', 'gen_term_table', 'gen_solver_table',\n+extensions = ['sphinx.ext.autosummary',\n+ 'sphinx.ext.autodoc',\n+ 'sphinx.ext.doctest',\n+ 'sphinx.ext.imgmath',\n+ 'sphinx.ext.viewcode',\n+ 'sphinxcontrib.jquery',\n+ 'numpydoc',\n+ 'gen_field_table',\n+ 'gen_term_table',\n+ 'gen_solver_table',\n 'IPython.sphinxext.ipython_console_highlighting',\n 'IPython.sphinxext.ipython_directive',\n ]\ndiff --git a/doc/developer_guide.rst b/doc/developer_guide.rst\nindex a76245818..f134b153e 100644\n--- a/doc/developer_guide.rst\n+++ b/doc/developer_guide.rst\n@@ -519,7 +519,8 @@ How to Regenerate Documentation\n \n The following steps summarize how to regenerate this documentation.\n \n-#. Install `sphinx`_ and `numpydoc`_. Do not forget to set the path to numpydoc\n+#. Install `sphinx`_, `numpydoc`_, `sphinx-rtd-theme`_ and `IPython`_.\n+ Do not forget to set the path to numpydoc\n in site_cfg.py if it is not installed in a standard location for Python\n packages on your platform. A recent :math:`\\mbox{\\LaTeX}` distribution is\n required, too, for example `TeX Live`_. Depending on your OS/platform, it", "diff_files": ["doc/conf.py", "doc/developer_guide.rst"], "diff_status": "ok", "edit_files": ["doc/conf.py", "doc/developer_guide.rst"], "edit_functions": [], "added_functions": [], "supports_function_level": true, "additions": 12, "deletions": 5, "changed_files": 2, "patch_count": 2, "repo_stars": 807, "repo_license": "BSD-3-Clause"} |
| {"instance_id": "Anarios__return-youtube-dislike__1404291208", "annotation_by": "ai", "repo_full_name": "Anarios/return-youtube-dislike", "repo_language": "TypeScript", "language": "typescript", "language_category": "", "base_commit": "de1831f2c74032f8ccfe42a8eb174088363e011f", "issue_title": "YouTube's changed their UI (-_-)", "issue_body": "### Browser\r\n\r\nGoogle Chrome\r\n\r\n### Browser Version\r\n\r\nVersion 106.0.5249.103 (Official Build) (64-bit)\r\n\r\n### Extension or Userscript?\r\n\r\nExtension\r\n\r\n### Extension/Userscript Version\r\n\r\n3.0.0.6\r\n\r\n### Video link where you see the problem\r\n\r\nhttps://www.youtube.com/watch?v=AmekhRy8f7E\r\n\r\n### What happened?\r\n\r\nYouTube Changed their UI, and it now causes a few graphical interferences with most of the customisations in the plugin.\r\n\r\n### How to reproduce/recreate?\r\n\r\n1. Click on a video.\r\n2. Scroll down.\r\n\r\n\r\n\r\n\r\n### Will you be available for follow-up questions to help developers diagnose & fix the issue?\r\n\r\nYes", "images": [{"local_path": "images/issue_1404291208_2.png", "source": "body", "alt": ""}], "image_category": "ui_screenshot", "relevance_score": 1, "difficulty": "medium", "diff": "diff --git a/Extensions/combined/content-style.css b/Extensions/combined/content-style.css\nindex d8da7db1e..4e53f87fe 100644\n--- a/Extensions/combined/content-style.css\n+++ b/Extensions/combined/content-style.css\n@@ -30,12 +30,21 @@\n }\n \n .ryd-tooltip {\n- position: relative;\n display: block;\n height: 2px;\n+}\n+\n+.ryd-tooltip-old-design {\n+ position: relative;\n top: 9px;\n }\n \n+.ryd-tooltip-new-design {\n+ position: absolute;\n+ bottom: -10px;\n+ left: -4px;\n+}\n+\n .ryd-tooltip-bar-container {\n width: 100%;\n height: 2px;\n@@ -44,3 +53,12 @@\n padding-bottom: 12px;\n top: -6px;\n }\n+\n+/* required to make the ratio bar visible in the new design */\n+ytd-menu-renderer.ytd-watch-metadata {\n+ overflow-y: visible !important;\n+}\n+\n+#top-level-buttons-computed {\n+ position: relative !important;\n+}\ndiff --git a/Extensions/combined/src/bar.js b/Extensions/combined/src/bar.js\nindex 930f0f525..ebf9ad8fe 100644\n--- a/Extensions/combined/src/bar.js\n+++ b/Extensions/combined/src/bar.js\n@@ -57,14 +57,12 @@ function createRateBar(likes, dislikes) {\n \n (\n document.getElementById(\n- isNewDesign() ? \"actions-inner\" : \"menu-container\"\n+ isNewDesign() ? \"top-level-buttons-computed\" : \"menu-container\"\n ) || document.querySelector(\"ytm-slim-video-action-bar-renderer\")\n ).insertAdjacentHTML(\n \"beforeend\",\n `\n- <div class=\"ryd-tooltip\" style=\"width: ${widthPx}px${\n- isNewDesign() ? \"; margin-bottom: -2px\" : \"\"\n- }\">\n+ <div class=\"ryd-tooltip ryd-tooltip-${isNewDesign() ? \"new\" : \"old\"}-design\" style=\"width: ${widthPx}px\">\n <div class=\"ryd-tooltip-bar-container\">\n <div\n id=\"ryd-bar-container\"", "diff_files": ["Extensions/combined/content-style.css", "Extensions/combined/src/bar.js"], "diff_status": "ok", "edit_files": ["Extensions/combined/content-style.css", "Extensions/combined/src/bar.js"], "edit_functions": ["Extensions/combined/src/bar.js:createRateBar"], "added_functions": [], "supports_function_level": true, "additions": 0, "deletions": 0, "changed_files": 2, "patch_count": 1, "repo_stars": 0, "repo_license": ""} |
| {"instance_id": "AnnoDesigner__anno-designer__713712983", "annotation_by": "human", "repo_full_name": "AnnoDesigner/anno-designer", "repo_language": "C#", "language": "c#", "language_category": "backend", "base_commit": "c414f0d3d7ffd6f462bacd83f46b923ec44dfe7e", "issue_title": "Fualy range Base of Operations (1404)", "issue_body": "> The influence radius is not quite right in Anno 1404.\r\nThe influence area of Base of Operations (3x3, 18 Range) is 4 tiles larger in the program than in the game\r\nAnd in the program you can place 6 houses along the Base of Operations in one direction but in game you can only place 5, the sixth one will be out of range. Thats the real problem\r\n\r\n<image>\r\n\r\nReported by Lywzc on Discord ", "images": [{"local_path": "images/issue_713712983_0.png", "alt": "afbeelding", "source": "body"}], "image_category": "data_visualization", "relevance_score": 1, "difficulty": "medium", "diff": "diff --git a/AnnoDesigner/Models/LayoutObject.cs b/AnnoDesigner/Models/LayoutObject.cs\nindex b4aebd03..f3c3c46d 100644\n--- a/AnnoDesigner/Models/LayoutObject.cs\n+++ b/AnnoDesigner/Models/LayoutObject.cs\n@@ -374,8 +374,19 @@ public double GetScreenRadius(int gridSize)\n {\n if (_screenRadius == default || _lastGridSizeForScreenRadius != gridSize)\n {\n- _screenRadius = _coordinateHelper.GridToScreen(WrappedAnnoObject.Radius, gridSize);\n+ // Buildings of an odd-numbered size (3x3/3x5 etc) draw their circular influence range with an additional +0.5,\n+ // this is not correct and needs to be adjusted to produce the correct radius for those buildings.\n+ // See https://github.com/AnnoDesigner/anno-designer/issues/299 for an explanation of the issue.\n \n+ // check if Object Width and Height are odd numbers or not, if both are, adjust the circle size with -0.1\n+ if ((WrappedAnnoObject.Size.Width %2 != 0 ) && (WrappedAnnoObject.Size.Height %2 != 0)) \n+ {\n+ _screenRadius = _coordinateHelper.GridToScreen(WrappedAnnoObject.Radius - 0.1, gridSize);\n+ }\n+ else\n+ {\n+ _screenRadius = _coordinateHelper.GridToScreen(WrappedAnnoObject.Radius, gridSize);\n+ }\n _lastGridSizeForScreenRadius = gridSize;\n }\n \n@@ -436,7 +447,7 @@ public Rect GridInfluenceRangeRect\n {\n if (_gridInfluenceRangeRect == default)\n {\n- if (WrappedAnnoObject.InfluenceRange == 0)\n+ if (WrappedAnnoObject.InfluenceRange <= 0)\n {\n _gridInfluenceRangeRect = new Rect(Position, default(Size));\n }\ndiff --git a/Tests/AnnoDesigner.Tests/LayoutObjectTests.cs b/Tests/AnnoDesigner.Tests/LayoutObjectTests.cs\nnew file mode 100644\nindex 00000000..d0d44a03\n--- /dev/null\n+++ b/Tests/AnnoDesigner.Tests/LayoutObjectTests.cs\n@@ -0,0 +1,129 @@\n+using System;\n+using System.Collections.Generic;\n+using System.Linq;\n+using System.Text;\n+using System.Threading.Tasks;\n+using System.Windows;\n+using AnnoDesigner.Core.Models;\n+using AnnoDesigner.Helper;\n+using AnnoDesigner.Models;\n+using Xunit;\n+\n+namespace AnnoDesigner.Tests\n+{\n+ public class LayoutObjectTests\n+ {\n+ private static readonly ICoordinateHelper coordinateHelper;\n+\n+ static LayoutObjectTests()\n+ {\n+ coordinateHelper = new CoordinateHelper();\n+ }\n+\n+ #region GridInfluenceRangeRect tests\n+\n+ [Theory]\n+ [InlineData(0)]\n+ [InlineData(-1)]\n+ [InlineData(-0.001)]\n+ public void GridInfluenceRangeRect_InfluenceRangeIsZeroOrNegative_ShouldReturnEmptyRect(double influenceRangeToSet)\n+ {\n+ // Arrange\n+ var annoObject = new AnnoObject\n+ {\n+ InfluenceRange = influenceRangeToSet,\n+ Size = new Size(10, 10),\n+ Position = new Point(42, 42)\n+ };\n+ var layoutObject = new LayoutObject(annoObject, null, null, null);\n+\n+ // Act\n+ var influenceRangeRect = layoutObject.GridInfluenceRangeRect;\n+\n+ // Assert\n+ Assert.Equal(annoObject.Position, influenceRangeRect.Location);\n+ Assert.Equal(default(Size), influenceRangeRect.Size);\n+ }\n+\n+ #endregion\n+\n+ #region GetScreenRadius tests\n+\n+ [Theory]\n+ [InlineData(5, 5, 99)]\n+ [InlineData(3, 3, 99)]\n+ [InlineData(5.5, 5.5, 99)]\n+ public void GetScreenRadius_SizeHeightAndWidthAreOdd_ShouldAdjustRadius(double widthToSet, double heightToSet, double expectedRadius)\n+ {\n+ // Arrange \n+ var annoObject = new AnnoObject\n+ {\n+ Size = new Size(widthToSet, heightToSet),\n+ Radius = 10\n+ };\n+ var layoutObject = new LayoutObject(annoObject, coordinateHelper, null, null);\n+\n+ // Act\n+ var screenRadius = layoutObject.GetScreenRadius(10);\n+\n+ // Assert\n+ Assert.Equal(expectedRadius, screenRadius);\n+ }\n+\n+ [Fact]\n+ public void GetScreenRadius_SizeHeightIsOdd_ShouldNotAdjustRadius()\n+ {\n+ // Arrange \n+ var annoObject = new AnnoObject\n+ {\n+ Size = new Size(8, 5),\n+ Radius = 10\n+ };\n+ var layoutObject = new LayoutObject(annoObject, coordinateHelper, null, null);\n+\n+ // Act\n+ var screenRadius = layoutObject.GetScreenRadius(10);\n+\n+ // Assert\n+ Assert.Equal(100, screenRadius);\n+ }\n+\n+ [Fact]\n+ public void GetScreenRadius_SizeWidthIsOdd_ShouldNotAdjustRadius()\n+ {\n+ // Arrange \n+ var annoObject = new AnnoObject\n+ {\n+ Size = new Size(5, 8),\n+ Radius = 10\n+ };\n+ var layoutObject = new LayoutObject(annoObject, coordinateHelper, null, null);\n+\n+ // Act\n+ var screenRadius = layoutObject.GetScreenRadius(10);\n+\n+ // Assert\n+ Assert.Equal(100, screenRadius);\n+ }\n+\n+ [Fact]\n+ public void GetScreenRadius_NeitherSizeWidthNorHeightIsOdd_ShouldNotAdjustRadius()\n+ {\n+ // Arrange \n+ var annoObject = new AnnoObject\n+ {\n+ Size = new Size(8, 8),\n+ Radius = 10\n+ };\n+ var layoutObject = new LayoutObject(annoObject, coordinateHelper, null, null);\n+\n+ // Act\n+ var screenRadius = layoutObject.GetScreenRadius(10);\n+\n+ // Assert\n+ Assert.Equal(100, screenRadius);\n+ }\n+\n+ #endregion\n+ }\n+}", "diff_files": ["AnnoDesigner/Models/LayoutObject.cs", "Tests/AnnoDesigner.Tests/LayoutObjectTests.cs"], "diff_status": "ok", "edit_files": ["AnnoDesigner/Models/LayoutObject.cs"], "edit_functions": [], "added_functions": [], "supports_function_level": false, "additions": 142, "deletions": 2, "changed_files": 2, "patch_count": 2, "repo_stars": 230, "repo_license": "MIT"} |
| {"instance_id": "yihui__knitr__1183794769", "annotation_by": "human", "repo_full_name": "yihui/knitr", "repo_language": "R", "language": "r", "language_category": "", "base_commit": "c874c171afa348e883485afcd0fb3bdff29a280d", "issue_title": "Add an option for adding subfloat separators", "issue_body": "Currently, LaTeX code generated for sub floats places them one by one without separation. This results in adjacent images, as well as captions, in the output. It would be very handy to have an option to specify separator. One could write something like `fig.subsep = \"\\\\hfill\"`, what would result with something like\r\n``` tex\r\n\\subfloat{\\includegraphics[width=0.49\\textwidth]{…} }\r\n\\hfill % here, the separator\r\n\\subfloat{\\includegraphics[width=0.49\\textwidth]{…} }\r\n```\r\nHere is an extreme illustration of the problem with the `out.width` set to 30 percent.\r\n<image>\r\nIt would also be useful to specify separators not only in between the sub figures, but also before and after the first one and the last one respectively. This would allow more flexible layouts and centering sub figures in columns. From the interface perspactive, perhaps this could be achieved by passing a vector of separators. Eg. `fig.subsep=c(\"\\\\hspace {1 cm}\", \"\\\\hfill\", \"\\\\hspace {1 cm}\")`.\r\n<!--\r\nPlease keep the below portion in your issue. Your issue will be closed if any of the boxes is not checked (i.e., replace `[ ]` by `[x]`). In certain (rare) cases, you may be exempted if you give a brief explanation (e.g., you are only making a suggestion for improvement). Thanks!\r\n-->\r\n\r\n---\r\n\r\nBy filing an issue to this repo, I promise that\r\n\r\n- [x] I have fully read the issue guide at https://yihui.org/issue/.\r\n- [x] I have provided the necessary information about my issue.\r\n - If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.\r\n - If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included `xfun::session_info('knitr')`. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: `remotes::install_github('yihui/knitr')`.\r\n - If I have posted the same issue elsewhere, I have also mentioned it in this issue.\r\n- [x] I have learned the Github Markdown syntax, and formatted my issue correctly.\r\n\r\nI understand that my issue may be closed if I don't fulfill my promises.\r\n", "images": [{"local_path": "images/issue_1183794769_0.png", "alt": "image", "source": "body"}], "image_category": "rendering_result", "relevance_score": 2, "difficulty": "medium", "diff": "diff --git a/NEWS.md b/NEWS.md\nindex abe810d1ad..c1865e1141 100644\n--- a/NEWS.md\n+++ b/NEWS.md\n@@ -1,5 +1,9 @@\n # CHANGES IN knitr VERSION 1.40\n \n+## NEW FEATURES\n+\n+- Per suggestion of @jakubkaczor, a new chunk option called `fig.subsep` was added (thanks, @pedropark99, #2140). This option is focused on improving LaTeX sub-figures arrangement (see LaTeX [sub-figures section in _R Markdown Cookbook_](https://bookdown.org/yihui/rmarkdown-cookbook/latex-subfigure.html)). This option is available only for PDF output and will be ignored in other output formats. With this option, you can add LaTeX commands between (and around) sub-figures.\n+\n ## MINOR CHANGES\n \n - When the inline R code cannot be correctly parsed, the error message will show the original code in addition to the parsing error, which can make it easier to identify the code error in the source document (thanks, @AlbertLei, #2141).\ndiff --git a/R/hooks-latex.R b/R/hooks-latex.R\nindex eb8a728f06..5b7168ba22 100644\n--- a/R/hooks-latex.R\n+++ b/R/hooks-latex.R\n@@ -156,6 +156,34 @@ hook_plot_tex = function(x, options) {\n sprintf('height=%s', options$out.height),\n options$out.extra), collapse = ',')\n \n+ # If the chunk have sub-figures, check if we need to add a subfloat separator\n+ # between each sub-figure.\n+ if (usesub && !is.null(subsep <- options$fig.subsep)) {\n+ # User can provide a single separator, or, a vector of multiple separators.\n+ # Number of elements in this vector can vary from `fig.num - 1` to `fig.num + 1`.\n+ n_subsep = length(subsep)\n+ # If the length of `fig.subsep` does not comply with these boundaries, stop the user.\n+ if (!n_subsep %in% (c(1L, -1:1 + fig.num))) stop2(\n+ \"'fig.subsep' should be a single character value, or a character vector \",\n+ \"with number of elements ranging from \", fig.num - 1, \" to \", fig.num + 1,\n+ \". But currently 'fig.subsep' has \", n_subsep, \" elements.`\"\n+ )\n+ sub11 = sub21 = '' # strings from subsep to prepend sub1, or append sub2\n+ # If `fig.subsep` is a single separator, add it before all plots except first\n+ if (n_subsep == 1L) {\n+ if (!plot1) sub11 = subsep\n+ } else if (n_subsep < fig.num) {\n+ # If `fig.num - 1` separators, add i-th separator before (i+1)-th plot:\n+ if (!plot1) sub11 = subsep[fig.cur - 1]\n+ } else {\n+ sub11 = subsep[fig.cur]\n+ # If is the last plot in set, add the last separator after it.\n+ if (n_subsep > fig.num && plot2) sub21 = subsep[fig.cur + 1L]\n+ }\n+ if (sub11 != '') sub1 = paste(sub11, sub1, sep = '\\n')\n+ if (sub21 != '') sub2 = paste(sub2, sub21, sep = '\\n')\n+ }\n+\n paste0(\n fig1, align1, sub1, resize1,\n if (tikz) {", "diff_files": ["NEWS.md", "R/hooks-latex.R"], "diff_status": "ok", "edit_files": ["NEWS.md", "R/hooks-latex.R"], "edit_functions": [], "added_functions": [], "supports_function_level": false, "additions": 32, "deletions": 0, "changed_files": 2, "patch_count": 2, "repo_stars": 2432, "repo_license": ""} |
| {"instance_id": "yshui__picom__2002892676", "annotation_by": "human", "repo_full_name": "yshui/picom", "repo_language": "C", "language": "c", "language_category": "systems", "base_commit": "b368072e12acdb069bd5075886d555fccf66fe2b", "issue_title": "picom --invert-color-include fails when the HOME env is unset", "issue_body": "when i run picom in an environment where HOME is unset\r\nthen this does not work = the colors of chromium are not inverted\r\n\r\n```\r\npicom --invert-color-include 'class_g=\"Chromium-browser\"'\r\n```\r\n\r\nfixed by setting HOME to an empty tempdir\r\n\r\npicom version 10.2\r\n\r\n<details>\r\n<summary>\r\ntest-picom.py\r\n</summary>\r\n\r\nim calling picom from python, so this looks like\r\n\r\n```py\r\n#!/usr/bin/env python3\r\n\r\n# required packages: tigervnc picom chromium\r\n\r\nimport os\r\nimport subprocess\r\nimport tempfile\r\nimport time\r\n\r\nvnc_display = \":2\"\r\n\r\nargs = [\r\n \"Xvnc\",\r\n # dont require a password\r\n \"-SecurityTypes\", \"none\",\r\n \"-geometry\", \"1024x768\", # default: 1024x768\r\n \"-depth\", \"16\", # default: 24\r\n \"-FrameRate\", \"10\", # maximum frame rate. default: 60\r\n \"-localhost\", # accept connections only from localhost\r\n vnc_display,\r\n]\r\nproc_xvnc = subprocess.Popen(\r\n args,\r\n)\r\ntime.sleep(1)\r\n\r\nargs = [\"vncviewer\", vnc_display]\r\nproc_vncviewer = subprocess.Popen(\r\n args,\r\n)\r\ntime.sleep(1)\r\n\r\n# minimal env: only PATH is set\r\ncustom_env = {\r\n \"PATH\": os.environ[\"PATH\"],\r\n \"DISPLAY\": vnc_display,\r\n # setting HOME is required to fix \"picom --invert-color-include\"\r\n #\"HOME\": tempfile.mkdtemp(suffix=\"-temp_home\"),\r\n}\r\n\r\nargs = [\r\n \"picom\",\r\n\r\n # invert colors of chromium window\r\n \"--invert-color-include\", 'class_g=\"Chromium-browser\"',\r\n\r\n # invert colors of all windows, also \"save file\" dialogs\r\n #\"--invert-color-include\", 'name ~= \".\"',\r\n\r\n # dont invert colors for the \"feh\" image viewer\r\n #\"--invert-color-include\", 'class_g != \"feh\"',\r\n\r\n # fix \"picom --invert-color-include\" with unset HOME\r\n \"--config\", \"/dev/null\",\r\n]\r\nproc_picom = subprocess.Popen(\r\n args,\r\n env=custom_env,\r\n)\r\ntime.sleep(1)\r\n\r\nargs = [\"chromium\"]\r\nproc_chromium = subprocess.Popen(\r\n args,\r\n env=custom_env,\r\n)\r\ntime.sleep(5)\r\n\r\nproc_vncviewer.kill()\r\nproc_chromium.kill()\r\nproc_picom.kill()\r\nproc_xvnc.kill()\r\n```\r\n\r\n</details>\n<image>\n<image>\n<image>", "images": [{"local_path": "images/issue_2002892676_0.png", "alt": "image", "source": "issue_comment"}, {"local_path": "images/issue_2002892676_1.png", "alt": "image", "source": "issue_comment"}, {"local_path": "images/issue_2002892676_2.png", "alt": "image", "source": "issue_comment"}], "image_category": "log_output", "relevance_score": -1, "difficulty": "medium", "diff": "diff --git a/src/config.c b/src/config.c\nindex ec39aa4390..f5764c5c39 100644\n--- a/src/config.c\n+++ b/src/config.c\n@@ -596,15 +596,17 @@ char *locate_auxiliary_file(const char *scope, const char *path, const char *inc\n \t// Fall back to searching in user config directory\n \tscoped_charp picom_scope = mstrjoin(\"/picom/\", scope);\n \tscoped_charp config_home = (char *)xdg_config_home();\n-\tchar *ret = locate_auxiliary_file_at(config_home, picom_scope, path);\n-\tif (ret) {\n-\t\treturn ret;\n+\tif (config_home) {\n+\t\tchar *ret = locate_auxiliary_file_at(config_home, picom_scope, path);\n+\t\tif (ret) {\n+\t\t\treturn ret;\n+\t\t}\n \t}\n \n \t// Fall back to searching in system config directory\n \tauto config_dirs = xdg_config_dirs();\n \tfor (int i = 0; config_dirs[i]; i++) {\n-\t\tret = locate_auxiliary_file_at(config_dirs[i], picom_scope, path);\n+\t\tchar *ret = locate_auxiliary_file_at(config_dirs[i], picom_scope, path);\n \t\tif (ret) {\n \t\t\tfree(config_dirs);\n \t\t\treturn ret;\n@@ -612,7 +614,7 @@ char *locate_auxiliary_file(const char *scope, const char *path, const char *inc\n \t}\n \tfree(config_dirs);\n \n-\treturn ret;\n+\treturn NULL;\n }\n \n /**\ndiff --git a/src/config_libconfig.c b/src/config_libconfig.c\nindex f2a8e07faa..ed2097eb76 100644\n--- a/src/config_libconfig.c\n+++ b/src/config_libconfig.c\n@@ -81,17 +81,19 @@ FILE *open_config_file(const char *cpath, char **ppath) {\n \n \t// First search for config file in user config directory\n \tauto config_home = xdg_config_home();\n-\tauto ret = open_config_file_at(config_home, ppath);\n-\tfree((void *)config_home);\n-\tif (ret) {\n-\t\treturn ret;\n+\tif (config_home) {\n+\t\tauto ret = open_config_file_at(config_home, ppath);\n+\t\tfree((void *)config_home);\n+\t\tif (ret) {\n+\t\t\treturn ret;\n+\t\t}\n \t}\n \n \t// Fall back to legacy config file in user home directory\n \tconst char *home = getenv(\"HOME\");\n \tif (home && strlen(home)) {\n \t\tauto path = mstrjoin(home, config_filename_legacy);\n-\t\tret = fopen(path, \"r\");\n+\t\tauto ret = fopen(path, \"r\");\n \t\tif (ret && ppath) {\n \t\t\t*ppath = path;\n \t\t} else {\n@@ -105,7 +107,7 @@ FILE *open_config_file(const char *cpath, char **ppath) {\n \t// Fall back to config file in system config directory\n \tauto config_dirs = xdg_config_dirs();\n \tfor (int i = 0; config_dirs[i]; i++) {\n-\t\tret = open_config_file_at(config_dirs[i], ppath);\n+\t\tauto ret = open_config_file_at(config_dirs[i], ppath);\n \t\tif (ret) {\n \t\t\tfree(config_dirs);\n \t\t\treturn ret;", "diff_files": ["src/config.c", "src/config_libconfig.c"], "diff_status": "ok", "edit_files": ["src/config.c", "src/config_libconfig.c"], "edit_functions": ["src/config.c:parse_window_shader_prefix(const char *src, const char **end, void *user_data)", "src/config_libconfig.c:open_config_file(const char *cpath, char **ppath)"], "added_functions": [], "supports_function_level": true, "additions": 15, "deletions": 11, "changed_files": 2, "patch_count": 2, "repo_stars": 4498, "repo_license": "NOASSERTION"} |
| {"instance_id": "DevToys-app__DevToys__2354946530", "annotation_by": "human", "repo_full_name": "DevToys-app/DevToys", "repo_language": "C#", "language": "c#", "language_category": "backend", "base_commit": "b071d39c581ed03452b7491ac48b58f59d5b7b8f", "issue_title": "Windows 11 misaligned title bar color", "issue_body": "### Current behavior\r\n\r\nThe color on title bar is misaligned. It should be invisible (non colorized):\r\n<image>\r\n\r\n\r\n### How to reproduce it (as minimally and precisely as possible)\r\n\r\n_No response_\r\n\r\n### Expected behavior\r\n\r\nThe colorized title bar should be smaller.\r\n\r\n### Screenshots\r\n\r\n_No response_\r\n\r\n### Workaround\r\n\r\n_No response_\r\n\r\n### Affected platforms\r\n\r\nWindows\r\n\r\n### Affected DevToys kind\r\n\r\nDevToys (app with GUI)\r\n\r\n### DevToys Version\r\n\r\n2.0.1\r\n\r\n### Relevant Assets/Logs\r\n\r\n_No response_", "images": [{"local_path": "images/issue_2354946530_0.png", "alt": "image", "source": "body"}], "image_category": "behavior_demo", "relevance_score": 1, "difficulty": "medium", "diff": "diff --git a/src/app/dev/platforms/desktop/DevToys.Windows/Controls/MicaWindowWithOverlay.xaml b/src/app/dev/platforms/desktop/DevToys.Windows/Controls/MicaWindowWithOverlay.xaml\nindex 439302773a..8d42daba8f 100644\n--- a/src/app/dev/platforms/desktop/DevToys.Windows/Controls/MicaWindowWithOverlay.xaml\n+++ b/src/app/dev/platforms/desktop/DevToys.Windows/Controls/MicaWindowWithOverlay.xaml\n@@ -98,6 +98,11 @@\n <Grid Margin=\"-1\">\n <AdornerDecorator>\n <Grid Margin=\"{TemplateBinding MarginMaximized}\">\n+ <Border\n+ x:Name=\"WindowTopBorder\"\n+ VerticalAlignment=\"Top\"\n+ Height=\"48\"/>\n+\n <ContentPresenter />\n \n <controls:OverlayControl\ndiff --git a/src/app/dev/platforms/desktop/DevToys.Windows/Controls/MicaWindowWithOverlay.xaml.cs b/src/app/dev/platforms/desktop/DevToys.Windows/Controls/MicaWindowWithOverlay.xaml.cs\nindex f05c9b95c1..0b3b4d9fa2 100644\n--- a/src/app/dev/platforms/desktop/DevToys.Windows/Controls/MicaWindowWithOverlay.xaml.cs\n+++ b/src/app/dev/platforms/desktop/DevToys.Windows/Controls/MicaWindowWithOverlay.xaml.cs\n@@ -11,11 +11,11 @@\n using DevToys.Windows.Core;\n using DevToys.Windows.Core.Helpers;\n using DevToys.Windows.Native;\n+using Microsoft.Win32;\n using Windows.Win32;\n using Windows.Win32.Foundation;\n using Windows.Win32.Graphics.Dwm;\n using Windows.Win32.UI.Controls;\n-using Windows.Win32.UI.WindowsAndMessaging;\n using Application = System.Windows.Application;\n using Button = System.Windows.Controls.Button;\n using Color = System.Windows.Media.Color;\n@@ -34,6 +34,7 @@ public abstract partial class MicaWindowWithOverlay : Window\n private Button? _maximizeButton;\n private Button? _minimizeButton;\n private StackPanel? _windowStateButtonsStackPanel;\n+ private Border? _windowTopBorder;\n private bool _isMouseButtonDownOnDraggableTitleBarArea;\n private Point _mouseDownPositionOnDraggableTitleBarArea;\n \n@@ -124,6 +125,7 @@ public override void OnApplyTemplate()\n _maximizeButton = (Button)Template.FindName(\"MaximizeButton\", this);\n var draggableTitleBarArea = (Border)Template.FindName(\"DraggableTitleBarArea\", this);\n var overlayControl = (OverlayControl)Template.FindName(\"TitleBar\", this);\n+ _windowTopBorder = (Border)Template.FindName(\"WindowTopBorder\", this);\n \n _windowStateButtonsStackPanel.SizeChanged += WindowStateButtonsStackPanel_SizeChanged;\n closeButton.Click += CloseButton_Click;\n@@ -483,6 +485,16 @@ private void UpdateTheme()\n dictionaries.Remove(resourceDictionaryToRemove);\n dictionaries.Add(resourceDictionary);\n UpdateLayout();\n+\n+ Guard.IsNotNull(_windowTopBorder);\n+ if (IsAccentColorOnTitleBarEnabled())\n+ {\n+ _windowTopBorder.Background = SystemParameters.WindowGlassBrush;\n+ }\n+ else\n+ {\n+ _windowTopBorder.Background = null;\n+ }\n }\n \n private nint ShowSnapLayout(nint lParam, ref bool handled)\n@@ -560,4 +572,22 @@ private static void OnForbidMinimizeAndMaximizePropertyChangedCallback(Dependenc\n NativeMethods.EnableMinimizeAndMaximizeCapabilities(windowHandle);\n }\n }\n+\n+ public static bool IsAccentColorOnTitleBarEnabled()\n+ {\n+ const string key = @\"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\DWM\";\n+ const string name = \"ColorPrevalence\";\n+\n+ object? value = Registry.GetValue(key, name, null);\n+ if (value is null)\n+ {\n+ // Key doesn't exist, assume default (OFF)\n+ return false;\n+ }\n+ else\n+ {\n+ // If the key value is 1, the setting is ON. Otherwise, it's OFF.\n+ return ((int)value == 1);\n+ }\n+ }\n }", "diff_files": ["src/app/dev/platforms/desktop/DevToys.Windows/Controls/MicaWindowWithOverlay.xaml", "src/app/dev/platforms/desktop/DevToys.Windows/Controls/MicaWindowWithOverlay.xaml.cs"], "diff_status": "ok", "edit_files": ["src/app/dev/platforms/desktop/DevToys.Windows/Controls/MicaWindowWithOverlay.xaml", "src/app/dev/platforms/desktop/DevToys.Windows/Controls/MicaWindowWithOverlay.xaml.cs"], "edit_functions": [], "added_functions": [], "supports_function_level": false, "additions": 36, "deletions": 1, "changed_files": 2, "patch_count": 2, "repo_stars": 29678, "repo_license": "MIT"} |
| {"instance_id": "strapi-community__strapi-plugin-transformer__1258254518", "annotation_by": "human", "repo_full_name": "strapi-community/strapi-plugin-transformer", "repo_language": "JavaScript", "language": "javascript", "language_category": "frontend", "base_commit": "f8a5ca2907263c51ea03477d7a990daae984e6d7", "issue_title": "[bug] api prefix and admin clash causes admin to break", "issue_body": "Hello, I followed the settings correctly, and everything went right.\r\n\r\nI created the plugins.js added the settings, and sent the settings via environment variables.\r\n\r\nExternal API working perfectly.\r\n\r\nBut when I went to access the Content Type, I'm getting this error message:\r\n\r\n<image>\r\n\r\nAnd it doesn't load the Content Types, and the contents I have are gone:\r\n\r\n<image>\r\n\r\nI'm using strapi 4.1.12\r\n\r\nAnd my settings:\r\n\r\n<image>\r\n<image>\r\n\r\nIf I disable the settings everything goes back to normal.\r\nAnd I'm uploading the strapi with:\r\n\r\nyarn strapi develop --watch-admin\r\n\r\nI would love to use this extension, but with this problem I can't use it, did I miss some configuration?\r\n\r\nThanks for the help.", "images": [{"local_path": "images/issue_1258254518_0.png", "alt": "image", "source": "body"}, {"local_path": "images/issue_1258254518_1.png", "alt": "image", "source": "body"}, {"local_path": "images/issue_1258254518_2.png", "alt": "image", "source": "body"}, {"local_path": "images/issue_1258254518_3.png", "alt": "image", "source": "body"}], "image_category": "code_screenshot", "relevance_score": 1, "difficulty": "medium", "diff": "diff --git a/server/middleware/transform.js b/server/middleware/transform.js\nindex 794976f..7ac8e36 100644\n--- a/server/middleware/transform.js\n+++ b/server/middleware/transform.js\n@@ -14,7 +14,7 @@ const transform = async (strapi, ctx, next) => {\n \t}\n \n \t// only process api requests.\n-\tif (isAPIRequest(ctx, settings.prefix)) {\n+\tif (isAPIRequest(ctx)) {\n \t\tconst { data } = ctx.body;\n \n \t\t// ensure no error returned.\ndiff --git a/server/util/isAPIRequest.js b/server/util/isAPIRequest.js\nindex 82452d5..8e6b676 100644\n--- a/server/util/isAPIRequest.js\n+++ b/server/util/isAPIRequest.js\n@@ -1,7 +1,10 @@\n 'use strict';\n \n-const isAPIRequest = (ctx, prefix = '/api/') =>\n-\tctx.request && ctx.request.url && ctx.request.url.indexOf(prefix) !== -1;\n+const isAPIRequest = (ctx) =>\n+\tctx.state &&\n+\tctx.state.route &&\n+\tctx.state.route.info &&\n+\tctx.state.route.info.type === 'content-api';\n \n module.exports = {\n \tisAPIRequest,", "diff_files": ["server/middleware/transform.js", "server/util/isAPIRequest.js"], "diff_status": "ok", "edit_files": ["server/middleware/transform.js", "server/util/isAPIRequest.js"], "edit_functions": ["server/middleware/transform.js:transform", "server/util/isAPIRequest.js:isAPIRequest"], "added_functions": [], "supports_function_level": true, "additions": 6, "deletions": 3, "changed_files": 2, "patch_count": 2, "repo_stars": 140, "repo_license": "MIT"} |
| {"instance_id": "nicolomantini__LinkedIn-Easy-Apply-Bot__2198685509", "annotation_by": "human", "repo_full_name": "nicolomantini/LinkedIn-Easy-Apply-Bot", "repo_language": "Python", "language": "python", "language_category": "backend", "base_commit": "337a6447e0b442ee31b5362e9e9070a63e4921bc", "issue_title": "Q&A not saved", "issue_body": "**Describe the bug**\r\nQuiz questions are not automatically saved when the bot is executed\r\n\r\n**Screenshots**\r\n<image>\r\n\r\n\r\n**Logs**\r\nN/A\r\n\r\n**Error Statement**\r\nN/A\r\n\r\n**Desktop (please complete the following information):**\r\n - OS: macOS 14.4 (M1 Max)\r\n - Browser Version 122.0.6261.129 (Official Build) (arm64)\r\n - Version latest\r\n\r\n**Expected behavior**\r\nsave Q&As to qa.csv\r\n\r\n", "images": [{"local_path": "images/issue_2198685509_0.png", "alt": "image", "source": "body"}], "image_category": "data_visualization", "relevance_score": 1, "difficulty": "hard", "diff": "diff --git a/config.yaml b/config.yaml\nindex ef4573f..6fdb9ac 100644\n--- a/config.yaml\n+++ b/config.yaml\n@@ -6,26 +6,24 @@ profile_path: '' #can be empty, will default to 'C:\\Users\\<user>\\AppData\\Local\\G\n \n \n positions:\n-- <position title 1>\n-- <position title 2>\n-- <position title 3>\n+- Software Engineer\n \n \n locations:\n-- <state>\n+- Michigan\n - Remote\n \n-salary: <yearly salary>\n-rate: <hourly rate>\n+salary: 60,000\n+rate: 25\n # --------- Optional Parameters -------\n uploads:\n- Resume: 'C:\\Users\\<user>\\Documents\\resume.docx'\n- Cover Letter: 'C:\\Users\\<user>\\Documents\\cover letter.docx'\n+ Resume: /Users/steven/Desktop/LinkedIn-Easy-Apply-Bot/cv.pdf\n+ Cover Letter: /Users/steven/Desktop/LinkedIn-Easy-Apply-Bot/cl.pdf\n #Photo: # PATH TO photo\n \n \n output_filename:\n-- # PATH TO OUTPUT FILE (default output.csv)\n+- /Users/steven/Desktop/LinkedIn-Easy-Apply-Bot/out.csv\n \n # blacklist:\n-# - # Company names you want to ignore\n\\ No newline at end of file\n+# - # Company names you want to ignore\ndiff --git a/easyapplybot.py b/easyapplybot.py\nindex 52e9691..ef08ec4 100644\n--- a/easyapplybot.py\n+++ b/easyapplybot.py\n@@ -108,15 +108,17 @@ def __init__(self,\n \n #initialize questions and answers file\n self.qa_file = Path(\"qa.csv\")\n+ self.answers = {}\n \n #if qa file does not exist, create it\n if self.qa_file.is_file():\n- self.answers = pd.read_csv(self.qa_file).to_dict()\n+ df = pd.read_csv(self.qa_file)\n+ for index, row in df.iterrows():\n+ self.answers[row['Question']] = row['Answer']\n #if qa file does exist, load it\n else:\n- self.answers = {\"Questions\":\"Answers\"}\n- df = pd.DataFrame(self.answers, index=[0])\n- df.to_csv(self.qa_file, encoding='utf-8')\n+ df = pd.DataFrame(columns=[\"Question\", \"Answer\"])\n+ df.to_csv(self.qa_file, index=False, encoding='utf-8')\n \n \n def get_appliedIDs(self, filename) -> list | None:\n@@ -467,6 +469,10 @@ def is_present(button_locator) -> bool:\n log.info(\"Please answer the questions, waiting 5 seconds...\")\n time.sleep(5)\n elements = self.get_elements(\"error\")\n+\n+ for element in elements:\n+ self.process_questions()\n+\n if \"application was sent\" in self.browser.page_source:\n log.info(\"Application Submitted\")\n submitted = True\n@@ -477,8 +483,7 @@ def is_present(button_locator) -> bool:\n break\n continue\n #add explicit wait\n- # for element in elements:\n- #self.process_questions()\n+ \n else:\n log.info(\"Application not submitted\")\n time.sleep(2)\n@@ -559,9 +564,9 @@ def process_questions(self):\n def ans_question(self, question): #refactor this to an ans.yaml file\n answer = None\n if \"how many\" in question:\n- answer = random.randint(3, 12)\n+ answer = \"1\"\n elif \"experience\" in question:\n- answer = random.randint(3, 12)\n+ answer = \"1\"\n elif \"sponsor\" in question:\n answer = \"No\"\n elif 'do you ' in question:\n@@ -595,15 +600,21 @@ def ans_question(self, question): #refactor this to an ans.yaml file\n #open file and document unanswerable questions, appending to it\n answer = \"user provided\"\n time.sleep(15)\n- self.answers[question] = answer\n+\n # df = pd.DataFrame(self.answers, index=[0])\n # df.to_csv(self.qa_file, encoding=\"utf-8\")\n log.info(\"Answering question: \" + question + \" with answer: \" + answer)\n- self.answers[question] = answer\n- df = pd.DataFrame(self.answers, index=[0])\n- df.to_csv(self.qa_file, encoding=\"utf-8\")\n- log.debug(f\"{question} : {answer}\")\n+\n+ # Append question and answer to the CSV\n+ if question not in self.answers:\n+ self.answers[question] = answer\n+ # Append a new question-answer pair to the CSV file\n+ new_data = pd.DataFrame({\"Question\": [question], \"Answer\": [answer]})\n+ new_data.to_csv(self.qa_file, mode='a', header=False, index=False, encoding='utf-8')\n+ log.info(f\"Appended to QA file: '{question}' with answer: '{answer}'.\")\n+\n return answer\n+\n def load_page(self, sleep=1):\n scroll_page = 0\n while scroll_page < 4000:\ndiff --git a/out.csv b/out.csv\nnew file mode 100644\nindex 0000000..0c663d4\n--- /dev/null\n+++ b/out.csv\n@@ -0,0 +1,28 @@\n+2024-03-28 16:36:32,3857211698,Software Engineer,AIMQ DEVELOPMENT LLC,True,False\n+2024-03-28 16:40:05,3857211698,Software Engineer,AIMQ DEVELOPMENT LLC,True,True\n+2024-04-09 22:28:24,3860832233,0) Full Stack Engineer,Vital Tech Solutions,True,True\n+2024-04-09 22:35:42,3832283941,0) Quantitative Developer,Jobot,True,True\n+2024-04-09 22:36:15,3874275602,0) Sr Software Engineer (Warren),CIeNET Technologies,True,True\n+2024-04-09 22:36:35,3827214267,0) Full Stack AI Engineer,MOTOR Information Systems,True,True\n+2024-04-09 22:36:55,3854456823,0) Technical engineer or Embedded or System Engineer or Linux engineer,People Tech Group Inc,True,True\n+2024-04-09 22:37:12,3783795088,0) Embedded Software Engineer,LER TechForce,True,True\n+2024-04-09 22:41:05,3796905534,0) Mid Level Software Engineer,\"Accessibility Services, Inc.\",True,True\n+2024-04-09 22:41:28,3866228500,0) Mikrotik Engineer,Mad River Enterprises,True,True\n+2024-04-09 22:44:56,3880081547,0) DevOps Engineer,Camgian,True,True\n+2024-04-09 22:55:36,3818300577,1) CMM Programmer,Tenneco,True,True\n+2024-04-09 22:56:13,3812006594,1) Senior Software Engineer,\"Revela, Inc.\",True,True\n+2024-04-09 22:56:30,3764169601,1) Embedded Software Engineer,LER TechForce,True,True\n+2024-04-09 22:56:50,3864416985,1) Embedded Engineer,People Tech Group Inc,True,True\n+2024-04-09 22:57:40,3860849293,1) Embedded Software Engineer,Pure Talent Consulting,True,True\n+2024-04-09 23:03:01,3887422852,1) Dotnet Developer,Imetris Corporation,True,True\n+2024-04-09 23:07:22,3860352554,1) Senior Full Stack Shopify Developer,Akantro,True,True\n+2024-04-09 23:10:37,3885141730,1) Experienced Talend ETL Developer,\"Retail Insights, LLC\",True,True\n+2024-04-09 23:16:15,3875092654,\"1) IT Ops Engineer II - Primarily Remote/On-Site 2-3 days/mth - MS Windows, Linux, Powershell\",Conexess Group,True,True\n+2024-04-09 23:16:34,3885092790,1) Senior SAS Programmer - only W2,Intellisoft Technologies,True,False\n+2024-04-09 23:19:25,3827215295,1) Platform Engineer,RE/MAX,True,True\n+2024-04-09 23:19:59,3840470076,1) Software Engineer,InterEx Group,True,False\n+2024-04-09 23:20:33,3864393011,1) Application Developer,SysTechCorp Inc,True,False\n+2024-04-09 23:21:07,3881719303,1) Senior Cloud Developer,JRD Systems,True,False\n+2024-04-09 23:23:49,3840470076,1) Software Engineer,InterEx Group,True,True\n+2024-04-09 23:28:02,3885092790,1) Senior SAS Programmer - only W2,Intellisoft Technologies,True,False\n+2024-04-09 23:30:16,3885092790,1) Senior SAS Programmer - only W2,Intellisoft Technologies,True,True\ndiff --git a/qa.csv b/qa.csv\nnew file mode 100644\nindex 0000000..7bd6244\n--- /dev/null\n+++ b/qa.csv\n@@ -0,0 +1,52 @@\n+Question,Answer\n+\"Have you completed the following level of education: Bachelor's Degree?\n+Have you completed the following level of education: Bachelor's Degree?\n+Required\n+Yes\n+No\",user provided\n+\"Do you have a valid driver's license?\n+Do you have a valid driver's license?\n+Required\n+Yes\n+No\",user provided\n+\"Do you have the following license or certification: Google Cloud Certified Professional Cloud Architect?\n+Do you have the following license or certification: Google Cloud Certified Professional Cloud Architect?\n+Required\n+Yes\n+No\n+Please make a selection\",user provided\n+\"have you completed the following level of education: bachelor's degree?\n+have you completed the following level of education: bachelor's degree?\n+required\n+yes\n+no\",Yes\n+how many years of work experience do you have with c++?,1\n+\"how many years of computer games experience do you currently have?\n+enter a whole number between 0 and 99\",1\n+\"how many years of engineering experience do you currently have?\n+enter a whole number between 0 and 99\",1\n+\"how many years of work experience do you have with unreal engine?\n+enter a whole number between 0 and 99\",1\n+\"how many years utilizing unreal engine?\n+enter a decimal number larger than 0.0\",1\n+how many years of computer games experience do you currently have?,1\n+how many years of engineering experience do you currently have?,1\n+how many years of work experience do you have with unreal engine?,1\n+how many years utilizing unreal engine?,1\n+\"how many years of work experience do you have with databases?\n+enter a whole number between 0 and 99\",1\n+\"how many years of work experience do you have with business development?\n+enter a whole number between 0 and 99\",1\n+\"are you comfortable commuting to this job's location?\n+are you comfortable commuting to this job's location?\n+required\n+yes\n+no\n+please make a selection\",Yes\n+how many years of work experience do you have with databases?,1\n+how many years of work experience do you have with business development?,1\n+\"are you comfortable commuting to this job's location?\n+are you comfortable commuting to this job's location?\n+required\n+yes\n+no\",Yes", "diff_files": ["config.yaml", "easyapplybot.py", "out.csv", "qa.csv"], "diff_status": "ok", "edit_files": ["config.yaml", "easyapplybot.py"], "edit_functions": ["easyapplybot.py:EasyApplyBot.__init__", "easyapplybot.py:EasyApplyBot.ans_question", "easyapplybot.py:EasyApplyBot.process_questions", "easyapplybot.py:EasyApplyBot.send_resume"], "added_functions": [], "supports_function_level": true, "additions": 112, "deletions": 23, "changed_files": 6, "patch_count": 4, "repo_stars": 1035, "repo_license": "Apache-2.0"} |
| {"instance_id": "babel__babel-polyfills__2196559031", "annotation_by": "ai", "repo_full_name": "babel/babel-polyfills", "repo_language": "TypeScript", "language": "typescript", "language_category": "", "base_commit": "f69b72450a13c44664b4b2c86bab840392fcc725", "issue_title": "[Bug]: Bebel Version upgraded to 7.24.1 Promise.allSettled cannot support", "issue_body": "### 馃捇\n\n- [ ] Would you like to work on a fix?\n\n### How are you using Babel?\n\nbabel-loader (webpack)\n\n### Input code\n\nbabel.config.js\r\n```js\r\nmodule.exports = {\r\n env: {\r\n node: {\r\n presets: [\r\n [\r\n '@babel/preset-env',\r\n {\r\n targets: {\r\n node: '14'\r\n },\r\n modules: false\r\n }\r\n ],\r\n '@vue/babel-preset-jsx',\r\n [\r\n '@babel/preset-typescript',\r\n {\r\n allExtensions: true\r\n }\r\n ]\r\n ],\r\n sourceType: 'unambiguous',\r\n plugins: [\r\n [\r\n '@babel/plugin-transform-runtime',\r\n {\r\n corejs: {\r\n version: 3,\r\n proposals: true\r\n }\r\n }\r\n ],\r\n ['@babel/plugin-proposal-decorators', {legacy: true}],\r\n '@babel/plugin-proposal-class-properties',\r\n '@babel/plugin-syntax-dynamic-import',\r\n [\r\n 'component',\r\n {\r\n libraryName: '@ncfe/nc.element-ui',\r\n style: false\r\n },\r\n '@ncfe/nc.element-ui'\r\n ]\r\n ]\r\n },\r\n web: {\r\n presets: [\r\n [\r\n '@babel/preset-env',\r\n {\r\n targets: {\r\n chrome: 44,\r\n ie: 8\r\n },\r\n modules: false\r\n }\r\n ],\r\n '@vue/babel-preset-jsx',\r\n [\r\n '@babel/preset-typesc", "images": [{"local_path": "images/issue_2196559031_0.png", "source": "body", "alt": ""}], "image_category": "log_output", "relevance_score": 2, "difficulty": "hard", "diff": "diff --git a/packages/babel-plugin-polyfill-corejs3/src/babel-runtime-corejs3-paths.ts b/packages/babel-plugin-polyfill-corejs3/src/babel-runtime-corejs3-paths.ts\nnew file mode 100644\nindex 00000000..f50e5f0c\n--- /dev/null\n+++ b/packages/babel-plugin-polyfill-corejs3/src/babel-runtime-corejs3-paths.ts\n@@ -0,0 +1,179 @@\n+// This file contains the list of paths supported by @babel/runtime-corejs3.\n+// It must _not_ be edited, as all new features should go through direct\n+// injection of core-js-pure imports.\n+\n+export const stable = new Set([\n+ \"array\",\n+ \"array/from\",\n+ \"array/is-array\",\n+ \"array/of\",\n+ \"bind\",\n+ \"clear-immediate\",\n+ \"code-point-at\",\n+ \"concat\",\n+ \"copy-within\",\n+ \"date/now\",\n+ \"ends-with\",\n+ \"entries\",\n+ \"every\",\n+ \"fill\",\n+ \"filter\",\n+ \"find\",\n+ \"find-index\",\n+ \"flags\",\n+ \"flat\",\n+ \"flat-map\",\n+ \"for-each\",\n+ \"includes\",\n+ \"index-of\",\n+ \"json/stringify\",\n+ \"keys\",\n+ \"last-index-of\",\n+ \"map\",\n+ \"map\",\n+ \"math/acosh\",\n+ \"math/asinh\",\n+ \"math/atanh\",\n+ \"math/cbrt\",\n+ \"math/clz32\",\n+ \"math/cosh\",\n+ \"math/expm1\",\n+ \"math/fround\",\n+ \"math/hypot\",\n+ \"math/imul\",\n+ \"math/log10\",\n+ \"math/log1p\",\n+ \"math/log2\",\n+ \"math/sign\",\n+ \"math/sinh\",\n+ \"math/tanh\",\n+ \"math/trunc\",\n+ \"number/epsilon\",\n+ \"number/is-finite\",\n+ \"number/is-integer\",\n+ \"number/is-nan\",\n+ \"number/is-safe-integer\",\n+ \"number/max-safe-integer\",\n+ \"number/min-safe-integer\",\n+ \"number/parse-float\",\n+ \"number/parse-int\",\n+ \"object/assign\",\n+ \"object/create\",\n+ \"object/define-properties\",\n+ \"object/define-property\",\n+ \"object/entries\",\n+ \"object/freeze\",\n+ \"object/from-entries\",\n+ \"object/get-own-property-descriptor\",\n+ \"object/get-own-property-descriptors\",\n+ \"object/get-own-property-names\",\n+ \"object/get-own-property-symbols\",\n+ \"object/get-prototype-of\",\n+ \"object/is\",\n+ \"object/is-extensible\",\n+ \"object/is-frozen\",\n+ \"object/is-sealed\",\n+ \"object/keys\",\n+ \"object/prevent-extensions\",\n+ \"object/seal\",\n+ \"object/set-prototype-of\",\n+ \"object/values\",\n+ \"pad-end\",\n+ \"pad-start\",\n+ \"parse-float\",\n+ \"parse-int\",\n+ \"promise\",\n+ \"queue-microtask\",\n+ \"reduce\",\n+ \"reduce-right\",\n+ \"reflect/apply\",\n+ \"reflect/construct\",\n+ \"reflect/define-property\",\n+ \"reflect/delete-property\",\n+ \"reflect/get\",\n+ \"reflect/get-own-property-descriptor\",\n+ \"reflect/get-prototype-of\",\n+ \"reflect/has\",\n+ \"reflect/is-extensible\",\n+ \"reflect/own-keys\",\n+ \"reflect/prevent-extensions\",\n+ \"reflect/set\",\n+ \"reflect/set-prototype-of\",\n+ \"repeat\",\n+ \"reverse\",\n+ \"set\",\n+ \"set-immediate\",\n+ \"set-interval\",\n+ \"set-timeout\",\n+ \"slice\",\n+ \"some\",\n+ \"sort\",\n+ \"splice\",\n+ \"starts-with\",\n+ \"string/from-code-point\",\n+ \"string/raw\",\n+ \"symbol\",\n+ \"symbol/async-iterator\",\n+ \"symbol/for\",\n+ \"symbol/has-instance\",\n+ \"symbol/is-concat-spreadable\",\n+ \"symbol/iterator\",\n+ \"symbol/key-for\",\n+ \"symbol/match\",\n+ \"symbol/replace\",\n+ \"symbol/search\",\n+ \"symbol/species\",\n+ \"symbol/split\",\n+ \"symbol/to-primitive\",\n+ \"symbol/to-string-tag\",\n+ \"symbol/unscopables\",\n+ \"trim\",\n+ \"trim-end\",\n+ \"trim-left\",\n+ \"trim-right\",\n+ \"trim-start\",\n+ \"url\",\n+ \"url-search-params\",\n+ \"values\",\n+ \"weak-map\",\n+ \"weak-set\",\n+]);\n+\n+export const proposals = new Set([\n+ ...stable,\n+ \"aggregate-error\",\n+ \"at\",\n+ \"code-points\",\n+ \"composite-key\",\n+ \"composite-symbol\",\n+ \"global-this\",\n+ \"match-all\",\n+ \"math/clamp\",\n+ \"math/degrees\",\n+ \"math/deg-per-rad\",\n+ \"math/fscale\",\n+ \"math/iaddh\",\n+ \"math/imulh\",\n+ \"math/isubh\",\n+ \"math/rad-per-deg\",\n+ \"math/radians\",\n+ \"math/scale\",\n+ \"math/seeded-prng\",\n+ \"math/signbit\",\n+ \"math/umulh\",\n+ \"number/from-string\",\n+ \"observable\",\n+ \"reflect/define-metadata\",\n+ \"reflect/delete-metadata\",\n+ \"reflect/get-metadata\",\n+ \"reflect/get-metadata-keys\",\n+ \"reflect/get-own-metadata\",\n+ \"reflect/get-own-metadata-keys\",\n+ \"reflect/has-metadata\",\n+ \"reflect/has-own-metadata\",\n+ \"reflect/metadata\",\n+ \"replace-all\",\n+ \"symbol/dispose\",\n+ \"symbol/observable\",\n+ \"symbol/pattern-match\",\n+]);\ndiff --git a/packages/babel-plugin-polyfill-corejs3/src/index.ts b/packages/babel-plugin-polyfill-corejs3/src/index.ts\nindex 9a5d667a..e1244a18 100644\n--- a/packages/babel-plugin-polyfill-corejs3/src/index.ts\n+++ b/packages/babel-plugin-polyfill-corejs3/src/index.ts\n@@ -11,6 +11,7 @@ import {\n DecoratorMetadataDependencies,\n type CoreJSPolyfillDescriptor,\n } from \"./built-in-definitions\";\n+import * as BabelRuntimePaths from \"./babel-runtime-corejs3-paths\";\n import canSkipPolyfill from \"./usage-filters\";\n \n import type { NodePath } from \"@babel/traverse\";\n@@ -35,7 +36,6 @@ type Options = {\n [presetEnvCompat]?: { noRuntimeName: boolean };\n [runtimeCompat]: {\n useBabelRuntime: boolean;\n- babelRuntimePath: string;\n ext: string;\n };\n };\n@@ -127,6 +127,16 @@ export default defineProvider<Options>(function (\n } else if (name.startsWith(\"es.\") && !available.has(name)) {\n useProposalBase = true;\n }\n+ if (\n+ useBabelRuntime &&\n+ !(\n+ useProposalBase\n+ ? BabelRuntimePaths.proposals\n+ : BabelRuntimePaths.stable\n+ ).has(desc.pure)\n+ ) {\n+ return;\n+ }\n const coreJSPureBase = getCoreJSPureBase(useProposalBase);\n return utils.injectDefaultImport(\n `${coreJSPureBase}/${desc.pure}${ext}`,\ndiff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/input.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/input.mjs\nnew file mode 100644\nindex 00000000..f5e6314e\n--- /dev/null\n+++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/input.mjs\n@@ -0,0 +1,2 @@\n+Promise.allSettled(1, 2, 3);\n+Observable(1, 2, 3);\n\\ No newline at end of file\ndiff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/options.json b/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/options.json\nnew file mode 100644\nindex 00000000..934681b6\n--- /dev/null\n+++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/options.json\n@@ -0,0 +1,14 @@\n+{\n+ \"plugins\": [\n+ [\n+ \"@@/polyfill-corejs3\",\n+ {\n+ \"method\": \"usage-pure\",\n+ \"proposals\": true,\n+ \"#__secret_key__@babel/runtime__compatibility\": {\n+ \"useBabelRuntime\": true\n+ }\n+ }\n+ ]\n+ ]\n+}\ndiff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/output.mjs\nnew file mode 100644\nindex 00000000..dd88a740\n--- /dev/null\n+++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/output.mjs\n@@ -0,0 +1,4 @@\n+import _Promise from \"@babel/runtime-corejs3/core-js/promise.js\";\n+import _Observable from \"@babel/runtime-corejs3/core-js/observable.js\";\n+_Promise.allSettled(1, 2, 3);\n+_Observable(1, 2, 3);\ndiff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/input.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/input.mjs\nnew file mode 100644\nindex 00000000..f5e6314e\n--- /dev/null\n+++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/input.mjs\n@@ -0,0 +1,2 @@\n+Promise.allSettled(1, 2, 3);\n+Observable(1, 2, 3);\n\\ No newline at end of file\ndiff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/options.json b/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/options.json\nnew file mode 100644\nindex 00000000..39bcec39\n--- /dev/null\n+++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/options.json\n@@ -0,0 +1,13 @@\n+{\n+ \"plugins\": [\n+ [\n+ \"@@/polyfill-corejs3\",\n+ {\n+ \"method\": \"usage-pure\",\n+ \"#__secret_key__@babel/runtime__compatibility\": {\n+ \"useBabelRuntime\": true\n+ }\n+ }\n+ ]\n+ ]\n+}\ndiff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/output.mjs\nnew file mode 100644\nindex 00000000..92a8c457\n--- /dev/null\n+++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/output.mjs\n@@ -0,0 +1,3 @@\n+import _Promise from \"@babel/runtime-corejs3/core-js-stable/promise.js\";\n+_Promise.allSettled(1, 2, 3);\n+Observable(1, 2, 3);", "diff_files": ["packages/babel-plugin-polyfill-corejs3/src/babel-runtime-corejs3-paths.ts", "packages/babel-plugin-polyfill-corejs3/src/index.ts", "packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/input.mjs", "packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/options.json", "packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/output.mjs", "packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/input.mjs", "packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/options.json", "packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/output.mjs"], "diff_status": "ok", "edit_files": ["packages/babel-plugin-polyfill-corejs3/src/babel-runtime-corejs3-paths.ts", "packages/babel-plugin-polyfill-corejs3/src/index.ts", "packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/input.mjs", "packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/options.json", "packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing-proposals/output.mjs", "packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/input.mjs", "packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/options.json", "packages/babel-plugin-polyfill-corejs3/test/fixtures/regression/babel-runtime-missing/output.mjs"], "edit_functions": [], "added_functions": [], "supports_function_level": false, "additions": 0, "deletions": 0, "changed_files": 8, "patch_count": 1, "repo_stars": 0, "repo_license": ""} |
| {"instance_id": "KhronosGroup__glTF-Sample-Viewer__1686961597", "annotation_by": "ai", "repo_full_name": "KhronosGroup/glTF-Sample-Viewer", "repo_language": "JavaScript", "language": "javascript", "language_category": "", "base_commit": "ba6678f35ce33d7f48c00dd070435207efafaa46", "issue_title": "Generate Tangents with MikkTSpace", "issue_body": "We've stumbled into quality issues with tangents that are calculated using the shader derivative approach while experimenting with anisotropy. From the spec, it is recommended that tangents are generated clientside using MikkTSpace:\r\n\r\n> When tangents are not specified, client implementations SHOULD calculate tangents using default [MikkTSpace](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#mikktspace) algorithms with the specified vertex positions, normals, and texture coordinates associated with the normal texture.\r\n\r\nAdmittedly, most real-time engines do not incur this cost at load time, but demonstrating it's quality and utility here in the sample viewer could help inform other implementations of the benefits to this approach.", "images": [{"local_path": "images/issue_1686961597_0.png", "source": "body", "alt": ""}, {"local_path": "images/issue_1686961597_1.png", "source": "body", "alt": ""}, {"local_path": "images/issue_1686961597_2.png", "source": "body", "alt": ""}, {"local_path": "images/issue_1686961597_3.png", "source": "body", "alt": ""}], "image_category": "rendering_result", "relevance_score": 1, "difficulty": "hard", "diff": "diff --git a/app_web/src/main.js b/app_web/src/main.js\nindex 13113ef7f..503d202a3 100644\n--- a/app_web/src/main.js\n+++ b/app_web/src/main.js\n@@ -7,8 +7,14 @@ import { Observable, Subject, from, merge } from 'rxjs';\n import { mergeMap, filter, map, multicast } from 'rxjs/operators';\n import { gltfModelPathProvider, fillEnvironmentWithPaths } from './model_path_provider.js';\n \n-async function main()\n-{\n+\n+import mikktspaceWasm from '../../source/libs/mikktspace_module.js';\n+\n+let mikktspace = null;\n+\n+async function main() {\n+ mikktspace = await mikktspaceWasm(\"libs/mikktspace_module_bg.wasm\");\n+\n const canvas = document.getElementById(\"canvas\");\n const context = canvas.getContext(\"webgl2\", { alpha: false, antialias: true });\n const ui = document.getElementById(\"app\");\n@@ -363,4 +369,4 @@ async function main()\n window.requestAnimationFrame(update);\n }\n \n-export { main };\n+export { main, mikktspace };\ndiff --git a/source/gltf/primitive.js b/source/gltf/primitive.js\nindex dd37cc713..6cf0ea5b6 100644\n--- a/source/gltf/primitive.js\n+++ b/source/gltf/primitive.js\n@@ -1,6 +1,7 @@\n import { initGlForMembers } from './utils.js';\n import { GltfObject } from './gltf_object.js';\n import { gltfBuffer } from './buffer.js';\n+import { gltfAccessor } from './accessor.js';\n import { gltfImage } from './image.js';\n import { ImageMimeType } from './image_mime_type.js';\n import { gltfTexture } from './texture.js';\n@@ -9,13 +10,14 @@ import { gltfSampler } from './sampler.js';\n import { gltfBufferView } from './buffer_view.js';\n import { DracoDecoder } from '../ResourceLoader/draco.js';\n import { GL } from '../Renderer/webgl.js';\n+import { mikktspace } from '../../app_web/src/main.js';\n \n class gltfPrimitive extends GltfObject\n {\n constructor()\n {\n super();\n- this.attributes = [];\n+ this.attributes = {};\n this.targets = [];\n this.indices = undefined;\n this.material = undefined;\n@@ -53,6 +55,7 @@ class gltfPrimitive extends GltfObject\n \n if (this.extensions !== undefined)\n {\n+ // Decode Draco compressed mesh:\n if (this.extensions.KHR_draco_mesh_compression !== undefined)\n {\n const dracoDecoder = new DracoDecoder();\n@@ -69,6 +72,15 @@ class gltfPrimitive extends GltfObject\n }\n }\n \n+ if (this.attributes.TANGENT === undefined)\n+ {\n+ console.info(\"Generating tangents using the MikkTSpace algorithm.\");\n+ console.time(\"Tangent generation\");\n+ this.unweld(gltf);\n+ this.generateTangents(gltf);\n+ console.timeEnd(\"Tangent generation\");\n+ }\n+\n // VERTEX ATTRIBUTES\n for (const attribute of Object.keys(this.attributes))\n {\n@@ -722,6 +734,131 @@ class gltfPrimitive extends GltfObject\n };\n \n }\n+\n+ /**\n+ * Unwelds this primitive, i.e. applies the index mapping.\n+ * This is required for generating tangents using the MikkTSpace algorithm,\n+ * because the same vertex might be mapped to different tangents.\n+ * @param {*} gltf The glTF document.\n+ */\n+ unweld(gltf) {\n+ // Unwelding is an idempotent operation.\n+ if (this.indices === undefined) {\n+ return;\n+ }\n+ \n+ const indices = gltf.accessors[this.indices].getTypedView(gltf);\n+\n+ // Unweld attributes:\n+ for (const [attribute, accessorIndex] of Object.entries(this.attributes)) {\n+ this.attributes[attribute] = this.unweldAccessor(gltf, gltf.accessors[accessorIndex], indices);\n+ }\n+\n+ // Unweld morph targets:\n+ for (const target of this.targets) {\n+ for (const [attribute, accessorIndex] of Object.entries(target)) {\n+ target[attribute] = this.unweldAccessor(gltf, gltf.accessors[accessorIndex], indices);\n+ }\n+ }\n+\n+ // Dipose the indices:\n+ this.indices = undefined;\n+ }\n+\n+ /**\n+ * Unwelds a single accessor. Used by {@link unweld}.\n+ * @param {*} gltf The glTF document.\n+ * @param {*} accessor The accessor to unweld.\n+ * @param {*} typedIndexView A typed view of the indices.\n+ * @returns A new accessor index containing the unwelded attribute.\n+ */\n+ unweldAccessor(gltf, accessor, typedIndexView) {\n+ const stride = accessor.getComponentCount(accessor.type);\n+\n+ const weldedAttribute = accessor.getTypedView(gltf);\n+ const unweldedAttribute = new Float32Array(gltf.accessors[this.indices].count * stride);\n+\n+ // Apply the index mapping.\n+ for (let i = 0; i < typedIndexView.length; i++) {\n+ for (let j = 0; j < stride; j++) {\n+ unweldedAttribute[i * stride + j] = weldedAttribute[typedIndexView[i] * stride + j];\n+ }\n+ }\n+\n+ // Create a new buffer and buffer view for the unwelded attribute:\n+ const unweldedBuffer = new gltfBuffer();\n+ unweldedBuffer.byteLength = unweldedAttribute.byteLength;\n+ unweldedBuffer.buffer = unweldedAttribute.buffer;\n+ gltf.buffers.push(unweldedBuffer);\n+\n+ const unweldedBufferView = new gltfBufferView();\n+ unweldedBufferView.buffer = gltf.buffers.length - 1;\n+ unweldedBufferView.byteLength = unweldedAttribute.byteLength;\n+ unweldedBufferView.target = GL.ARRAY_BUFFER;\n+ gltf.bufferViews.push(unweldedBufferView);\n+\n+ // Create a new accessor for the unwelded attribute:\n+ const unweldedAccessor = new gltfAccessor();\n+ unweldedAccessor.bufferView = gltf.bufferViews.length - 1;\n+ unweldedAccessor.byteOffset = 0;\n+ unweldedAccessor.count = typedIndexView.length;\n+ unweldedAccessor.type = accessor.type;\n+ unweldedAccessor.componentType = accessor.componentType;\n+ unweldedAccessor.min = gltf.accessors[this.attributes.POSITION].min;\n+ unweldedAccessor.max = gltf.accessors[this.attributes.POSITION].max;\n+ gltf.accessors.push(unweldedAccessor);\n+\n+ // Update the primitive to use the unwelded attribute:\n+ return gltf.accessors.length - 1;\n+ }\n+\n+ generateTangents(gltf) {\n+ const positions = gltf.accessors[this.attributes.POSITION].getTypedView(gltf);\n+ const normals = gltf.accessors[this.attributes.NORMAL].getTypedView(gltf);\n+ const texcoords = gltf.accessors[this.attributes.TEXCOORD_0].getTypedView(gltf);\n+ for (let i = 0; i < positions.length; i += 3) {\n+ mikktspace.writeFace(\n+ positions[i], positions[i + 1], positions[i + 2],\n+ normals[i], normals[i + 1], normals[i + 2],\n+ texcoords[i], texcoords[i + 1]\n+ );\n+ }\n+\n+ mikktspace.generateTangents();\n+\n+ const tangents = new Float32Array(4 * positions.length / 3);\n+ for (let i = 0; i < tangents.length; i++) {\n+ let t = mikktspace.readTangent(i);\n+ tangents[i] = t;\n+ }\n+\n+ // Create a new buffer and buffer view for the tangents:\n+ const tangentBuffer = new gltfBuffer();\n+ tangentBuffer.byteLength = tangents.byteLength;\n+ tangentBuffer.buffer = tangents.buffer;\n+ gltf.buffers.push(tangentBuffer);\n+\n+ const tangentBufferView = new gltfBufferView();\n+ tangentBufferView.buffer = gltf.buffers.length - 1;\n+ tangentBufferView.byteLength = tangents.byteLength;\n+ tangentBufferView.target = GL.ARRAY_BUFFER;\n+ gltf.bufferViews.push(tangentBufferView);\n+\n+ // Create a new accessor for the tangents:\n+ const tangentAccessor = new gltfAccessor();\n+ tangentAccessor.bufferView = gltf.bufferViews.length - 1;\n+ tangentAccessor.byteOffset = 0;\n+ tangentAccessor.count = tangents.length / 4;\n+ tangentAccessor.type = \"VEC4\";\n+ tangentAccessor.componentType = GL.FLOAT;\n+\n+ // Update the primitive to use the tangents:\n+ this.attributes.TANGENT = gltf.accessors.length;\n+ gltf.accessors.push(tangentAccessor);\n+\n+ // Update the primitive to use the tangents:\n+ this.attributes.TANGENT = gltf.accessors.length - 1;\n+ }\n }\n \n export { gltfPrimitive };\ndiff --git a/source/libs/mikktspace_module.js b/source/libs/mikktspace_module.js\nnew file mode 100644\nindex 000000000..e18d20ddb\n--- /dev/null\n+++ b/source/libs/mikktspace_module.js\n@@ -0,0 +1,360 @@\n+\n+let wasm;\n+\n+const heap = new Array(32).fill(undefined);\n+\n+heap.push(undefined, null, true, false);\n+\n+function getObject(idx) { return heap[idx]; }\n+\n+let heap_next = heap.length;\n+\n+function dropObject(idx) {\n+ if (idx < 36) return;\n+ heap[idx] = heap_next;\n+ heap_next = idx;\n+}\n+\n+function takeObject(idx) {\n+ const ret = getObject(idx);\n+ dropObject(idx);\n+ return ret;\n+}\n+\n+let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n+\n+cachedTextDecoder.decode();\n+\n+let cachegetUint8Memory0 = null;\n+function getUint8Memory0() {\n+ if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {\n+ cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);\n+ }\n+ return cachegetUint8Memory0;\n+}\n+\n+function getStringFromWasm0(ptr, len) {\n+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));\n+}\n+\n+function addHeapObject(obj) {\n+ if (heap_next === heap.length) heap.push(heap.length + 1);\n+ const idx = heap_next;\n+ heap_next = heap[idx];\n+\n+ heap[idx] = obj;\n+ return idx;\n+}\n+\n+function debugString(val) {\n+ // primitive types\n+ const type = typeof val;\n+ if (type == 'number' || type == 'boolean' || val == null) {\n+ return `${val}`;\n+ }\n+ if (type == 'string') {\n+ return `\"${val}\"`;\n+ }\n+ if (type == 'symbol') {\n+ const description = val.description;\n+ if (description == null) {\n+ return 'Symbol';\n+ } else {\n+ return `Symbol(${description})`;\n+ }\n+ }\n+ if (type == 'function') {\n+ const name = val.name;\n+ if (typeof name == 'string' && name.length > 0) {\n+ return `Function(${name})`;\n+ } else {\n+ return 'Function';\n+ }\n+ }\n+ // objects\n+ if (Array.isArray(val)) {\n+ const length = val.length;\n+ let debug = '[';\n+ if (length > 0) {\n+ debug += debugString(val[0]);\n+ }\n+ for(let i = 1; i < length; i++) {\n+ debug += ', ' + debugString(val[i]);\n+ }\n+ debug += ']';\n+ return debug;\n+ }\n+ // Test for built-in\n+ const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n+ let className;\n+ if (builtInMatches.length > 1) {\n+ className = builtInMatches[1];\n+ } else {\n+ // Failed to match the standard '[object ClassName]'\n+ return toString.call(val);\n+ }\n+ if (className == 'Object') {\n+ // we're a user defined class or Object\n+ // JSON.stringify avoids problems with cycles, and is generally much\n+ // easier than looping through ownProperties of `val`.\n+ try {\n+ return 'Object(' + JSON.stringify(val) + ')';\n+ } catch (_) {\n+ return 'Object';\n+ }\n+ }\n+ // errors\n+ if (val instanceof Error) {\n+ return `${val.name}: ${val.message}\\n${val.stack}`;\n+ }\n+ // TODO we could test for more things here, like `Set`s and `Map`s.\n+ return className;\n+}\n+\n+let WASM_VECTOR_LEN = 0;\n+\n+let cachedTextEncoder = new TextEncoder('utf-8');\n+\n+const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n+ ? function (arg, view) {\n+ return cachedTextEncoder.encodeInto(arg, view);\n+}\n+ : function (arg, view) {\n+ const buf = cachedTextEncoder.encode(arg);\n+ view.set(buf);\n+ return {\n+ read: arg.length,\n+ written: buf.length\n+ };\n+});\n+\n+function passStringToWasm0(arg, malloc, realloc) {\n+\n+ if (realloc === undefined) {\n+ const buf = cachedTextEncoder.encode(arg);\n+ const ptr = malloc(buf.length);\n+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);\n+ WASM_VECTOR_LEN = buf.length;\n+ return ptr;\n+ }\n+\n+ let len = arg.length;\n+ let ptr = malloc(len);\n+\n+ const mem = getUint8Memory0();\n+\n+ let offset = 0;\n+\n+ for (; offset < len; offset++) {\n+ const code = arg.charCodeAt(offset);\n+ if (code > 0x7F) break;\n+ mem[ptr + offset] = code;\n+ }\n+\n+ if (offset !== len) {\n+ if (offset !== 0) {\n+ arg = arg.slice(offset);\n+ }\n+ ptr = realloc(ptr, len, len = offset + arg.length * 3);\n+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);\n+ const ret = encodeString(arg, view);\n+\n+ offset += ret.written;\n+ }\n+\n+ WASM_VECTOR_LEN = offset;\n+ return ptr;\n+}\n+\n+let cachegetInt32Memory0 = null;\n+function getInt32Memory0() {\n+ if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {\n+ cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);\n+ }\n+ return cachegetInt32Memory0;\n+}\n+/**\n+*/\n+export function init_panic_hook() {\n+ wasm.init_panic_hook();\n+}\n+\n+/**\n+* @param {number} a\n+* @param {number} b\n+* @returns {number}\n+*/\n+export function add(a, b) {\n+ var ret = wasm.add(a, b);\n+ return ret >>> 0;\n+}\n+\n+/**\n+* @param {string} a\n+* @returns {string}\n+*/\n+export function foo(a) {\n+ try {\n+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n+ var ptr0 = passStringToWasm0(a, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n+ var len0 = WASM_VECTOR_LEN;\n+ wasm.foo(retptr, ptr0, len0);\n+ var r0 = getInt32Memory0()[retptr / 4 + 0];\n+ var r1 = getInt32Memory0()[retptr / 4 + 1];\n+ return getStringFromWasm0(r0, r1);\n+ } finally {\n+ wasm.__wbindgen_add_to_stack_pointer(16);\n+ wasm.__wbindgen_free(r0, r1);\n+ }\n+}\n+\n+let cachegetUint32Memory0 = null;\n+function getUint32Memory0() {\n+ if (cachegetUint32Memory0 === null || cachegetUint32Memory0.buffer !== wasm.memory.buffer) {\n+ cachegetUint32Memory0 = new Uint32Array(wasm.memory.buffer);\n+ }\n+ return cachegetUint32Memory0;\n+}\n+\n+function passArrayJsValueToWasm0(array, malloc) {\n+ const ptr = malloc(array.length * 4);\n+ const mem = getUint32Memory0();\n+ for (let i = 0; i < array.length; i++) {\n+ mem[ptr / 4 + i] = addHeapObject(array[i]);\n+ }\n+ WASM_VECTOR_LEN = array.length;\n+ return ptr;\n+}\n+/**\n+* @param {any[]} a\n+* @returns {number}\n+*/\n+export function length(a) {\n+ var ptr0 = passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc);\n+ var len0 = WASM_VECTOR_LEN;\n+ var ret = wasm.length(ptr0, len0);\n+ return ret >>> 0;\n+}\n+\n+/**\n+* @param {number} p0\n+* @param {number} p1\n+* @param {number} p2\n+* @param {number} n0\n+* @param {number} n1\n+* @param {number} n2\n+* @param {number} t0\n+* @param {number} t1\n+*/\n+export function writeFace(p0, p1, p2, n0, n1, n2, t0, t1) {\n+ wasm.writeFace(p0, p1, p2, n0, n1, n2, t0, t1);\n+}\n+\n+/**\n+* @param {number} i\n+* @returns {number}\n+*/\n+export function readTangent(i) {\n+ var ret = wasm.readTangent(i);\n+ return ret;\n+}\n+\n+/**\n+* Generates vertex tangents for the given position/normal/texcoord attributes.\n+*/\n+export function generateTangents() {\n+ wasm.generateTangents();\n+}\n+\n+async function load(module, imports) {\n+ if (typeof Response === 'function' && module instanceof Response) {\n+ if (typeof WebAssembly.instantiateStreaming === 'function') {\n+ try {\n+ return await WebAssembly.instantiateStreaming(module, imports);\n+\n+ } catch (e) {\n+ if (module.headers.get('Content-Type') != 'application/wasm') {\n+ console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n+\n+ } else {\n+ throw e;\n+ }\n+ }\n+ }\n+\n+ const bytes = await module.arrayBuffer();\n+ return await WebAssembly.instantiate(bytes, imports);\n+\n+ } else {\n+ const instance = await WebAssembly.instantiate(module, imports);\n+\n+ if (instance instanceof WebAssembly.Instance) {\n+ return { instance, module };\n+\n+ } else {\n+ return instance;\n+ }\n+ }\n+}\n+\n+async function init(input) {\n+ if (typeof input === 'undefined') {\n+ input = new URL('mikktspace_module_bg.wasm', import.meta.url);\n+ }\n+ const imports = {};\n+ imports.wbg = {};\n+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {\n+ takeObject(arg0);\n+ };\n+ imports.wbg.__wbg_log_19b305dd6bb2d393 = function(arg0, arg1) {\n+ console.log(getStringFromWasm0(arg0, arg1));\n+ };\n+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {\n+ var ret = getStringFromWasm0(arg0, arg1);\n+ return addHeapObject(ret);\n+ };\n+ imports.wbg.__wbg_new_59cb74e423758ede = function() {\n+ var ret = new Error();\n+ return addHeapObject(ret);\n+ };\n+ imports.wbg.__wbg_stack_558ba5917b466edd = function(arg0, arg1) {\n+ var ret = getObject(arg1).stack;\n+ var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n+ var len0 = WASM_VECTOR_LEN;\n+ getInt32Memory0()[arg0 / 4 + 1] = len0;\n+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n+ };\n+ imports.wbg.__wbg_error_4bb6c2a97407129a = function(arg0, arg1) {\n+ try {\n+ console.error(getStringFromWasm0(arg0, arg1));\n+ } finally {\n+ wasm.__wbindgen_free(arg0, arg1);\n+ }\n+ };\n+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {\n+ var ret = debugString(getObject(arg1));\n+ var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n+ var len0 = WASM_VECTOR_LEN;\n+ getInt32Memory0()[arg0 / 4 + 1] = len0;\n+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n+ };\n+ imports.wbg.__wbindgen_rethrow = function(arg0) {\n+ throw takeObject(arg0);\n+ };\n+\n+ if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {\n+ input = fetch(input);\n+ }\n+\n+\n+\n+ const { instance, module } = await load(await input, imports);\n+\n+ wasm = instance.exports;\n+ init.__wbindgen_wasm_module = module;\n+\n+ return wasm;\n+}\n+\n+export default init;\n+", "diff_files": ["app_web/src/main.js", "source/gltf/primitive.js", "source/libs/mikktspace_module.js"], "diff_status": "ok", "edit_files": ["app_web/src/main.js", "source/gltf/primitive.js", "source/libs/mikktspace_module.js"], "edit_functions": [], "added_functions": [], "supports_function_level": false, "additions": 0, "deletions": 0, "changed_files": 8, "patch_count": 1, "repo_stars": 0, "repo_license": ""} |
| {"instance_id": "silevis__reactgrid__2063202600", "annotation_by": "human", "repo_full_name": "silevis/reactgrid", "repo_language": "TypeScript", "language": "typescript", "language_category": "", "base_commit": "e21e8c72e8a9cb71d7880eb135619e96b459d453", "issue_title": "The v5-dev branch failed to start", "issue_body": "**Describe the bug**\r\nTypeError: get(...).cells.get is not a function at Object.getCellByIds\r\n\r\n**Expected behavior**\r\nNormal start-up\r\n\r\n**Screenshots or gifs**\r\n\r\n<image>\r\n\r\n\r\n**Your environment details**\r\n - Device: [e.g.desktop]\r\n - OS: [e.g. iOS]\r\n - Browser [e.g. chrome]\r\n", "images": [{"local_path": "images/issue_2063202600_0.png", "alt": "image", "source": "body"}], "image_category": "error_message", "relevance_score": 1, "difficulty": "hard", "diff": "diff --git a/index.html b/index.html\nindex e4b78eae..d1fa9084 100644\n--- a/index.html\n+++ b/index.html\n@@ -4,7 +4,7 @@\n <meta charset=\"UTF-8\" />\n <link rel=\"icon\" type=\"image/svg+xml\" href=\"/vite.svg\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n- <title>Vite + React + TS</title>\n+ <title>ReactGrid</title>\n </head>\n <body>\n <div id=\"root\"></div>\ndiff --git a/package.json b/package.json\nindex f8accda0..1d88c058 100644\n--- a/package.json\n+++ b/package.json\n@@ -4,7 +4,7 @@\n \"version\": \"0.0.0\",\n \"type\": \"module\",\n \"scripts\": {\n- \"dev\": \"vite\",\n+ \"dev\": \"ladle serve\",\n \"build\": \"tsc && vite build\",\n \"lint\": \"eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0\",\n \"preview\": \"vite preview\"\ndiff --git a/src/App.css b/src/App.css\ndeleted file mode 100644\nindex eb2536e1..00000000\n--- a/src/App.css\n+++ /dev/null\n@@ -1,42 +0,0 @@\n-#root {\n- max-width: 1280px;\n- margin: 0 auto;\n- padding: 2rem;\n- /* text-align: center; */\n-}\n-\n-.logo {\n- height: 6em;\n- padding: 1.5em;\n- will-change: filter;\n- transition: filter 300ms;\n-}\n-.logo:hover {\n- filter: drop-shadow(0 0 2em #646cffaa);\n-}\n-.logo.react:hover {\n- filter: drop-shadow(0 0 2em #61dafbaa);\n-}\n-\n-@keyframes logo-spin {\n- from {\n- transform: rotate(0deg);\n- }\n- to {\n- transform: rotate(360deg);\n- }\n-}\n-\n-@media (prefers-reduced-motion: no-preference) {\n- a:nth-of-type(2) .logo {\n- animation: logo-spin infinite 20s linear;\n- }\n-}\n-\n-.card {\n- padding: 2em;\n-}\n-\n-.read-the-docs {\n- color: #888;\n-}\ndiff --git a/src/App.tsx b/src/App.tsx\ndeleted file mode 100644\nindex df256517..00000000\n--- a/src/App.tsx\n+++ /dev/null\n@@ -1,68 +0,0 @@\n-import { FC } from \"react\";\n-import \"./App.css\";\n-import ReactGrid from \"./ReactGrid\";\n-import { ThemeProvider } from \"@emotion/react\";\n-import { Cell } from \"./types/PublicModel\";\n-import { ErrorBoundary } from \"./components/ErrorBoundary\";\n-\n-const TextCell: FC<{ value: string }> = ({ value }) => <div>{value}</div>;\n-\n-function App() {\n- const cells: Cell[][] = Array(15).fill(null).map((_, rowIndex) => {\n- return Array(7).fill(null).map((_, colIndex) => {\n- return { Template: TextCell, value: `cell [${rowIndex}-${colIndex}]` };\n- });\n- });\n- // const cells: Cell[][] = Array.from({ length: 15 }, (_, rowIndex) =>\n- // Array.from({ length: 7 }, (_, colIndex) => {\n- // return {\n- // Template: TextCell,\n- // value: `cell [${rowIndex}-${colIndex}]`,\n- // };\n- // })\n- // );\n-\n- // cells[4][4] = {\n- // ...cells[4][4],\n- // // rowSpan: 2,\n- // colSpan: 2,\n- // };\n-\n- cells[0][0] = {\n- ...cells[0][0],\n- colSpan: 2\n- }\n-\n- // cells[0][1] = undefined;\n-\n- // cells[5][2] = {\n- // ...cells[5][2],\n- // rowSpan: 4,\n- // colSpan: 2,\n- // };\n-\n- return (\n- <ErrorBoundary>\n- <ThemeProvider theme={{ grid: {} }}>\n- <ReactGrid\n- id={\"rg-test\"}\n- // columns={Array.from({ length: 7 }, () => {\n- // return { width: (Math.random() * (150 - 100 + 1) + 100) << 0 };\n- // })}\n- // rows={Array.from({ length: 15 }, () => {\n- // return { height: (Math.random() * (50 - 20 + 1) + 20) << 0 };\n- // })}\n- columns={Array.from({ length: 7 }, () => {\n- return { width: 100 };\n- })}\n- rows={Array.from({ length: 15 }, () => {\n- return { height: 25 };\n- })}\n- cells={cells}\n- />\n- </ThemeProvider>\n- </ErrorBoundary>\n- );\n-}\n-\n-export default App;\ndiff --git a/src/index.css b/src/index.css\nindex 2c3fac68..8f56bda3 100644\n--- a/src/index.css\n+++ b/src/index.css\n@@ -1,69 +1,28 @@\n-:root {\n- font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;\n- line-height: 1.5;\n- font-weight: 400;\n-\n- color-scheme: light dark;\n- color: rgba(255, 255, 255, 0.87);\n- background-color: #242424;\n-\n- font-synthesis: none;\n- text-rendering: optimizeLegibility;\n- -webkit-font-smoothing: antialiased;\n- -moz-osx-font-smoothing: grayscale;\n- -webkit-text-size-adjust: 100%;\n-}\n-\n-a {\n- font-weight: 500;\n- color: #646cff;\n- text-decoration: inherit;\n-}\n-a:hover {\n- color: #535bf2;\n-}\n-\n body {\n- margin: 0;\n- display: flex;\n- place-items: center;\n- min-width: 320px;\n- min-height: 100vh;\n+ max-width: 650px;\n+ margin: 40px auto;\n+ padding: 0 10px;\n+ font: 18px/1.5 -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n+ color: #444;\n }\n \n-h1 {\n- font-size: 3.2em;\n- line-height: 1.1;\n+h1,\n+h2,\n+h3 {\n+ line-height: 1.2;\n }\n \n-button {\n- border-radius: 8px;\n- border: 1px solid transparent;\n- padding: 0.6em 1.2em;\n- font-size: 1em;\n- font-weight: 500;\n- font-family: inherit;\n- background-color: #1a1a1a;\n- cursor: pointer;\n- transition: border-color 0.25s;\n-}\n-button:hover {\n- border-color: #646cff;\n-}\n-button:focus,\n-button:focus-visible {\n- outline: 4px auto -webkit-focus-ring-color;\n-}\n-\n-@media (prefers-color-scheme: light) {\n- :root {\n- color: #213547;\n- background-color: #ffffff;\n+@media (prefers-color-scheme: dark) {\n+ body {\n+ color: #c9d1d9;\n+ background: #0d1117;\n }\n- a:hover {\n- color: #747bff;\n+\n+ a:link {\n+ color: #58a6ff;\n }\n- button {\n- background-color: #f9f9f9;\n+\n+ a:visited {\n+ color: #8e96f0;\n }\n-}\n+}\n\\ No newline at end of file\ndiff --git a/src/main.tsx b/src/main.tsx\nindex 966f17a4..b7b97f98 100644\n--- a/src/main.tsx\n+++ b/src/main.tsx\n@@ -1,10 +1,16 @@\n import React from \"react\";\n import ReactDOM from \"react-dom/client\";\n-import App from \"./App.tsx\";\n import \"./index.css\";\n \n ReactDOM.createRoot(document.getElementById(\"root\")!).render(\n <React.StrictMode>\n- <App />\n+ <h1>You probably meant to run Ladle...</h1>\n+ <p>\n+ If you want to develop the library, or just play around with the code, run\n+ <p>\n+ <code>(npm | pnpm | yarn) ladle serve</code>\n+ </p>\n+ instead.\n+ </p>\n </React.StrictMode>\n );", "diff_files": ["index.html", "package.json", "src/App.css", "src/App.tsx", "src/index.css", "src/main.tsx"], "diff_status": "ok", "edit_files": ["index.html", "package.json", "src/App.css", "src/App.tsx", "src/index.css", "src/main.tsx"], "edit_functions": [], "added_functions": [], "supports_function_level": false, "additions": 30, "deletions": 175, "changed_files": 6, "patch_count": 6, "repo_stars": 1477, "repo_license": "MIT"} |
| {"instance_id": "qarmin__czkawka__1939776450", "annotation_by": "human", "repo_full_name": "qarmin/czkawka", "repo_language": "Rust", "language": "rust", "language_category": "systems", "base_commit": "046232460791d5a58cd4eafa0ac29c468b217e11", "issue_title": "Searching for dupes, then searching again, changes the data shown and is confusing (with caching on)", "issue_body": "**Desktop**\r\n - Czkawka version: 6.0.0 gui\r\n - OS version: Mac OS 13.5.2\r\n - hardware: MacBook Pro 2021 (apple silicon)\r\n - compile and run method: as per instructions, having previously done `brew install rustup`\r\n\r\n**Bug Description**\r\n\r\nEnsure caching is on.\r\n\r\nCreate a folder \"reference\" with some test data (images or whatever), with no dupes in it. Copy the folder to another called \"other\".\r\n\r\nAdd the two folders into czkawka. Select \"Reference\" checkbox next to the \"reference\" folder.\r\n\r\nDo a duplicate file search and then \"Select -> Select all\". The results look sensible: there's a ref folder listed above every dupe in a non-reference folder.\r\n\r\n<image>\r\n\r\nNow click search again, and the display changes: there is only one reference folder file listed, and a bunch of matches in the other folder. Do \"Select -> Select all\". It will select everything except the one reference folder file.\r\n\r\n<image>\r\n\r\nThis is confusing; it now looks to me that this means hitting 'delete' will delete original data, because the 'other' folder matches are non-matching files amongst themselves, which are all now ticked. In fact, I don't think original data *is* going to be deleted; it's just that some dupes in the reference folder are now missing from the display.\r\n\r\nBasically, hitting search should be idempotent: the result shouldn't change if you haven't changed anything since the last search.\r\n\r\nWhen I turn caching off and delete existing cache files, I don't get this issue.\r\n\r\nP.S. another issue, which I haven't go repro steps for but may be related to the issue above: I've search for dupes than deleted them, then searched again immediately with all same settings and more duplicates come up. I've seen this 2-3 times now.", "images": [{"local_path": "images/issue_1939776450_0.png", "alt": "Screenshot 2023-10-12 at 12 31 43", "source": "body"}, {"local_path": "images/issue_1939776450_1.png", "alt": "Screenshot 2023-10-12 at 12 30 51", "source": "body"}], "image_category": "behavior_demo", "relevance_score": 2, "difficulty": "hard", "diff": "diff --git a/Changelog.md b/Changelog.md\nindex b88306157..7ebc7de62 100644\n--- a/Changelog.md\n+++ b/Changelog.md\n@@ -1,9 +1,17 @@\n ## Version 6.1.0 - ?\n-- BREAKING CHANGE - Changed cache saving method, deduplicated, optimized and simplified procedure - [#1072](https://github.com/qarmin/czkawka/pull/1072)\n+- BREAKING CHANGE - Changed cache saving method, deduplicated, optimized and simplified procedure(all files needs to be hashed again) - [#1072](https://github.com/qarmin/czkawka/pull/1072)\n - Remove up to 170ms of delay after ending scan - [#1070](https://github.com/qarmin/czkawka/pull/1070)\n - Added logger with useful info when debugging app (level can be adjusted via e.g. `RUST_LOG=debug` env) - [#1072](https://github.com/qarmin/czkawka/pull/1072), [#1070](https://github.com/qarmin/czkawka/pull/1070)\n-- Core code cleanup - [#1072](https://github.com/qarmin/czkawka/pull/1072), [#1070](https://github.com/qarmin/czkawka/pull/1070)\n+- Core code cleanup - [#1072](https://github.com/qarmin/czkawka/pull/1072), [#1070](https://github.com/qarmin/czkawka/pull/1070), [#1082](https://github.com/qarmin/czkawka/pull/1082)\n - Updated list of bad extensions and support for finding invalid jar files - [#1070](https://github.com/qarmin/czkawka/pull/1070)\n+- More default excluded items on Windows(like pagefile) - [#1074](https://github.com/qarmin/czkawka/pull/1074)\n+- Unified printing/saving method to files/terminal and fixed some differences/bugs - [#1082](https://github.com/qarmin/czkawka/pull/1082)\n+- Uses fun_time library to print how much functions take time - [#1082](https://github.com/qarmin/czkawka/pull/1082)\n+- Added exporting results into json file format - [#1083](https://github.com/qarmin/czkawka/pull/1083)\n+- Added new test/regression suite for CI - [#1083](https://github.com/qarmin/czkawka/pull/1083)\n+- Added ability to use relative paths - [#1083](https://github.com/qarmin/czkawka/pull/1083)\n+- Fixed stability problem, that could remove invalid file in CLI - [#1083](https://github.com/qarmin/czkawka/pull/1083)\n+- Fixed problem with invalid cache loading - [#0000]\n - Fix Windows gui crashes by using gtk 4.6 instead 4.8 or 4.10 - [#992](https://github.com/qarmin/czkawka/pull/992)\n - Fixed printing info about duplicated music files - [#1016](https://github.com/qarmin/czkawka/pull/1016)\n - Fixed printing info about duplicated video files - [#1017](https://github.com/qarmin/czkawka/pull/1017)\ndiff --git a/README.md b/README.md\nindex 8e247fe1d..71080b9d2 100644\n--- a/README.md\n+++ b/README.md\n@@ -20,7 +20,7 @@\n - Temporary Files - Finds temporary files\n - Similar Images - Finds images which are not exactly the same (different resolution, watermarks)\n - Similar Videos - Looks for visually similar videos\n- - Same Music - Searches for music with the same artist, album etc.\n+ - Same Music - Searches for similar music by tags or by reading content and comparing it\n - Invalid Symbolic Links - Shows symbolic links which point to non-existent files/directories\n - Broken Files - Finds files that are invalid or corrupted\n - Bad Extensions - Lists files whose content not match with their extension\ndiff --git a/czkawka_core/src/duplicate.rs b/czkawka_core/src/duplicate.rs\nindex cf14bd7a2..96a34f4fa 100644\n--- a/czkawka_core/src/duplicate.rs\n+++ b/czkawka_core/src/duplicate.rs\n@@ -1,3 +1,4 @@\n+use std::collections::HashMap;\n use std::collections::{BTreeMap, HashSet};\n use std::fmt::Debug;\n use std::fs::File;\n@@ -424,11 +425,14 @@ impl DuplicateFinder {\n debug!(\"prehash_load_cache_at_start - started diff between loaded and prechecked files\");\n for (size, mut vec_file_entry) in mem::take(&mut self.files_with_identical_size) {\n if let Some(cached_vec_file_entry) = loaded_hash_map.get(&size) {\n- // TODO maybe hashset is not needed when using < 4 elements\n- let cached_path_entries = cached_vec_file_entry.iter().map(|e| &e.path).collect::<HashSet<_>>();\n+ // TODO maybe hashmap is not needed when using < 4 elements\n+ let mut cached_path_entries: HashMap<&Path, FileEntry> = HashMap::new();\n+ for file_entry in cached_vec_file_entry {\n+ cached_path_entries.insert(&file_entry.path, file_entry.clone());\n+ }\n for file_entry in vec_file_entry {\n- if cached_path_entries.contains(&file_entry.path) {\n- records_already_cached.entry(size).or_default().push(file_entry);\n+ if let Some(cached_file_entry) = cached_path_entries.remove(file_entry.path.as_path()) {\n+ records_already_cached.entry(size).or_default().push(cached_file_entry);\n } else {\n non_cached_files_to_check.entry(size).or_default().push(file_entry);\n }\n@@ -508,7 +512,7 @@ impl DuplicateFinder {\n debug!(\"Starting calculating prehash\");\n #[allow(clippy::type_complexity)]\n let pre_hash_results: Vec<(u64, BTreeMap<String, Vec<FileEntry>>, Vec<String>)> = non_cached_files_to_check\n- .par_iter()\n+ .into_par_iter()\n .map(|(size, vec_file_entry)| {\n let mut hashmap_with_hash: BTreeMap<String, Vec<FileEntry>> = Default::default();\n let mut errors: Vec<String> = Vec::new();\n@@ -519,15 +523,16 @@ impl DuplicateFinder {\n check_was_stopped.store(true, Ordering::Relaxed);\n return None;\n }\n- for file_entry in vec_file_entry {\n- match hash_calculation(&mut buffer, file_entry, &check_type, 0) {\n+ for mut file_entry in vec_file_entry {\n+ match hash_calculation(&mut buffer, &file_entry, &check_type, 0) {\n Ok(hash_string) => {\n- hashmap_with_hash.entry(hash_string.clone()).or_default().push(file_entry.clone());\n+ file_entry.hash = hash_string.clone();\n+ hashmap_with_hash.entry(hash_string.clone()).or_default().push(file_entry);\n }\n Err(s) => errors.push(s),\n }\n }\n- Some((*size, hashmap_with_hash, errors))\n+ Some((size, hashmap_with_hash, errors))\n })\n .while_some()\n .collect();\n@@ -581,11 +586,14 @@ impl DuplicateFinder {\n debug!(\"full_hashing_load_cache_at_start - started diff between loaded and prechecked files\");\n for (size, mut vec_file_entry) in pre_checked_map {\n if let Some(cached_vec_file_entry) = loaded_hash_map.get(&size) {\n- // TODO maybe hashset is not needed when using < 4 elements\n- let cached_path_entries = cached_vec_file_entry.iter().map(|e| &e.path).collect::<HashSet<_>>();\n+ // TODO maybe hashmap is not needed when using < 4 elements\n+ let mut cached_path_entries: HashMap<&Path, FileEntry> = HashMap::new();\n+ for file_entry in cached_vec_file_entry {\n+ cached_path_entries.insert(&file_entry.path, file_entry.clone());\n+ }\n for file_entry in vec_file_entry {\n- if cached_path_entries.contains(&file_entry.path) {\n- records_already_cached.entry(size).or_default().push(file_entry);\n+ if let Some(cached_file_entry) = cached_path_entries.remove(file_entry.path.as_path()) {\n+ records_already_cached.entry(size).or_default().push(cached_file_entry);\n } else {\n non_cached_files_to_check.entry(size).or_default().push(file_entry);\n }\ndiff --git a/czkawka_core/src/similar_images.rs b/czkawka_core/src/similar_images.rs\nindex c08017243..c797522ca 100644\n--- a/czkawka_core/src/similar_images.rs\n+++ b/czkawka_core/src/similar_images.rs\n@@ -783,7 +783,7 @@ impl SimilarImages {\n // Validating if group contains duplicated results\n let mut result_hashset: HashSet<String> = Default::default();\n let mut found = false;\n- // dbg!(collected_similar_images.len());\n+\n for vec_file_entry in collected_similar_images.values() {\n if vec_file_entry.is_empty() {\n println!(\"Empty group\");\n@@ -1338,7 +1338,6 @@ mod tests {\n \n similar_images.find_similar_hashes(None, None);\n let res = similar_images.get_similar_images();\n- // dbg!(&res);\n assert!(res.is_empty());\n }\n }", "diff_files": ["Changelog.md", "README.md", "czkawka_core/src/duplicate.rs", "czkawka_core/src/similar_images.rs"], "diff_status": "ok", "edit_files": ["Changelog.md", "README.md", "czkawka_core/src/duplicate.rs", "czkawka_core/src/similar_images.rs"], "edit_functions": ["czkawka_core/src/duplicate.rs:DuplicateFinder.full_hashing_load_cache_at_start", "czkawka_core/src/duplicate.rs:DuplicateFinder.prehash_load_cache_at_start", "czkawka_core/src/duplicate.rs:DuplicateFinder.prehashing", "czkawka_core/src/similar_images.rs:SimilarImages.verify_duplicated_items"], "added_functions": [], "supports_function_level": true, "additions": 33, "deletions": 18, "changed_files": 4, "patch_count": 4, "repo_stars": 24430, "repo_license": "NOASSERTION"} |
| {"instance_id": "ShrimpCryptid__Secret-Hitler-Online__1089563270", "annotation_by": "ai", "repo_full_name": "ShrimpCryptid/Secret-Hitler-Online", "repo_language": "Java", "language": "java", "language_category": "", "base_commit": "282dfdedda785c324d39eb1dc46cba7b01cc4cf2", "issue_title": "Users reconnecting to the game during post-legislative stages are shown incorrect policy card.", "issue_body": "If a user loses connection during the post-legislative stage (or during a presidential power activation) and reconnects, they are shown a Liberal policy in the \"Policy Enacted\" dialogue, regardless of which policy was actually passed.\r\n\r\n", "images": [{"local_path": "images/issue_1089563270_0.png", "source": "body", "alt": ""}], "image_category": "ui_screenshot", "relevance_score": 1, "difficulty": "hard", "diff": "diff --git a/backend/src/main/java/game/SecretHitlerGame.java b/backend/src/main/java/game/SecretHitlerGame.java\nindex 775d6d1..81dcc3c 100644\n--- a/backend/src/main/java/game/SecretHitlerGame.java\n+++ b/backend/src/main/java/game/SecretHitlerGame.java\n@@ -67,7 +67,7 @@ public class SecretHitlerGame implements Serializable {\n // The last president and chancellor that were successfully voted into office.\n private String lastPresident;\n private String lastChancellor;\n- private Policy.Type lastEnactedPolicy;\n+ private Policy.Type lastEnactedPolicy = Policy.Type.FASCIST;\n \n private String currentPresident;\n private String currentChancellor;\ndiff --git a/backend/src/main/java/server/SecretHitlerServer.java b/backend/src/main/java/server/SecretHitlerServer.java\nindex 9be2e7d..20fa086 100644\n--- a/backend/src/main/java/server/SecretHitlerServer.java\n+++ b/backend/src/main/java/server/SecretHitlerServer.java\n@@ -618,7 +618,7 @@ private static void onWebSocketMessage(WsMessageContext ctx) {\n break;\n \n case COMMAND_GET_STATE: // Requests the updated state of the game.\n- lobby.updateUser(ctx);\n+ lobby.updateUser(ctx, name);\n break;\n \n case COMMAND_NOMINATE_CHANCELLOR: // params: PARAM_TARGET (String)\ndiff --git a/backend/src/main/java/server/util/GameToJSONConverter.java b/backend/src/main/java/server/util/GameToJSONConverter.java\nindex 23dbcb8..b3b1b75 100644\n--- a/backend/src/main/java/server/util/GameToJSONConverter.java\n+++ b/backend/src/main/java/server/util/GameToJSONConverter.java\n@@ -2,6 +2,7 @@\n \n import game.GameState;\n import game.SecretHitlerGame;\n+import game.datastructures.Identity;\n import game.datastructures.Player;\n import game.datastructures.Policy;\n import org.json.JSONObject;\n@@ -14,34 +15,50 @@\n public class GameToJSONConverter {\n /**\n * Creates a JSON object from a SecretHitlerGame that represents its state.\n+ * \n * @param game the SecretHitlerGame to convert.\n+ * @param name the name of the user to create JSON content for. This is used\n+ * to determine what player identity information to send to the\n+ * user.\n * @throws NullPointerException if {@code game} is null.\n * @return a JSONObject with the following properties:\n- * - {@code state}: the state of the game.\n- * - {@code player-order}: an array of names representing the order of the players in the game.\n+ * - {@code state}: the state of the game.\n+ * - {@code player-order}: an array of names representing the order of\n+ * the players in the game.\n *\n- * - {@code players}: a JSONObject map, with keys that are a player's {@code username}.\n- * Each {@code username} key maps to an object with the properties {@code id} (String),\n- * {@code alive} (boolean), and {@code investigated} (boolean), to represent the player.\n- * The identity is either this.HITLER, this.FASCIST, or this.LIBERAL.\n- * Ex: {\"player1\":{\"alive\": true, \"investigated\": false, \"id\": \"LIBERAL\"}}.\n+ * - {@code players}: a JSONObject map, with keys that are a player's\n+ * {@code username}.\n+ * Each {@code username} key maps to an object with the properties\n+ * {@code id} (String),\n+ * {@code alive} (boolean), and {@code investigated} (boolean), to\n+ * represent the player.\n+ * The identity is either this.HITLER, this.FASCIST, or this.LIBERAL.\n+ * Ex: {\"player1\":{\"alive\": true, \"investigated\": false, \"id\":\n+ * \"LIBERAL\"}}.\n *\n- * - {@code president}: the username of the current president.\n- * - {@code chancellor}: the username of the current chancellor (can be null).\n- * - {@code last-president}: The username of the last president that presided over a legislative session.\n- * - {@code last-chancellor}: The username of the last chancellor that presided over a legislative session.\n- * - {@code draw-size}: The size of the draw deck.\n- * - {@code discard-size}: The size of the discard deck.\n- * - {@code fascist-policies}: The number of passed fascist policies.\n- * - {@code liberal-policies}: The number of passed liberal policies.:\n- * - {@code user-votes}: A map from each user to their vote from the last chancellor nomination.\n- * - {@code president-choices}: The choices for the president during the legislative session (only if in\n- * game state LEGISLATIVE_PRESIDENT).\n- * - {@code chancellor-choices}: The choices for the chancellor during the legislative session (only if in\n- * game state LEGISLATIVE_CHANCELLOR).\n- * - {@code veto-occurred}: Set to true if a veto has already taken place on this legislative session.\n+ * - {@code president}: the username of the current president.\n+ * - {@code chancellor}: the username of the current chancellor (can be\n+ * null).\n+ * - {@code last-president}: The username of the last president that\n+ * presided over a legislative session.\n+ * - {@code last-chancellor}: The username of the last chancellor that\n+ * presided over a legislative session.\n+ * - {@code draw-size}: The size of the draw deck.\n+ * - {@code discard-size}: The size of the discard deck.\n+ * - {@code fascist-policies}: The number of passed fascist policies.\n+ * - {@code liberal-policies}: The number of passed liberal policies.:\n+ * - {@code user-votes}: A map from each user to their vote from the\n+ * last chancellor nomination.\n+ * - {@code president-choices}: The choices for the president during the\n+ * legislative session (only if in\n+ * game state LEGISLATIVE_PRESIDENT).\n+ * - {@code chancellor-choices}: The choices for the chancellor during\n+ * the legislative session (only if in\n+ * game state LEGISLATIVE_CHANCELLOR).\n+ * - {@code veto-occurred}: Set to true if a veto has already taken\n+ * place on this legislative session.\n */\n- public static JSONObject convert(SecretHitlerGame game) {\n+ public static JSONObject convert(SecretHitlerGame game, String userName) {\n if (game == null) {\n throw new NullPointerException();\n }\n@@ -51,14 +68,22 @@ public static JSONObject convert(SecretHitlerGame game) {\n String[] playerOrder = new String[game.getPlayerList().size()];\n List<Player> playerList = game.getPlayerList();\n \n+ // Players should only be shown all roles under specific circumstances.\n+ Identity role = game.getPlayer(userName).getIdentity();\n+ boolean showAllRoles = game.hasGameFinished() || role == Identity.FASCIST\n+ || (role == Identity.HITLER && game.getPlayerList().size() <= 6);\n+\n for (int i = 0; i < playerList.size(); i++) {\n JSONObject playerObj = new JSONObject();\n Player player = playerList.get(i);\n \n playerObj.put(\"alive\", player.isAlive());\n \n- String id = player.getIdentity().toString();\n- playerObj.put(\"id\", id);\n+ // Only include player role for self or under specific rules\n+ if (player.getUsername().equals(userName) || showAllRoles) {\n+ String id = player.getIdentity().toString();\n+ playerObj.put(\"id\", id);\n+ }\n playerObj.put(\"investigated\", player.hasBeenInvestigated());\n \n playerData.put(player.getUsername(), playerObj);\n@@ -79,6 +104,8 @@ public static JSONObject convert(SecretHitlerGame game) {\n out.put(\"election-tracker\", game.getElectionTracker());\n out.put(\"election-tracker-advanced\", game.didElectionTrackerAdvance());\n \n+ out.put(\"last-policy\", game.getLastEnactedPolicy().toString().toUpperCase());\n+\n out.put(\"draw-size\", game.getDrawSize());\n out.put(\"discard-size\", game.getDiscardSize());\n out.put(\"fascist-policies\", game.getNumFascistPolicies());\n@@ -101,13 +128,15 @@ public static JSONObject convert(SecretHitlerGame game) {\n \n /**\n * Converts a list of policies into a string array.\n+ * \n * @param list the list of policies.\n- * @return a string array with the same length as the list, where each index is either \"FASCIST\" or \"LIBERAL\"\n+ * @return a string array with the same length as the list, where each index is\n+ * either \"FASCIST\" or \"LIBERAL\"\n * according to the type of the Policy at that index in the list.\n */\n public static String[] convertPolicyListToStringArray(List<Policy> list) {\n String[] out = new String[list.size()];\n- for(int i = 0; i < list.size(); i++) {\n+ for (int i = 0; i < list.size(); i++) {\n out[i] = list.get(i).getType().toString();\n }\n return out;\ndiff --git a/backend/src/main/java/server/util/Lobby.java b/backend/src/main/java/server/util/Lobby.java\nindex afeaf26..57c2b43 100644\n--- a/backend/src/main/java/server/util/Lobby.java\n+++ b/backend/src/main/java/server/util/Lobby.java\n@@ -10,6 +10,7 @@\n import java.io.IOException;\n import java.io.Serializable;\n import java.util.*;\n+import java.util.Map.Entry;\n import java.util.concurrent.ConcurrentHashMap;\n import java.util.concurrent.ConcurrentLinkedQueue;\n import java.util.concurrent.ConcurrentSkipListSet;\n@@ -291,8 +292,8 @@ synchronized public int getUserCount() {\n * updates all connected CpuPlayers after a set amount of time.\n */\n synchronized public void updateAllUsers() {\n- for (WsContext ws : userToUsername.keySet()) {\n- updateUser(ws);\n+ for (Entry<WsContext, String> entry : userToUsername.entrySet()) {\n+ updateUser(entry.getKey(), entry.getValue());\n }\n \n // Check if the game ended.\n@@ -365,10 +366,10 @@ public void run() {\n * SecretHitlerGame is sent\n * to the specified WsContext. ({@code GameToJSONConverter.convert()})\n */\n- synchronized public void updateUser(WsContext ctx) {\n+ synchronized public void updateUser(WsContext ctx, String userName) {\n JSONObject message;\n if (isInGame()) {\n- message = GameToJSONConverter.convert(game); // sends the game state\n+ message = GameToJSONConverter.convert(game, userName); // sends the game state\n message.put(SecretHitlerServer.PARAM_PACKET_TYPE, SecretHitlerServer.PACKET_GAME_STATE);\n } else {\n message = new JSONObject();\ndiff --git a/frontend/src/App.js b/frontend/src/App.js\nindex d4f0a26..4298e86 100644\n--- a/frontend/src/App.js\n+++ b/frontend/src/App.js\n@@ -53,6 +53,7 @@ import {\n PARAM_ELEC_TRACKER_ADVANCED,\n COMMAND_END_TERM,\n PARAM_LAST_STATE,\n+ PARAM_LAST_POLICY,\n STATE_PP_PEEK,\n PLAYER_IS_ALIVE,\n PARAM_TARGET,\n@@ -921,7 +922,7 @@ class App extends Component {\n this.queueAlert((\n <PolicyEnactedAlert\n hideAlert={this.hideAlertAndFinish}\n- policyType={liberalChanged ? LIBERAL : FASCIST}/>\n+ policyType={newState[PARAM_LAST_POLICY]}/>\n ));\n }\n \ndiff --git a/frontend/src/GlobalDefinitions.js b/frontend/src/GlobalDefinitions.js\nindex ed8d5ef..8860720 100644\n--- a/frontend/src/GlobalDefinitions.js\n+++ b/frontend/src/GlobalDefinitions.js\n@@ -118,5 +118,6 @@ export const PARAM_DISCARD_DECK = \"discard-size\";\n export const PARAM_PRESIDENT_CHOICES = \"president-choices\";\n export const PARAM_CHANCELLOR_CHOICES = \"chancellor-choices\";\n export const PARAM_TARGET = \"target-user\";\n+export const PARAM_LAST_POLICY = \"last-policy\";\n export const PARAM_DID_VETO_OCCUR = \"veto-occurred\";\n // </editor-fold>\ndiff --git a/frontend/src/util/PolicyDisplay.js b/frontend/src/util/PolicyDisplay.js\nindex 3b532a3..97c910b 100644\n--- a/frontend/src/util/PolicyDisplay.js\n+++ b/frontend/src/util/PolicyDisplay.js\n@@ -1,37 +1,48 @@\n-import React, {Component} from 'react';\n+import React, { Component } from \"react\";\n import PropTypes from \"prop-types\";\n-import './PolicyDisplay.css';\n-import {LIBERAL} from \"../GlobalDefinitions\";\n+import \"./PolicyDisplay.css\";\n+import { LIBERAL } from \"../GlobalDefinitions\";\n import LiberalPolicy from \"../assets/policy-liberal.png\";\n import FascistPolicy from \"../assets/policy-fascist.png\";\n \n class PolicyDisplay extends Component {\n- render() {\n- return (\n- <div id={\"legislative-policy-container\"}>\n- {this.props.policies.map((value, index) => {\n- let policyName = value === LIBERAL ? \"liberal\" : \"fascist\";\n- return (\n- <img\n- id={\"legislative-policy\"}\n- className={this.props.allowSelection ? \"selectable \" + (index === this.props.selection ? \" selected\" : \"\"):\"\"}\n- onClick={() => this.props.onClick(index)}\n- disabled={!this.props.allowSelection}\n- src={value === LIBERAL ? LiberalPolicy : FascistPolicy} // Toggles fascist/liberal policy\n- alt={\"A \" + policyName + \" policy.\" + (this.props.allowSelection ? \" Click to select.\" : \"\")}\n- />\n- );\n- } )}\n- </div>\n- );\n- }\n+\trender() {\n+\t\treturn (\n+\t\t\t<div id={\"legislative-policy-container\"}>\n+\t\t\t\t{this.props.policies.map((value, index) => {\n+\t\t\t\t\tlet policyName = value === LIBERAL ? \"liberal\" : \"fascist\";\n+\t\t\t\t\treturn (\n+\t\t\t\t\t\t<img\n+\t\t\t\t\t\t\tid={\"legislative-policy\"}\n+\t\t\t\t\t\t\tkey={index}\n+\t\t\t\t\t\t\tclassName={\n+\t\t\t\t\t\t\t\tthis.props.allowSelection\n+\t\t\t\t\t\t\t\t\t? \"selectable \" +\n+\t\t\t\t\t\t\t\t\t (index === this.props.selection ? \" selected\" : \"\")\n+\t\t\t\t\t\t\t\t\t: \"\"\n+\t\t\t\t\t\t\t}\n+\t\t\t\t\t\t\tonClick={() => this.props.onClick(index)}\n+\t\t\t\t\t\t\tdisabled={!this.props.allowSelection}\n+\t\t\t\t\t\t\tsrc={value === LIBERAL ? LiberalPolicy : FascistPolicy} // Toggles fascist/liberal policy\n+\t\t\t\t\t\t\talt={\n+\t\t\t\t\t\t\t\t\"A \" +\n+\t\t\t\t\t\t\t\tpolicyName +\n+\t\t\t\t\t\t\t\t\" policy.\" +\n+\t\t\t\t\t\t\t\t(this.props.allowSelection ? \" Click to select.\" : \"\")\n+\t\t\t\t\t\t\t}\n+\t\t\t\t\t\t/>\n+\t\t\t\t\t);\n+\t\t\t\t})}\n+\t\t\t</div>\n+\t\t);\n+\t}\n }\n \n PolicyDisplay.propTypes = {\n- policies: PropTypes.array.isRequired,\n- onClick: PropTypes.func, // If undefined, the policies cannot be selected.\n- selection: PropTypes.number,\n- allowSelection: PropTypes.bool,\n+\tpolicies: PropTypes.array.isRequired,\n+\tonClick: PropTypes.func, // If undefined, the policies cannot be selected.\n+\tselection: PropTypes.number,\n+\tallowSelection: PropTypes.bool,\n };\n \n-export default PolicyDisplay;\n\\ No newline at end of file\n+export default PolicyDisplay;", "diff_files": ["backend/src/main/java/game/SecretHitlerGame.java", "backend/src/main/java/server/SecretHitlerServer.java", "backend/src/main/java/server/util/GameToJSONConverter.java", "backend/src/main/java/server/util/Lobby.java", "frontend/src/App.js", "frontend/src/GlobalDefinitions.js", "frontend/src/util/PolicyDisplay.js"], "diff_status": "ok", "edit_files": ["backend/src/main/java/game/SecretHitlerGame.java", "backend/src/main/java/server/SecretHitlerServer.java", "backend/src/main/java/server/util/GameToJSONConverter.java", "backend/src/main/java/server/util/Lobby.java", "frontend/src/App.js", "frontend/src/GlobalDefinitions.js", "frontend/src/util/PolicyDisplay.js"], "edit_functions": ["backend/src/main/java/game/SecretHitlerGame.java:SecretHitlerGame", "backend/src/main/java/server/SecretHitlerServer.java:SecretHitlerServer.onWebSocketMessage", "backend/src/main/java/server/util/GameToJSONConverter.java:GameToJSONConverter", "backend/src/main/java/server/util/GameToJSONConverter.java:GameToJSONConverter.convert", "backend/src/main/java/server/util/GameToJSONConverter.java:GameToJSONConverter.convertPolicyListToStringArray", "backend/src/main/java/server/util/Lobby.java:Lobby.updateAllUsers", "backend/src/main/java/server/util/Lobby.java:Lobby.updateUser", "frontend/src/App.js:App.onGameStateChanged", "frontend/src/util/PolicyDisplay.js:PolicyDisplay", "frontend/src/util/PolicyDisplay.js:PolicyDisplay.render"], "added_functions": [], "supports_function_level": true, "additions": 0, "deletions": 0, "changed_files": 7, "patch_count": 1, "repo_stars": 0, "repo_license": ""} |
|
|