From 6e1734473f2b42e4c53e48af2d5226f38ad2e0d9 Mon Sep 17 00:00:00 2001 From: Kathryn Hodge Date: Tue, 29 Oct 2024 12:20:58 +0000 Subject: [PATCH 1/8] Initial app --- __pycache__/tickets.cpython-310.pyc | Bin 0 -> 1708 bytes app.py | 38 ++++++++++++++++++ static/styles.css | 58 ++++++++++++++++++++++++++++ templates/index.html | 49 +++++++++++++++++++++++ tickets.py | 29 ++++++++++++++ 5 files changed, 174 insertions(+) create mode 100644 __pycache__/tickets.cpython-310.pyc create mode 100644 app.py create mode 100644 static/styles.css create mode 100644 templates/index.html create mode 100644 tickets.py diff --git a/__pycache__/tickets.cpython-310.pyc b/__pycache__/tickets.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c56247805c7d6951772f12e6e3cfeefebf9c748e GIT binary patch literal 1708 zcmZux%Wm8@6eTHHBadgs&7*0XG)2%=RlpCR0g?cQ5uioeO(qLxWgrj)Q69+FJWOiP zb}(KgK(g&0Bujrzx7>EsU+ALfIaJ26>=5AP>yr20bMED|-|q^v-d_(!zXn45&Bf)0 zJ@FLXK7jZ|Xrbk6^jGSTE2RUh0<5GC4@9z-L#x#;?%%<7A)qG?m0t5Vd5dlvqlj?oC_0U`1j|X-=^lo&a%9)J2NvKnQS~RC!?*S>3pIyzGSyB zW?Qy4^Sqv$!fyTWWcT6j<0m_{_uOvJ{%~=cmXoqhQ#x#EA(D~o%Ee|A-uCKzm`Fn% z_=P)@Y+R(N>!#^=s^=Bwy)-?YXH|1z$dLE+l33@SgkZOfD;5Lkcdl_jQ%|Y(5aNOZ zsnu%%2EYNv5S&C9*K|k67$d!|yBIrq1HATJzX{=4HpxbX$!T@fIHw6u(Px;91S!%a z3Uq@UHT;K4iE^C}aJkN;_`Oa`eJ)K0M^__b$mGUH<}tj}a^M2WoR(LO$;R$I`5u!R zo*c_1()A1pbFAJ4OZ8q#?1tFa@(~)Ii+C_sah(j3Wt#Ek1aa;Sh6wmHGX0{R~hX zi?`w=Fls6PRHw`$Qi9^9I`Q#8r2%Ds7!l$Fu$We3mxuip5SlDqU2? z1svOZ)ilp4yN}80uKB_nYLfG#iLYtQ=S08t1osGE%%}=<`GVou(K-`S} E2krz>`~Uy| literal 0 HcmV?d00001 diff --git a/app.py b/app.py new file mode 100644 index 0000000..8885bff --- /dev/null +++ b/app.py @@ -0,0 +1,38 @@ +from flask import Flask, jsonify, request, render_template +from collections import deque + +app = Flask(__name__) + +waiting_list_queue = deque() +next_id = 1 + +@app.route('/') +def index(): + return render_template('index.html', waiting_list=list(waiting_list_queue)) + +@app.route('/reserve', methods=['POST']) +def reserve(): + global next_id + data = request.json + if 'name' in data: + reservation = {"id": next_id, "name": data['name']} + waiting_list_queue.append(reservation) + next_id += 1 + return jsonify({"message": "Reservation added", "reservation": reservation}), 201 + else: + return jsonify({"message": "Name is required"}), 400 + +@app.route('/waitinglist', methods=['GET']) +def get_waiting_list(): + return jsonify(list(waiting_list_queue)) + +@app.route('/seatNextGuest', methods=['POST']) +def process_reservation(): + if waiting_list_queue: + processed_reservation = waiting_list_queue.popleft() # Dequeue reservation + return jsonify({"message": "Reservation processed", "reservation": processed_reservation}), 200 + else: + return jsonify({"message": "No reservations in the queue"}), 200 + +if __name__ == '__main__': + app.run(debug=True) \ No newline at end of file diff --git a/static/styles.css b/static/styles.css new file mode 100644 index 0000000..97f1246 --- /dev/null +++ b/static/styles.css @@ -0,0 +1,58 @@ +/* styles.css */ + +body { + font-family: Arial, sans-serif; + background-color: #f9f9f9; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; +} + +.container { + background: #ffffff; + padding: 30px; + border-radius: 12px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + width: 300px; + text-align: center; +} + +h1, +h2 { + color: #333; +} + +button { + margin-top: 10px; + padding: 10px; + background-color: #007bff; + color: #ffffff; + border: none; + border-radius: 5px; + cursor: pointer; +} + +button:hover { + background-color: #0056b3; +} + +input[type="text"] { + padding: 10px; + border: 1px solid #ddd; + border-radius: 5px; + width: 100%; + margin-bottom: 10px; +} + +ul { + list-style: none; + padding: 0; +} + +li { + padding: 8px; + background: #eee; + margin-bottom: 5px; + border-radius: 5px; +} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..8970a96 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,49 @@ + + + + + + + Restaurant Waiting List + + + + +
+

Restaurant Waiting List

+ +
+ + +
+ +

Current Waiting List

+
    + {% for reservation in waiting_list %} +
  • {{ reservation['name'] }} (ID: {{ reservation['id'] }})
  • + {% endfor %} +
+ + +
+ + + + + \ No newline at end of file diff --git a/tickets.py b/tickets.py new file mode 100644 index 0000000..afd93d8 --- /dev/null +++ b/tickets.py @@ -0,0 +1,29 @@ +class Ticket: + def __init__(self, id, description, status='Open'): + self.id = id + self.description = description + self.status = status + +class TicketManager: + def __init__(self): + self.tickets = [] + self.next_id = 1 + + def create_ticket(self, description): + ticket = Ticket(self.next_id, description) + self.tickets.append(ticket) + self.next_id += 1 + return ticket + + def get_all_tickets(self): + return self.tickets + + def update_ticket_status(self, ticket_id, status): + for ticket in self.tickets: + if ticket.id == ticket_id: + ticket.status = status + return ticket + return None + + def delete_ticket(self, ticket_id): + self.tickets = [ticket for ticket in self.tickets if ticket.id != ticket_id] From 2dfc6956314b0636281af7c4590f157c7898850d Mon Sep 17 00:00:00 2001 From: Kathryn Hodge Date: Tue, 29 Oct 2024 12:21:11 +0000 Subject: [PATCH 2/8] Remove comment --- static/styles.css | 2 -- 1 file changed, 2 deletions(-) diff --git a/static/styles.css b/static/styles.css index 97f1246..b7978cd 100644 --- a/static/styles.css +++ b/static/styles.css @@ -1,5 +1,3 @@ -/* styles.css */ - body { font-family: Arial, sans-serif; background-color: #f9f9f9; From 5ba57bd438eaf3e69122973a265fc0fdd3985bf4 Mon Sep 17 00:00:00 2001 From: Kathryn Hodge Date: Wed, 30 Oct 2024 11:37:49 +0000 Subject: [PATCH 3/8] Starter --- .vscode/settings.json | 1 - app.py | 28 ++++++++++++++++------------ templates/index.html | 2 +- tickets.py | 29 ----------------------------- 4 files changed, 17 insertions(+), 43 deletions(-) delete mode 100644 tickets.py diff --git a/.vscode/settings.json b/.vscode/settings.json index 2369810..ca20f95 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,7 +17,6 @@ "files.autoSave": "afterDelay", "screencastMode.onlyKeyboardShortcuts": true, "terminal.integrated.fontSize": 18, - "workbench.activityBar.visible": true, "workbench.colorTheme": "Visual Studio Dark", "workbench.fontAliasing": "antialiased", "workbench.statusBar.visible": true diff --git a/app.py b/app.py index 8885bff..309b4b7 100644 --- a/app.py +++ b/app.py @@ -3,36 +3,40 @@ app = Flask(__name__) -waiting_list_queue = deque() +waiting_list = None # TODO: Add data structure next_id = 1 @app.route('/') def index(): return render_template('index.html', waiting_list=list(waiting_list_queue)) -@app.route('/reserve', methods=['POST']) -def reserve(): +@app.route('/addToWaitingList', methods=['POST']) +def add_to_waiting_list(): global next_id data = request.json if 'name' in data: - reservation = {"id": next_id, "name": data['name']} - waiting_list_queue.append(reservation) + # TODO: Create guest to add to waiting list + # data['name'] holds the name of the guest to add to the list + guest = None + # TODO: Add guest to waiting list next_id += 1 - return jsonify({"message": "Reservation added", "reservation": reservation}), 201 + return jsonify({"message": "Guest added", "reservation": guest}), 201 else: return jsonify({"message": "Name is required"}), 400 @app.route('/waitinglist', methods=['GET']) def get_waiting_list(): - return jsonify(list(waiting_list_queue)) + # TODO: Return all the guests on the waiting_list + return jsonify(waiting_list) @app.route('/seatNextGuest', methods=['POST']) -def process_reservation(): - if waiting_list_queue: - processed_reservation = waiting_list_queue.popleft() # Dequeue reservation - return jsonify({"message": "Reservation processed", "reservation": processed_reservation}), 200 +def seat_guest(): + if waiting_list: + # TODO: Seat first guest on waiting list + processed_guest = None + return jsonify({"message": "Guest seated", "seated_guest": processed_guest}), 200 else: - return jsonify({"message": "No reservations in the queue"}), 200 + return jsonify({"message": "No guests in the queue"}), 200 if __name__ == '__main__': app.run(debug=True) \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 8970a96..757ccc6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -31,7 +31,7 @@

Current Waiting List

document.getElementById('reservation-form').addEventListener('submit', async (e) => { e.preventDefault(); const name = document.getElementById('customer-name').value; - await fetch('/reserve', { + await fetch('/addToWaitingList', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name }) diff --git a/tickets.py b/tickets.py deleted file mode 100644 index afd93d8..0000000 --- a/tickets.py +++ /dev/null @@ -1,29 +0,0 @@ -class Ticket: - def __init__(self, id, description, status='Open'): - self.id = id - self.description = description - self.status = status - -class TicketManager: - def __init__(self): - self.tickets = [] - self.next_id = 1 - - def create_ticket(self, description): - ticket = Ticket(self.next_id, description) - self.tickets.append(ticket) - self.next_id += 1 - return ticket - - def get_all_tickets(self): - return self.tickets - - def update_ticket_status(self, ticket_id, status): - for ticket in self.tickets: - if ticket.id == ticket_id: - ticket.status = status - return ticket - return None - - def delete_ticket(self, ticket_id): - self.tickets = [ticket for ticket in self.tickets if ticket.id != ticket_id] From 85bd541889e67f2040f73073023f8edf68eb62bd Mon Sep 17 00:00:00 2001 From: Kathryn Hodge Date: Wed, 30 Oct 2024 12:02:26 +0000 Subject: [PATCH 4/8] update --- app.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app.py b/app.py index 309b4b7..eb2d2e3 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,4 @@ from flask import Flask, jsonify, request, render_template -from collections import deque app = Flask(__name__) @@ -8,7 +7,8 @@ @app.route('/') def index(): - return render_template('index.html', waiting_list=list(waiting_list_queue)) + # TODO: Return all the guests on the waiting_list + return render_template('index.html', waiting_list=waiting_list) @app.route('/addToWaitingList', methods=['POST']) def add_to_waiting_list(): @@ -24,11 +24,6 @@ def add_to_waiting_list(): else: return jsonify({"message": "Name is required"}), 400 -@app.route('/waitinglist', methods=['GET']) -def get_waiting_list(): - # TODO: Return all the guests on the waiting_list - return jsonify(waiting_list) - @app.route('/seatNextGuest', methods=['POST']) def seat_guest(): if waiting_list: @@ -39,4 +34,4 @@ def seat_guest(): return jsonify({"message": "No guests in the queue"}), 200 if __name__ == '__main__': - app.run(debug=True) \ No newline at end of file + app.run(debug=True) From 5e9c9f49f3da2b69c360df4bfb3f2818d7b66932 Mon Sep 17 00:00:00 2001 From: Kathryn Hodge Date: Wed, 4 Dec 2024 17:25:44 +0000 Subject: [PATCH 5/8] Add --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index b18d513..7c3587d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ requests>=2.28 +flask>=3.1.0 \ No newline at end of file From 02c96f896cfe27c24ec382f1651e7ee118722d7e Mon Sep 17 00:00:00 2001 From: smoser-LiL Date: Mon, 10 Feb 2025 18:56:20 +0000 Subject: [PATCH 6/8] Moving files using main --- NOTICE | 185 +++++++++++++++++++++++++++++++++++++++++++++++++++++- README.md | 23 ++++--- 2 files changed, 197 insertions(+), 11 deletions(-) diff --git a/NOTICE b/NOTICE index 91b11b7..da8e20f 100644 --- a/NOTICE +++ b/NOTICE @@ -1,11 +1,15 @@ -Copyright 2023 LinkedIn Corporation +Copyright 2025 LinkedIn Corporation All Rights Reserved. Licensed under the LinkedIn Learning Exercise File License (the "License"). See LICENSE in the project root for license information. ATTRIBUTIONS: -[PLEASE PROVIDE ATTRIBUTIONS OR DELETE THIS AND THE ABOVE LINE “ATTRIBUTIONS”] + +requests +https://github.com/psf/requests/ +License: Apache 2.0 +http://www.apache.org/licenses/ Please note, this project may automatically load third party code from external repositories (for example, NPM modules, Composer packages, or other dependencies). @@ -13,3 +17,180 @@ If so, such third party code may be subject to other license terms than as set forth above. In addition, such third party code may also depend on and load multiple tiers of dependencies. Please review the applicable licenses of the additional dependencies. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + ""License"" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + ""Licensor"" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + ""Legal Entity"" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + ""control"" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + ""You"" (or ""Your"") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + ""Source"" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + ""Object"" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + ""Work"" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + ""Derivative Works"" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + ""Contribution"" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, ""submitted"" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as ""Not a Contribution."" + + ""Contributor"" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a ""NOTICE"" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an ""AS IS"" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/README.md b/README.md index da8c7ec..0c9a55d 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,15 @@ # Programming Foundations: Data Structures This is the repository for the LinkedIn Learning course Programming Foundations: Data Structures. The full course is available from [LinkedIn Learning][lil-course-url]. -![course-name-alt-text][lil-thumbnail-url] +![course-name-alt-text][lil-thumbnail-url] + +## Course Description + +This course provides a comprehensive introduction to fundamental data structures, equipping you with the skills you need to implement and utilize arrays, lists, dictionaries, stacks, and queues effectively. Through hands-on exercises and real-world examples, instructor Kathryn Hodge shows you each of how these structures operate, including their efficiency in terms of time and space complexity. An ideal fit for learners new to programming, this course emphasizes practical applications, enabling you to solve common software problems such as searching, sorting, and data management. Additionally, you'll learn to analyze the trade-offs of different data structures and apply this knowledge to design scalable and efficient solutions. By the end of the course, you'll have the tools and know-how to start tackling complex programming challenges with confidence. _See the readme file in the main branch for updated instructions and information._ ## Instructions -This repository has branches for each of the videos in the course. You can use the branch pop up menu in github to switch to a specific branch and take a look at the course at that stage, or you can add `/tree/BRANCH_NAME` to the URL to go to the branch you want to access. +This repository has branches for some of the videos in the course. You can use the branch pop up menu in github to switch to a specific branch and take a look at the course at that stage, or you can add `/tree/BRANCH_NAME` to the URL to go to the branch you want to access. ## Branches The branches are structured to correspond to the videos in the course. The naming convention is `CHAPTER#_MOVIE#`. As an example, the branch named `02_03` corresponds to the second chapter and the third video in that chapter. @@ -22,15 +26,16 @@ To resolve this issue: Add changes to git using this command: git add . Commit changes using this command: git commit -m "some message" -## Installing -1. To use these exercise files, you must have the following installed: - - [list of requirements for course] -2. Clone this repository into your local machine using the terminal (Mac), CMD (Windows), or a GUI tool like SourceTree. -3. [Course-specific instructions] +## Instructor + +Kathryn Hodge + +Software Developer +Check out my other courses on [LinkedIn Learning](https://www.linkedin.com/learning/instructors/kathryn-hodge?u=104). [0]: # (Replace these placeholder URLs with actual course URLs) -[lil-course-url]: https://www.linkedin.com/learning/ -[lil-thumbnail-url]: http:// +[lil-course-url]: https://www.linkedin.com/learning/programming-foundations-data-structures-25191158 +[lil-thumbnail-url]: https://media.licdn.com/dms/image/v2/D4E0DAQEbMUqPXFmo3Q/learning-public-crop_675_1200/B4EZS4gxWyHoAg-/0/1738262386940?e=2147483647&v=beta&t=4V8QRSAfBZCIob_xSd_b2KONijT15H_N745p6yFZrFw From eafbc999a1672e9d47ecbe9a6b449c7dc4f4da18 Mon Sep 17 00:00:00 2001 From: rschnaidman-blip Date: Tue, 13 Jan 2026 19:52:04 +0000 Subject: [PATCH 7/8] Initial commit From 2707ae048d5cbac75a87987d22ac89312e3244ef Mon Sep 17 00:00:00 2001 From: rschnaidman-blip Date: Tue, 13 Jan 2026 19:52:04 +0000 Subject: [PATCH 8/8] Pending changes exported from your codespace --- app.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index eb2d2e3..9d9debe 100644 --- a/app.py +++ b/app.py @@ -2,7 +2,7 @@ app = Flask(__name__) -waiting_list = None # TODO: Add data structure +waiting_list = [] TODO: Add data structure next_id = 1 @app.route('/') @@ -17,9 +17,13 @@ def add_to_waiting_list(): if 'name' in data: # TODO: Create guest to add to waiting list # data['name'] holds the name of the guest to add to the list - guest = None - # TODO: Add guest to waiting list next_id += 1 + guest = { + 'id' : next_id, + 'name' : data['name'] + } + # TODO: Add guest to waiting list + waiting_list.append(guest) return jsonify({"message": "Guest added", "reservation": guest}), 201 else: return jsonify({"message": "Name is required"}), 400 @@ -28,7 +32,7 @@ def add_to_waiting_list(): def seat_guest(): if waiting_list: # TODO: Seat first guest on waiting list - processed_guest = None + processed_guest = waiting_list.pop(0) return jsonify({"message": "Guest seated", "seated_guest": processed_guest}), 200 else: return jsonify({"message": "No guests in the queue"}), 200