diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a962bc..1c45999 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,12 +38,12 @@ jobs: - name: Unzip Result run: | - cd /tmp/output - unzip MicroSDeck.zip + mkdir release && cd release + unzip /tmp/output/MicroSDeck.zip - name: Upload Artifacts to Github if: ${{ !env.ACT }} uses: actions/upload-artifact@v3 with: name: "MicroSDeck" - path: /tmp/output/MicroSDeck.zip + path: /release/MicroSDeck/* diff --git a/backend/src/ds.rs b/backend/src/ds.rs index 350e150..ac86014 100644 --- a/backend/src/ds.rs +++ b/backend/src/ds.rs @@ -24,6 +24,12 @@ impl StoreElement { _ => None, } } + fn as_game_ref(&self) -> Option<&Game> { + match self { + Self::Game(game) => Some(&game), + _ => None, + } + } fn as_card(&self) -> Option { match self { @@ -197,7 +203,7 @@ impl StoreData { .collect() } - pub fn list_cards_with_games(&self) -> Vec<(MicroSDCard, Vec)> { + pub fn list_cards_with_games(&self) -> Vec<(MicroSDCard, Vec<&Game>)> { self.nodes .iter() .filter_map(|node| { @@ -206,7 +212,7 @@ impl StoreData { node.1 .links .iter() - .filter_map(|key: &DefaultKey| self.nodes[*key].element.as_game()) + .filter_map(|key: &DefaultKey| self.nodes[*key].element.as_game_ref()) .collect() }) }) @@ -309,7 +315,7 @@ impl Store { self.data.lock().unwrap().list_games() } - pub fn list_cards_with_games(&self) -> Vec<(MicroSDCard, Vec)> { + pub fn list_cards_with_games(&self) -> Vec<(MicroSDCard, Vec<&Game>)> { self.data.lock().unwrap().list_cards_with_games() } } diff --git a/backend/store b/backend/store new file mode 100644 index 0000000..2694924 --- /dev/null +++ b/backend/store @@ -0,0 +1 @@ +{"nodes":[{"value":null,"version":0},{"value":{"element":{"Game":{"uid":"foo","name":"Nothing","size":0}},"links":[{"idx":2,"version":3}]},"version":3},{"value":{"element":{"Card":{"uid":"foo","libid":"libraryid","name":"Bazzinga"}},"links":[{"idx":1,"version":3}]},"version":3}],"node_ids":{"bar":{"idx":2,"version":3},"foo":{"idx":1,"version":3}}} \ No newline at end of file