Giter VIP home page Giter VIP logo

ntust-senior's Introduction

Wells

I am a Ruby on Rails developer, recently living in Taiwan/Taipei I have more than 3 years experience on web development.

Insight

Activity

ntust-senior's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ntust-senior's Issues

重構課表查詢

重構 ORM 查詢規則

課表查詢能找出每週特定日期的所有課程

目前做法

由 course 進行查詢

class Course < ApplicationRecord
  has_many :user_and_course_records, dependent: :destroy
  has_many :course_times, dependent: :destroy
  has_many :users, through: :user_and_course_records
  scope :mon, -> { joins(:course_times).where("section LIKE ?", "週一%").pluck(:name,:section) }
  scope :thus, -> { joins(:course_times).where("section LIKE ?", "週二%").pluck(:name,:section) }
  scope :wed, -> { joins(:course_times).where("section LIKE ?", "週三%").pluck(:name,:section) }
  scope :thur, -> { joins(:course_times).where("section LIKE ?", "週四%").pluck(:name,:section) }
  scope :fri, -> { joins(:course_times).where("section LIKE ?", "週五%").pluck(:name,:section) }
  scope :sat, -> { joins(:course_times).where("section LIKE ?", "週六%").pluck(:name,:section) }
  scope :sun, -> { joins(:course_times).where("section LIKE ?", "週日%").pluck(:name,:section) }
end

重構後做法

由 course_time 進行查詢, ORM 應類似為下方程式碼

class CourseTime < ApplicationRecord
    belongs_to :course

    scope :from_user0, -> (user){ joins(:course).where(course: { users: user }) }
    scope :from_user, -> (user){ joins(course: :users).where(course: { users: user }) }
    scope :from_user2, -> (user){ joins(course: :users).where("users.id = ?", user.id) }
    scope :from_user3, -> (user){ joins(course: :users).where(users: {id: user.id}) }
    scope :from_user32, -> (user){ joins(course: :users).where(user_id: user.id) }
    scope :from_user4, -> (user){ joins(course: :user_and_course_records).where(user_and_course_records: {user_id: user.id}) }
    scope :from_user5, -> (user){ joins(course: {user_and_course_records: :user}).where(user_and_course_records: {user_id: user.id}) }
    scope :mon, -> { preload(:course).where("section LIKE ?", "週一%") }
end

後台管理系統

後台管理系統

使用 administrate Gem 建置

預期功能

  • 各 Model 資料管理
  • 首頁以圖表顯示各種數據
    • 圖表以 Chartkick 實作
    • 顯示各式服務訂閱人數/使用者數目
  • 可使用後台修改部分內容
  • 主動推播訊息

系統測試

目前出現的 Bug

  • 找到導師的流程圖錯誤
  • 校園地圖沒出現
  • 課表通知沒有教室
  • 課表通知沒有更新

上課提醒功能

上課提醒功能

由於學校政策禁止第三方 APP 取得學生帳密,因此無法使用選課系統查詢學生課表,替代方案為使用台科新生常用的選課模擬系統 CrossLink 進行排課,由使用者貼上其個人頁面網址,以此取得課程資訊

使用技術

  • Capybara gem
  • Line Notify

功能描述

  • 使用者複製其 CrossLink 個人網頁的網址
    image
  • 在個人頁面後加入 /timetable/1091 可以得到 1091 的課表
  • 以 Capybara 進行解析得到每堂課的連結
  • 以每堂課連結得到課名、節次和教室等資訊

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.