FocusFlow α Sprint Blog (Part 5) - User Report Module & Multi-Device Data Sync

FOCUS_2025_SE FOCUS_2025_SE 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

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
  2. Feature Implementation Demo
  3. Git Commit Records
  4. Core Code Analysis
  5. Sprint Summary

1. 📊 Project Overview

1.1 Basic Information

ItemDetails
Course Link2025 Fall - Software Engineering Class
AssignmentTeam Project - Alpha Sprint Blog
Team NameFocusFlow
Sprint GoalFinalizing the Alpha phase, delivering User Study Reports and Cross-Platform Data Sync.
ReferencesIEEE 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:

  1. Feature: Report Visualization
    • Content: Completed ReportController logic, implemented backend encapsulation for ECharts data.
    • Status: ✅ Merged into main.
  2. 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

ChallengeSolution
📉 Mobile Chart AdaptationWidescreen 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 PerformancePage 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 SynchronizationPC 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.


...全文

相关推荐

1978-2024年 31省GDP数据 第一第二第三产业及占比打包.zip

1978年至2024年,中国经济发展经历了历史性变革,31个省份的GDP数据详细记录了这一时期的变化。从第一产业到第三产业的增加值及占比看,中国产业结构持续优化升级。第一产业(农业)增加值虽逐年上升,但其在经济总量中的比重呈下降趋势,说明农业在国家经济发展中的相对地位有所降低,而绝对生产水平则有所提高。 第二产业涵盖工业和建筑业,长期是中国GDP增长的主要推动力。经济改革初期,第二产业快速增长,为中国现代化奠定了坚实基础。随着时间推移,第二产业占GDP比重虽有起伏,但整体增速明显快于第一产业。部分省份第二产业快速发展,带动了当地经济跃升。 第三产业涵盖服务业、金融业、信息技术等多个领域,是近年来中国GDP增长的又一重要动力。21世纪初以来,随着市场经济的发展和人民生活水平的提高,第三产业比重持续上升,成为拉动GDP增长的重要力量。在一些沿海发达地区,第三产业快速发展对经济的贡献尤为突出。 人均GDP是衡量经济发展水平和居民生活水平的重要指标,其变化也反映出中国各省份在经济发展上的差异和进步。沿海及经济发达省份的人均GDP水平明显高于内陆及边远省份,这与各地区的产业布局、资源分配和政策导向密切相关。 从这些数据可以看出,中国经济发展并不平衡:东部沿海省份往往拥有更高的GDP总量和人均GDP水平,西部和一些内陆省份则相对落后。不过,随着西部大开发、东北振兴等一系列区域发展战略的实施,中西部地区经济增速加快,GDP比重和人均GDP水平显著提升,区域发展差距逐步缩小。 此外,随着经济结构调整和产业政策优化,各省份的经济增长模式也在改变。创新驱动发展战略的实施推动了高新技术产业发展,促进了经济增长质量提升。同时,环境保护和可持续发展理念日益受到重视,绿色GDP概念开始被纳入考量,标志着中国经济发展方式正在转变。 数据分析显示,各省份之间发展并不均衡,这既有历史原因,也受地

温柔-的-女汉子

春秋BC765年世界历史地图矢量文件SHP格式.zip

本资源为《春秋BC765年世界历史地图矢量文件SHP格式》压缩包,文件大小约 26.64 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。

白水先森

战国BC286年世界历史地图矢量文件SHP格式.zip

本资源为《战国BC286年世界历史地图矢量文件SHP格式》压缩包,文件大小约 2.28 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。

白水先森

YOLO26算法游戏场景玩家目标检测+训练好的模型+603张数据集+pyqt可视化界面.zip

附训练好的 YOLO 权重与 PyQt 可视化检测界面,页面底部含可视化效果预览,毕设/课设开箱即用。 【数据集概况】 · 检测类别(中文):[玩家(players-sx6K)] · 总计:603 张 · 测试集:2 张 · 验证集:22 张 · 训练集:579 张 【训练曲线与评估图】 【模型训练配置】 参数 | 值 模型 | yolo26n 训练轮数 | 100 epochs 输入尺寸 | 640x640 批次大小 | 24 优化器 | auto 初始学习率 | 0.01 训练设备 【关键指标汇总】 训练了 36 个 epoch,最终轮指标: 指标 | 数值 mAP50 | **0.5105** mAP50-95 | 0.2501 Precision | 0.8603 Recall | 0.4773 train/box_loss | 1.4654 train/cls_loss | 1.0044 val/box_loss | 2.1439 val/cls_loss | 2.2525 【训练过程分析】 训练刚开始时,模型表现出了良好的收敛速度。前几轮的 train/box_loss 从初始值的 1.4654 降至 1.3865,下降了 0.0789。这意味着模型在学习阶段迅速适应了数据集的特性,尽管没有表现出剧烈波动,但这种稳步下降为后续训练打下了较为坚实的基础。而 val/box_loss 则从 2.1439 下降至 2.0576,下降了 0.0863,尽管下降幅度小于 train/box_loss,但也表明模型在验证集上也有良好的适应性。这反映了模型在初期训练过程中具有较好的学习曲线。 然而,进入中后期,训练与验证的 loss 均呈现平缓的下降趋势。train/box_loss 从 1.3865 下降... 使用场景:毕业设计、课程设计、深度学习入门、工业场景落地验证。

guo_xiao_xiao_

春秋BC539年世界历史地图矢量文件SHP格式.zip

本资源为《春秋BC539年世界历史地图矢量文件SHP格式》压缩包,文件大小约 1.86 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。

白水先森
评论
收藏 已收藏
分享
返回顶部