Git Product home page Git Product logo

dietapp-rails2020's Introduction

Hi there 👋

Anurag's GitHub stats

🚀 My open source softwares

🌱 My personal projects

Also, I've solved 426 algorithm questions in LeetCode in Python.

📚 My blog posts

🎤 My presentations

🏆 My certificates

AWS Certified Solutions Architect – Professional (2023.4) image

Here is the badge.

AWS Certified Solutions Architect – Associate (2022.12) image

Here is the badge.

Google Cloud Certified, Professional Cloud Developer (2021.7) image

Here is the certificate.

Udacity Data Scientist Nanodegree (2019.5) image
Udacity Data Analyst Nanodegree (2018.11) image

dietapp-rails2020's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar kudojp avatar

Stargazers

 avatar

Watchers

 avatar

dietapp-rails2020's Issues

退会(Cancel Account)ができない

概要

headerのドロップダウンメニューからCancel Accountを押して表示される退会ページで「退会」ボタンを押しても退会できない

エラーログの肝

2020-05-18T11:31:29.635858+00:00 app[web.1]: [f240f354-35d8-48d0-a675-571318a1ca86] ActiveRecord::InvalidForeignKey (PG::ForeignKeyViolation: ERROR:  update or delete on table "meal_posts" violates foreign key constraint "fk_rails_333bcce849" on table "food_items"
2020-05-18T11:31:29.635859+00:00 app[web.1]: DETAIL:  Key (id)=(74) is still referenced from table "food_items".

MealPostの日時選択のUI改善

概要

日時入力しなければならないことがわかりにくい。
元々は現状の「食べた日時を選択」の部分だけが表示されていて、これを押したらカレンダーがポップアップするようにしたい。

現在のUI

image

フォローしているユーザーのunfollowができない

概要

アンフォローできない
image

image

ログ

Started DELETE "/relationships/2" for ::1 at 2020-06-24 23:02:12 +0900
Processing by RelationshipsController#destroy as JS
  Parameters: {"commit"=>"Unfollow", "id"=>"2"}
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
  Relationship Load (6.7ms)  SELECT "relationships".* FROM "relationships" WHERE (2) LIMIT $1  [["LIMIT", 1]]
  ↳ app/controllers/relationships_controller.rb:35:in `destroy'
Completed 500 Internal Server Error in 13ms (ActiveRecord: 6.9ms | Allocations: 3151)


  
ActiveRecord::StatementInvalid (PG::DatatypeMismatch: ERROR:  argument of WHERE must be type boolean, not type integer
LINE 1: ...ECT "relationships".* FROM "relationships" WHERE (2) LIMIT $...
                                                             ^
):
  
app/controllers/relationships_controller.rb:35:in `destroy'
rStarted DELETE "/relationships/2" for ::1 at 2020-06-24 23:04:49 +0900
Processing by RelationshipsController#destroy as JS
  Parameters: {"commit"=>"Unfollow", "id"=>"2"}
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
Completed 500 Internal Server Error in 133ms (ActiveRecord: 21.9ms | Allocations: 60012)


  
NoMethodError (undefined method `int' for #<RelationshipsController:0x00007fe10bf45cb0>
Did you mean?  in?):

同学,您这个项目引入了757个开源组件,存在27个漏洞,辛苦升级一下

检测到 kudojp/DietApp-Rails2020 一共引入了757个开源组件,存在27个漏洞

漏洞标题:serialize-javascript 代码问题漏洞
缺陷组件:[email protected]
漏洞编号:CVE-2020-7660
漏洞描述:Verizon serialize-javascript是美国威瑞森电信(Verizon)公司的一款支持将JavaScript序列化为 JSON超集的软件包。
serialize-javascript 3.1.0之前版本中存在代码问题漏洞。远程攻击者可借助index.js文件中的‘deleteFunctions’函数利用该漏洞注入任意代码。
国家漏洞库信息:https://www.cnvd.org.cn/flaw/show/CNVD-2020-53801
影响范围:(∞, 3.1.0)
最小修复版本:3.1.0
缺陷组件引入路径:[email protected]>@rails/[email protected]>[email protected]>[email protected]
[email protected]>@rails/[email protected]>[email protected]>[email protected]
[email protected]>@rails/[email protected]>[email protected]>[email protected]>[email protected]

另外还有27个漏洞,详细报告:https://mofeisec.com/jr?p=i6c630

MealPost#scoreが高負荷なので、なんとかする

#2 (comment) で指摘いただいた箇所を実装する。

def score
  votes.all.map { |v| v.is_upvote? ? 1 : -1 }.sum
end

[ただの豆知識] 規模が小さいうちはこれでいいですが,これはかなり負荷が高いので,大規模だとバッチ処理化する必要があります。
あと,直接 ActiveRelation の sum よべなかったっけ?
SQL の集計関数を直接使うっていう高速化方法もあります

クラッシュレポートサービスの導入

概要

クラッシュレポートサービスを導入すべし

背景

#4 (comment)

用途例

  • Userテーブルにデータ不整合があった場合((provider, uidの組み合わせが被るなど)にアプリケーション上ではエラーを吐かず処理を続けるが、クラッシュレポートサービスにはログを飛ばす
  • その他いろいろあるはず

技術選定

  • bugsnag (@azumag さんおすすめ)
  • errbit

パスワードとパスワード確認が空白のまま更新ボタンを押せる

#8 の実装時に(そんなにクリティカルじゃないので)skipした問題

  • 既にパスワードを設定済みのuserがEdit Passwordページでpasswordとpassword confirmationを空にして正しいcurrent passwordのみを入力してsubmitしてもエラーを吐かない(ただしencrypted_passwordの更新もされない)
  • update_with_passwordの実装が問題
    • heartcombo/devise#2349 の挙動が原因。
    • update_with_passwordは(以下のページのように)、passwordではなくそれ以外の属性を更新したい際のリクエストの処理にも利用されるメソッドであり、そのように実装されているからである。

image

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.