Skip to content

Commit

Permalink
Merge pull request #527 from leih-lokal/518-new-item-statuses
Browse files Browse the repository at this point in the history
New item statuses
  • Loading branch information
muety authored Sep 8, 2024
2 parents 0d58ea8 + 6e9c3c0 commit 7d48e06
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 17 deletions.
11 changes: 0 additions & 11 deletions .github/dependabot.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && sudo apt install ./google-chrome-stable_current_amd64.deb

- name: Start CouchDB
run: docker-compose up -d couchdb
run: docker compose up -d couchdb

- name: Wait for CouchDB
uses: iFaxity/wait-on-action@v1
Expand All @@ -42,7 +42,7 @@ jobs:
delay: 500

- name: Insert Testdata
run: docker-compose up testdata_generator
run: docker compose up testdata_generator

- name: Run cypress integration tests
uses: cypress-io/github-action@v2
Expand Down
3 changes: 3 additions & 0 deletions Frontend/src/data/item/columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export default [
if (value === "outofstock") return "verliehen";
if (value === "reserved") return "reserviert";
if (value === "onbackorder") return "nicht verleihbar";
if (value === "lost") return "verschollen";
if (value === "repairing") return "in Reparatur";
if (value === "forsale") return "zu verkaufen";
},
backgroundColor: backgroundColorStatus,
},
Expand Down
24 changes: 24 additions & 0 deletions Frontend/src/data/item/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,30 @@ export default {
},
},
},
"verschollen": {
required_fields: ["status"],
selectors: {
status: {
$eq: "lost",
},
},
},
"in Reparatur": {
required_fields: ["status"],
selectors: {
status: {
$eq: "repairing",
},
},
},
"zu verkaufen": {
required_fields: ["status"],
selectors: {
status: {
$eq: "forsale",
},
},
},
"Kategorie Küche": {
required_fields: ["category"],
selectors: {
Expand Down
3 changes: 3 additions & 0 deletions Frontend/src/data/item/inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ export default {
{ value: "outofstock", label: "verliehen" },
{ value: "onbackorder", label: "nicht verleihbar" },
{ value: "reserved", label: "reserviert" },
{ value: "lost", label: "verschollen" },
{ value: "repairing", label: "in Reparatur" },
{ value: "forsale", label: "zu verkaufen" },
],
isCreatable: false,
isMulti: false,
Expand Down
5 changes: 4 additions & 1 deletion Frontend/src/data/rental/inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ const showNotificationsForItem = async (item) => {
outofstock: "verliehen",
reserved: "reserviert",
onbackorder: "temporär nicht verfügbar / in Reparatur",
lost: "verschollen",
repairing: "in Reparatur",
forsale: "zu verkaufen",
};
var status = statusMapping[item.status];
if (["outofstock", "reserved", "onbackorder"].includes(item.status)) {
if (["outofstock", "reserved", "onbackorder", "lost", "repairing", "forsale"].includes(item.status)) {
notifier.danger(
`${item.name} (${item.id}) ist nicht verfügbar, hat Status: ${status}`,
10000
Expand Down
7 changes: 5 additions & 2 deletions Frontend/src/database/WoocommerceClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ class WoocommerceClient {
}

_translateItemAttributesForWc(item) {
const translateStatus = (status) =>
status === "reserved" ? "outofstock" : status;
const translateStatus = (status) => {
if (["reserved"].includes(status)) return "outofstock";
if (["lost", "repairing", "forsale"].includes(status)) return "onbackorder";
return status;
}

const hasSynonyms = item.synonyms && item.synonyms.trim().length > 0;
const isRentedAndHasReturnDateInFuture =
Expand Down
2 changes: 1 addition & 1 deletion Frontend/test/integration_cypress/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const waitForPopupToClose = () =>
const clearFilter = () => cy.get(".multiSelectItem_clear").click();

const resetTestData = () =>
cy.exec("docker-compose up testdata_generator", {
cy.exec("docker compose up testdata_generator", {
timeout: 120000,
});

Expand Down

0 comments on commit 7d48e06

Please sign in to comment.