Group8_GOAT_666 Sprint Essay 2 (November 23–24)
Project: ShanHai-Travel (山海行, an online travel platform) · Team: GOAT_666
Sprint: eight days, 2026-11-21 → 2026-11-28 · Essay 2 of 4 — Days 3–4 (Nov 23–24)
Course objective covered: CO3 — apply an engineering process to a real, incrementally delivered system
Repository: https://github.com/ZZH666-A11Y/shanhai-travel
| Which course does this assignment belong to | MIEC EE308FZ (Software Engineering, FZU–MU) |
|---|---|
| Where are the requirements for this assignment | Fifth Assignment — Alpha Sprint (https://bbs.csdn.net/topics/620611106) |
| The goal of this assignment | Report the Day-4 checkpoint (2026-11-23 → 11-24) of the Alpha Sprint: the first write path (orders, favourites, comments, uploads), the first seven screens on the real API, and the data and documentation checks behind them — 82/120 story points |
| Team / project | GOAT_666 · ShanHai-Travel (山海行) · https://github.com/ZZH666-A11Y/shanhai-travel |
| Previous essay | Sprint Essay 1 — https://bbs.csdn.net/topics/620617900 |
| Other references | The Art of Construction; docs/API.md; MySQL 8.0 Reference Manual (information_schema) |
1. Where the checkpoint stands
This is the second of four sprint reports for ShanHai-Travel, an online travel platform built by team GOAT_666. At this
checkpoint , the application accepts its first writes — orders, favourites, comments, uploads — and stands at 82 of 120 story points.
Essay 1 described the sprint and where it ended. This post is the record of the Day-4 checkpoint and, more
importantly, the evidence behind it — the evening of November 24th, when the application could finally write.
At the end of Day 2 the system could read. A page asked /api/destinations and MySQL answered with nine rows;
authentication issued a JWT and the catalogue respected it. What it could not do was accept anything from the
user: every favourite, comment and order was still a string in browser storage, and pressing F5 erased it.
Two days later the sprint stands at 82 of 120 story points (68 %), an increase of 36 points. The number
matters less than what it represents: seven screens now render rows that came over HTTP, and the first write
path — favourites, comments, orders, uploads — lands in tables.
2. Breaking the Write Goal into Testable Claims
The goal of this block was to make the application write: users should be able to
favourite places, post comments, place orders and upload images — and have all of it
survive a page refresh. But "the system can write" is too vague to verify, so before
writing any code we broke it down into three concrete, testable claims:
Persistence. Anything a user creates in the browser — a favourite, a comment,
an order — must still exist after refreshing the page, and must be visible to a
second client (another browser or another user's session). In other words, the
data lives in MySQL, not inlocalStorage.Atomicity. An order is never half-written. Creating an order writes both the
order header and its line items inside a single database transaction; the order
number is unique; and an order markedpaidalways carries a payment timestamp.
If any part fails, nothing is saved.One source of authentication truth. In the prototype, some pages decided
"is this user logged in?" by reading a role flag stored inlocalStorage, while
other pages trusted the JWT from the API. This meant a page could look logged-in
before a refresh and logged-out after it — a bug invisible in a demo but obvious
to a grader. By Day 4, thoselocalStorageshortcuts must be removed, not
papered over: every page derives its identity from the API token alone.
These three claims define what "done" means for this checkpoint. Everything in §4
and §5 — the write path, the seven migrated screens, and the six data-layer queries —
is evidence collected against them.
The scope itself stayed fixed at 120 story points. What changed was the kind of
evidence: on Day 2 we verified by reading HTTP responses; by Day 4 we verify by
reading rows.
3. Burn-up at the Day-4 checkpoint

Figure 1 — Burn-up at the end of Day 4 (Nov 24). Daily completed work: 0, 18, 46, 63, 82 SP against an ideal
line of 15 SP/day, so the checkpoint sits 22 SP ahead of plan. The shape is deliberate: block 1 is a steep
segment because a database is delivered in one piece, block 2 flattens because pages are wired one at a time and
each one has to be verified before the next starts, and the curve is expected to steepen again when the admin
console and the dashboard are closed as a batch. The dotted segment is the projection, not a result.
4. What was built
4.1 The write path, stated as invariants
The three routers added in this block are unremarkable by themselves; what matters is the set of invariants they
enforce, because those are what the data checks in §4.3 test.
- Order creation is a transaction.
POST /api/orderswritesordersandorder_itemsinsidewithTransaction, and the order number is generated server-side (SH+ timestamp + counter) and protected byUNIQUE KEY uk_order_no. A failure while writing items rolls the header back; there is no repair job and no
"pending items" state to clean up later. - Payment is a state machine with one legal exit per state.
pending → paidwritespaid_atandpay_methodand returnsmock: true;pending → cancelledandpaid → refundedare the only other moves.
No payment SDK is called, no amount leaves the machine, and the response tells the client it was a simulation
every time. - Social writes are idempotent where the UI needs them to be. A comment is one row with a target
(destination/guide/post); a favourite is one row per(user_id, target_type, target_id)underUNIQUE KEY uk_fav, so a double click cannot produce two "collected" states. - Uploads are bounded before they reach disk. Nine files, 5 MB each,
jpg/png/webp/gifonly — the limits are
inmulterand the rejection path returns a code the page can display.
The API commit also carries the admin and analytics routers. They are part of the code that landed on Day 2, but
they are counted at the Day-6 checkpoint, not here — a distinction worth keeping when the burn-up is read.
4.2 Seven screens move onto the real API
The pages migrated in this block are home, destinations, destination detail, guides, guide detail, login and
favourites. The user-visible result is deliberately unspectacular: the layout is the one that was approved in
the prototype. What changed is underneath.
- The destinations list is a 384-line ES5 module with a 300 ms debounce, a
seqguard so a slow response cannot
overwrite a newer search, a date window (from/to) and three sort modes — all resolved in SQL, not by
filtering an array in the browser. - The destination detail page lost 21 KB of demo script and about a fifth of its HTML weight (85 KB → 64 KB):
fake ticket stock, gallery filter chips and an invented "sold out" state were deleted rather than wired to
nothing. - The login page kept its demo buttons but changed their meaning: they fill the fields, they do not authenticate
anything. The only way in isPOST /api/auth/login, and the token it returns is what every later request
carries.

Figure 2 — favorites.html. Seven favourites, dated 2026-11-10 to 2026-11-21 — some of them created before
this block existed. They survived restarts, browser sessions and two days of page rewrites, which is exactly
proposition P1 in §2. The four filter chips ("全部 / 目的地 / 攻略 / 游记") map to ?type= on the API, not toArray.filter on a hard-coded list.
4.3 Data-layer verification
Pages prove that a request was made. They do not prove that the data underneath is consistent, so the block was
also checked from the database side, with six queries. Each one is a claim that can fail.
| # | Check | Query | Result |
|---|---|---|---|
| 1 | Schema is complete | information_schema.TABLES where schema = shanhai_travel | 17 tables; 9 destinations, 8 users, 17 comments, 11 favourites, 4 posts, 7 orders |
| 2 | No orphan rows | LEFT JOIN ... WHERE parent.id IS NULL on orders, order_items, favorites, comments, posts | 0 / 0 / 0 / 0 / 0 |
| 3 | Money is exact | count of DECIMAL columns; SUM(orders.amount) − SUM(order_items.subtotal) | 13 DECIMAL columns — money in decimal(10,2), ratings in decimal(3,1); difference 0.00 |
| 4 | The state machine holds | GROUP BY status; WHERE status IN ('paid','refunded') AND paid_at IS NULL | pending 1 / paid 4 (¥4,096) / cancelled 1 (¥2,180) / refunded 1 (¥1,200); 0 orders paid without a payment time |
| 5 | Analytics has an input | COUNT(*), distinct days and range of page_views | 1,617 rows over 31 days (2026-10-25 → 2026-11-24) |
| 6 | The room query | SELECT hr.* FROM hotel_rooms hr WHERE hr.city='大理' | ER_BAD_FIELD_ERROR: Unknown column 'hr.city' — defect B-04 below |
Two of those checks turned into defects: check 5 exposed B-03, and check 6 exposed B-04.
B-03 — the dashboard was all zeros, and the chart was innocent. The aggregation endpoint returned a flat
line because page_views had no rows: the logging middleware only writes when a page is requested withAccept: text/html, and the schema had been created after the last browsing session. The fix was not in the
chart. init-db.js now synthesises thirty days of history (1,617 rows), and the endpoint zero-fills the daily
series so a quiet day still returns a point.
B-04 — three room types were listed, but the page priced one room. The room lookup filtered onhotel_rooms.city, a column that does not exist — the city lives on hotels. MySQL answeredUnknown column 'hr.city', and the page silently fell back to a single default room. The corrected query joinshotel_rooms → hotels, filters on hotels.city and sorts by price ascending, so the base room is the cheapest
and the "upgrade" delta can never be negative:
SELECT h.name AS hotel, hr.name AS room, hr.price
FROM hotel_rooms hr
JOIN hotels h ON hr.hotel_id = h.id
WHERE h.city = '大理'
ORDER BY hr.price;
-- 洱海云舍·海景民宿 / 湖景大床房 / 688.00
-- 洱海云舍·海景民宿 / 露台双床房 / 788.00
The lesson is not "we had two bugs". It is that both were assumptions about data — that a table has rows,
that a column exists — and neither could be caught by looking at a page that renders.
4.4 Documentation audit
The API reference is a deliverable in its own right: it is what the next person reads before writing a client.
It was audited against the code in this block, and the audit found the kind of drift that is invisible until
someone relies on it.
| What the document says | What the code does |
|---|---|
Error code BAD_CREDENTIAL | emits BAD_CREDENTIALS |
Error code DB_ERROR | emits DB_DOWN for a dead pool, INTERNAL_ERROR for an unexpected throw |
| nine error codes in the table | twenty-nine distinct code strings across the backend, several of them undocumented (SELF_EDIT, BAD_STATUS, USERNAME_TAKEN, EMAIL_TAKEN, NO_FILE, EMPTY_ITEMS …) |
The document covers eleven sections and forty endpoint rows, which is enough to write a client against — but a
client that switches on BAD_CREDENTIAL would never match, and one that treats DB_DOWN as unknown would show
a generic error where the page could say "database unavailable". The corrections were queued for the release
commit rather than applied in a hurry on Day 4; the important part is that the list exists and is short enough
to finish.
5. Running evidence
All captures are of the local system, with the Node server and MySQL both up, afterinit-db.js. Each one is impossible without the API returning rows.

Figure 3 — destination-detail.html?id=1, "旅人评价" tab. The three visible comments are three rows ofcomments with user_id, rating and created_at; the names beside them are joins on users. The
aggregate 4.9 / 1 286 条评价 comes from destinations.rating and destinations.review_count, which are
recomputed in the same handler when a review is posted — the star row and the counter cannot drift apart.

Figure 4 — guides.html. Eight cards, each with author, destination, reading time and a cover, produced by a
three-table join on the server. The dates ("11 月 24 日") are posts.created_at, not a hard-coded string.

Figure 5 — guide-detail.html?id=1. The id in the URL is a primary key: the title, author, publish date, view
counter and body all come from one GET /api/guides/1. The body is rendered paragraph by paragraph after
escaping, which is why the text keeps its spacing but cannot inject markup.

Figure 6 — login.html. The "SMS code" countdown of the prototype is gone. What remains is a credential form
that posts to /api/auth/login; the demo buttons at the bottom only fill the fields. The identity card in the
corner reads "游客(未登录)" until a token exists, and that is the only source of truth the page has.

Figure 7 — the home page assistant, after asking "想去看海,四天,预算三千". The reply is generated byPOST /api/ai/plan, a local keyword rule engine — no model API — and the card it returns links into a real
destination id. It is a small feature, but it is the first place where a page's content is invented by the
server rather than laid out by the designer.

Figure 8 — GET /api/favorites for the same session. The page in Figure 2 is a rendering of this payload:
seven rows, each with target_type, target_id, created_at and a title resolved by the join. This is the
shortest way to show that the favourites page is not reading a list the browser kept.
6. Code check-in records
The block integrated in two commits on main.
| Commit | Date | Subject | Issues closed |
|---|---|---|---|
| 3eb4043 | 2026-11-22 22:20 | feat(api): build Express + MySQL backend with 40+ REST endpoints | #11 #12 #13 |
| 8fa743b | 2026-11-24 19:35 | feat(web): wire all 13 pages to the real API and drop localStorage demo state | #16 #17 #18 #19 #25 |
| Issue | Owner | Commit | Files | What the diff does |
|---|---|---|---|---|
| #11 | 刘睿智 | 3eb4043 | backend/src/routes/social.js | posts CRUD with paging and filters, comments on three target types, favourites list / toggle / delete with the uk_fav uniqueness rule |
| #12 | 刘睿智 | 3eb4043 | backend/src/routes/booking.js | transactional order creation, order_no generation, mock pay with paid_at / pay_method, cancel and refund, order list with nested items |
| #13 | 刘睿智 | 3eb4043 | backend/src/routes/upload.js | multer disk storage, 9-file and 5 MB limits, MIME allow-list, {urls, files} response |
| #16 | 赵子涵 | 8fa743b | frontend/home.html | recommendation grid, guide rail, notice bar, four counters and the assistant dialog bound to SH.API |
| #17 | 赵子涵 | 8fa743b | frontend/destinations.html, frontend/js/page-destinations.js | server-side filter / date window / sort / paging with debounce and a race guard |
| #18 | 赵子涵 | 8fa743b | frontend/destination-detail.html | gallery, tickets, experiences and reviews bound to the aggregate response; demo controls removed |
| #19 | 赵子涵 | 8fa743b | frontend/guides.html, frontend/guide-detail.html | type filter, keyword search, escaped paragraph rendering, comment form |
| #25 | 赵子涵 | 8fa743b | frontend/favorites.html, frontend/login.html | favourites grid with type filter and unfavourite; real login with ?next= whitelist and a register tab |
A word about granularity, because it is the weakest part of our process: five integration commits for 145 files
means an issue is traceable only as commit + file set, not as a commit of its own. The next block changes that
to one branch and one commit per issue, which is why the table above has a file column instead of a diff link.
7. Verification at this checkpoint
| What was checked | How | Result |
|---|---|---|
| The block's new routes | hand-run transcript: create a post, comment on a destination and a guide, toggle a favourite twice, create an order, pay it, cancel another, upload an image | all paths returned the documented envelope; the double toggle returned the same state, not two rows |
| Manual UI pass, batch 1 | 11 cases across the seven migrated pages | 10 passed; 1 failed — the room list priced one room (B-04) |
| Regression after fixes | the same transcript plus the 11 cases | pass |
| Data consistency | the six queries in §4.3 | see the table |
| Documentation | the audit in §4.4 | 2 mismatched error codes, 6 undocumented ones |
The automated suite is not counted here. At this checkpoint it was still the twelve-case v0 harness from Day 2;
it reached its final 43 assertions on Day 6, and that number belongs to the next essay rather than this one.
8. Two lessons
(a) The expensive bugs live in the data assumptions, not in the logic. Both defects of this block were
statements about the database that happened to be false — an empty table, a column that was on the other table.
Neither would have been caught by reading the handler code, and both were caught within minutes by asking the
database directly. A page that renders is not evidence that the data is right.
(b) A document that drifts is worse than no document. docs/API.md was written early and stayed readable,
which is precisely why it is dangerous: a client written against BAD_CREDENTIAL fails silently against a
server that emits BAD_CREDENTIALS. The audit turned the reference back into a checklist, and the release
commit applies it.
9. Plan for the next block (Nov 25–26)
- Close the remaining screens: booking wizard, account centre, publish page, admin console, insights
dashboard, and remove the lastlocalStorageresidue (#20–#24, #26). - Close B-05 and B-06, extend the manual sheet to 18 cases and freeze the test report.
- Produce the eighteen-capture evidence set the release documentation needs.
- Target for the Day-6 checkpoint: 108 / 120 SP (90 %).
10. Process data (PSP)
| Member | Role | Est. (h) | Actual (h) | % of block effort |
|---|---|---|---|---|
| 刘睿智 | backend: social, booking, upload, integration | 10.5 | 11.0 | 34 % |
| 赵子涵 | front end: seven screens on the real API | 12.0 | 12.4 | 38 % |
| 张泽新 | test: harness extension, triage, retest | 4.5 | 4.8 | 15 % |
| 何智铧 | test: browser sweep, captures, empty states | 4.0 | 4.2 | 13 % |
| Block total | 31.0 | 32.4 | 100 % |
Estimate accuracy for the block: +4.5 % (31.0 h estimated against 32.4 h actual), concentrated in the
destination list and the detail page, the two screens with the most hidden state.
Support work in this block, recorded separately because it is not development time and is not part of the
32.4 h above:
| Member | Task | Actual (h) | Artefact |
|---|---|---|---|
| 林隆哲 | data-layer verification, two defect reproductions, order-state assertions | 2.5 | the six checks in §4.3, the SQL in §4.3 |
| 谢泽睿 | contract coverage, documentation audit, this report | 3.0 | §4.4, §5 captions, this essay |
11. Conclusion
Day 4 is the point where the project stopped being a catalogue with a login form. Accounts, favourites, comments
and orders now live in MySQL, an order is written in a transaction with a number that cannot collide, and the
pages that show them are views of a payload rather than of a script. The two defects found while checking that
claim — an empty table and a column on the wrong table — are the most useful thing the block produced, because
they are the kind of failure that a screenshot can never show.
References
- Course assignment sheet, Fifth Assignment — Alpha Sprint (https://bbs.csdn.net/topics/620611106).
- Sprint Essay 1 — https://bbs.csdn.net/topics/620617900.
- ShanHai-Travel repository, branch
main— https://github.com/ZZH666-A11Y/shanhai-travel. docs/API.md— the interface reference audited in §4.4.docs/sprint/test-report.md— defect log B-01 … B-09, source of the numbering used here.- MySQL 8.0 Reference Manual — INFORMATION_SCHEMA TABLES / COLUMNS / STATISTICS.
- RFC 7519 — JSON Web Token (JWT).
- Express 4.x documentation — Routing, Error Handling, Static Files.
相关推荐
智慧城市工程施工管理智能体理场景的设计与实施方案.docx
智慧城市工程施工管理智能体理场景的设计与实施方案.docx
数字医院医疗质量智能体理场景的设计与实施方案.docx
数字医院医疗质量智能体理场景的设计与实施方案.docx
【风力涡轮发电机】用于电磁暂态(EMT)研究的第四类(即全变流器)风力发电机系统的通用模型研究(Simulink仿真实现)
内容概要:本文研究了一种用于电磁暂态(EMT)仿真的第四类全变流器型风力发电机系统的通用化建模方法,并基于Simulink平台实现了该模型的仿真。该模型全面涵盖了风力机气动特性、传动系统动力学、发电机电气特性、全功率电力电子变流器及其核心控制策略,包括最大功率点跟踪(MPPT)、有功与无功功率解耦控制、电网同步控制等,旨在为高比例风电接入的现代电力系统提供一个高精度、高效率的动态仿真工具。研究重点在于构建能够准确反映全变流器风机在各类电网扰动下动态响应行为的综合性模型,以支撑复杂电网的暂态稳定性分析、并网适应性评估、保护与控制策略的验证。文中详细阐述了各子系统模块的数学建模原理、参数设计依据及模块间的耦合关系,并通过不同运行工况下的仿真结果,验证了所建模型的动态准确性和工程实用性。; 适合人群:具备电力系统分析、电力电子技术、自动控制理论及Matlab/Simulink仿真基础的研究生、高校科研人员以及从事新能源发电并网仿真、电力系统规划与运行的工程技术人员。; 使用场景及目标:①研究高渗透率风电对电网电磁暂态过程(如短路故障、电压跌落)的影响机制;②开发与验证适用于风电场的新型继电保护、低电压穿越(LVRT)及高电压穿越(HVRT)控制策略;③进行含大规模风电的电力系统小干扰与大干扰稳定性评估;④作为高等院校相关专业进行风力发电系统动态特性教学与科研的先进仿真案例。; 阅读建议:读者应结合Matlab/Simulink环境,亲手搭建并调试文中所述模型,尤其关注变流器双闭环(电流环、电压环)控制器的设计、参数整定及其与电网强度的交互影响,建议深入研读文中引用的经典文献以巩固对风电机组控制理论与实践的理解。
西周BC809年世界历史地图矢量文件SHP格式.zip
本资源为《西周BC809年世界历史地图矢量文件SHP格式》压缩包,文件大小约 24.49 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。
市十五五银发经济产业园与智慧养老服务平台项目建设方案.docx
市十五五银发经济产业园与智慧养老服务平台项目建设方案.docx


