FocusFlow α Sprint Blog (Part 5) - User Report Module & Multi-Device Data Sync
FocusFlow Alpha Sprint Blog (Part 5)
🚀 User Report Module & Multi-Device Data Sync
Yitan Fang
Fuzhou University (832302110) | Maynooth University (23125578)
📋 Table of Contents
1. 📊 Project Overview
1.1 Basic Information
| Item | Details |
|---|---|
| Course Link | 2025 Fall - Software Engineering Class |
| Assignment | Team Project - Alpha Sprint Blog |
| Team Name | FocusFlow |
| Sprint Goal | Finalizing the Alpha phase, delivering User Study Reports and Cross-Platform Data Sync. |
| References | IEEE Std 830-1998, GB/T 8567-2006 |
1.2 Sprint Burndown Chart
During this sprint cycle, we focused on tackling the challenges of data visualization and backend synchronization. The chart below illustrates the team's remaining effort (Story Points) over time.
💡 Insight:
As seen in the chart, we encountered technical bottlenecks in the middle of the sprint (flattened curve), but through intensive team collaboration in the final days, we successfully returned to the ideal burndown path.
Figure 1.1 Alpha Sprint Burndown Chart
2. 💻 Feature Implementation Demo
We have completed the deep development of the "Study Report" and deployed the "Data Synchronization" feature. Through responsive design (RWD) and backend sync mechanisms, we ensure a seamless user experience across PC and mobile devices.
2.1 User Study Report (PC View)
The Study Report is a core feature helping users review their progress. The system uses a card-based layout and trend charts to visualize learning status.
- ⏱️ Duration: Statistics on cumulative focus time.
- ✅ Task: Displays the number of completed tasks.
- 🔥 Continuous Check-in: Highlights the current streak (e.g., "1 day") to gamify habit formation.
- 📈 Completion Rate: Shows the percentage of tasks completed and calculates the week-over-week growth (e.g., "5% increase").
- 📅 7-Day Trend: The central chart provides a visual timeline tracking focus and check-ins over the past week.
Figure 2.1 PC Report Interface: Displaying core metrics and learning trends
2.2 Multi-Device Sync & Adaptation (Mobile View)
To support users in various scenarios (commuting, library, etc.), we implemented real-time cloud synchronization and mobile adaptation.
- 🔄 Data Consistency: Whether on a widescreen PC or a vertical mobile screen, core data remains consistent (sub-second synchronization).
- 📱 Responsive Layout: The mobile view automatically switches to a Card Stack Layout, optimizing font size and touch interaction for single-handed use.
Figure 2.2 Mobile Adaptation: Vertical layout with real-time data sync
3. 🛠️ Git Commit Records
Our development process strictly follows the Git Flow workflow. Below are the commit records for the core features (Report Module & Data Sync).
Figure 3.1 GitHub Commit History (Report & Sync features)
Key Commits Explanation:
Feature: Report Visualization- Content: Completed
ReportControllerlogic, implemented backend encapsulation for ECharts data. - Status: ✅ Merged into
main.
- Content: Completed
Feature: Mobile Responsive Layout- Content: Optimized CSS Media Queries to achieve mobile adaptation for the dashboard and report pages.
- Status: ✅ Verified.
4. 📝 Core Code Analysis
This task involved significant data aggregation and backend logic. Below is an analysis of the key code segments.
4.1 Data Layer: Statistical Logic (models.py)
# Aggregate logic for user report data
def get_user_report_stats(user_id):
today = datetime.now().date()
# 1. Calculate streak days (Reusing previous logic)
streak_days = calculate_streak(user_id)
# 2. Statistics for today/cumulative focus time
# 💡 Optimization: Use SQL SUM aggregation to improve performance
# and avoid iterating through large datasets in the application layer.
focus_stats = db.execute('''
SELECT
SUM(duration) as total_minutes,
COUNT(*) as session_count
FROM focus_sessions
WHERE user_id = ?
''', (user_id,)).fetchone()
# 3. Calculate Week-over-Week (WoW) growth
last_week_stats = get_last_week_stats(user_id)
growth_rate = calculate_growth(focus_stats['total_minutes'], last_week_stats['total_minutes'])
return {
"streak": streak_days,
"total_focus": focus_stats['total_minutes'] or 0,
"growth_rate": growth_rate,
"completed_tasks": count_completed_tasks(user_id)
}
4.2 Interface Layer: Sync & Adaptation (app.py)
@app.route('/report', methods=['GET'])
@login_required
def report_page():
user_id = session.get('user_id')
# Fetch pre-calculated statistical data from backend
stats = get_user_report_stats(user_id)
# Get 7-day trend data for frontend chart rendering
trend_data = get_7day_trend(user_id)
# Render template. The Jinja2 engine combined with Bootstrap
# will handle the responsive layout classes automatically.
return render_template('report.html',
stats=stats,
trend_data=json.dumps(trend_data),
user=get_current_user())
5. 🚩 Sprint Summary
5.1 Delivered Artifacts
- Visual Report Dashboard: Dynamic dashboard including Duration, Tasks, Streak, and Growth Rate.
- Multi-Device Adaptation: Seamless PC/Mobile switching based on the Bootstrap grid system.
- Data Consistency: Unified backend API design ensuring real-time synchronization across devices.
5.2 Technical Challenges & Solutions
| Challenge | Solution |
|---|---|
| 📉 Mobile Chart Adaptation | Widescreen charts looked crowded on phones. Fix: Used CSS Media Queries to detect screen width, hiding non-essential axis labels and adjusting chart height on mobile. |
| ⚡ Aggregation Performance | Page load slowed down as records increased. Fix: Introduced a caching mechanism to cache historical data (prior to "today") and only calculate today's increments in real-time. |
| 🔄 State Synchronization | PC did not refresh after mobile operations. Fix: Adopted an AJAX polling mechanism to periodically check data versions on the frontend. |
© 2025 FocusFlow Team. All Rights Reserved.
相关推荐
Ubuntu 14.04下BitTorrent Sync部署与nginx反向代理实战
BitTorrent Sync(后称Resilio Sync)是一种基于P2P架构的去中心化文件同步工具,其核心依赖LTD协议与DHT网络实现设备直连和端到端加密。它不依赖云存储,所有数据流转均在本地节点间完成,天然具备隐私性与带宽高效性。技术价值体现在跨平台一致性、离线可用性及对老旧系统(如Ubuntu 14.04)的长期兼容支持。典型应用场景包括科研数据多机同步、内网代码协作、边缘设备离线备份等。本文聚焦于该工具在Linux发行版Ubuntu 14.04这一经典但受限环境下的完整落地——涵盖.deb包适
Microsoft.WinDbg-1.2610.1001.0-x64
Microsoft.WinDbg-1.2610.1001.0-x64
Claude 代码超强能力:核心技能库
Superpowers 是一套面向你的编码智能体的完整软件开发方法论,由一组可组合技能和若干初始指令构建而成,用以确保智能体真正使用这些技能。
PDF发票内容提取排版并结构化导出xlsx/cvs嵌入式ptyhon
【本地发票提取工具】 核心优势:不依赖传统粗糙 OCR,基于文字排版结构进行精准提取。仅“税网”下载及税网邮件发送的原版 PDF 发票(开票软件发送的不太支持)能实现开票明细级的秒级本地提取,告别只能提抬头、总额的尴尬。 可免费试用 3 天! 【用前须知】 去微软官网下载VC_redist.x64.exe运行修复运行库(必要的前置操作),之后再解压本工具rar,运行本exe即可。 VC_redist.x64.exe官网永久下载地址 https://learn.microsoft.com/zh-cn/cpp/windows/latest-supported-vc-redist 【安全须知】 个人开发暂未做代码签名,杀软可能会有误报拦截。遇到拦截请在杀软中添加信任/白名单即可。 VirusTotal扫描结果 2/61,主流杀软均通过,个别引擎因无签名误报。官网 virustotal.com 点击页面中间显眼的 “Choose file”(选择文件)按钮上传扫描。
Flask校园二手交易平台课设
这是一份基于 Flask + SQLite 的校园二手交易平台课程设计完整资料,包含实验报告(Markdown、HTML、PDF 三种格式)、全部 Python 源码、8 个 Jinja2 页面模板、5 张运行截图、答辩 PPT。学生注册账号后发布闲置物品,同校同学按分类翻、按关键词搜,看中了在详情页留言咨询,管理员能下架违规商品。不接支付不做物流,买卖双方线下交易,平台只负责信息展示和沟通,一个学期课设能做完。 系统功能:用户注册登录登出,session 维持登录态;发布商品填标题、描述、价格、选六类分类,图片可选上传不强制;首页卡片网格展示在售商品,顶部搜索框按标题描述模糊匹配,下方分类按钮筛选,搜索和筛选可组合;商品详情页展示大图、完整描述、卖家昵称,登录用户能留言咨询;我的发布页能看自己挂过的所有商品并删除;管理员后台能看全部商品,一键下架违规品或恢复在售。 几个值得参考的实现点:密码用 Werkzeug 哈希加盐存储;登录接口不区分"用户不存在"和"密码错误",防枚举用户名;图片上传限制后缀和 2MB,文件名随机串重命名,防覆盖和传脚本;分类和搜索筛选组合用动态拼 SQL;首次启动自动建表写管理员账号;Bootstrap 5 栅格,手机浏览器也能看。 适合正在做 Web 课程设计、Python 后端入门的学生,以及想学习"Flask 蓝图 + SQLite + 登录鉴权 + 文件上传"完整小项目的自学者。拿到手后 cd src,pip install -r requirements.txt,python app.py,浏览器开 http://127.0.0.1:5000 即可,管理员账号 admin/admin123,普通用户自行注册。


