Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update orm update fields #262

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/branch.v
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ fn (mut app App) create_branch_or_update(repository_id int, branch_name string,
}!
}

fn (mut app App) update_branch(branch_id int, author string, hash string, date int) ! {
fn (mut app App) update_branch(branch_id int, author_ string, hash_ string, date_ int) ! {
sql app.db {
update Branch set author = author, hash = hash, date = date where id == branch_id
update Branch set author = author_, hash = hash_, date = date_ where id == branch_id
}!
}

Expand Down
22 changes: 11 additions & 11 deletions src/repo.v
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ fn (f ArchiveFormat) str() string {
fn (mut app App) save_repo(repo Repo) ! {
id := repo.id
desc := repo.description
views_count := repo.views_count
webhook_secret := repo.webhook_secret
tags_count := repo.tags_count
is_public := if repo.is_public { 1 } else { 0 }
views_count_ := repo.views_count
webhook_secret_ := repo.webhook_secret
tags_count_ := repo.tags_count
is_public_ := if repo.is_public { 1 } else { 0 }
open_issues_count := repo.nr_open_issues
open_prs_count := repo.nr_open_prs
branches_count := repo.nr_branches
Expand All @@ -86,8 +86,8 @@ fn (mut app App) save_repo(repo Repo) ! {
// repo.update()

sql app.db {
update Repo set description = desc, views_count = views_count, is_public = is_public,
webhook_secret = webhook_secret, tags_count = tags_count, nr_open_issues = open_issues_count,
update Repo set description = desc, views_count = views_count_, is_public = is_public_,
webhook_secret = webhook_secret_, tags_count = tags_count_, nr_open_issues = open_issues_count,
nr_open_prs = open_prs_count, nr_releases = releases_count, nr_contributors = contributors_count,
nr_stars = stars_count, nr_branches = branches_count where id == id
}!
Expand Down Expand Up @@ -242,9 +242,9 @@ fn (mut app App) delete_repository(id int, path string, name string) ! {
app.info('Removed repo folder (${id}, ${name})')
}

fn (mut app App) move_repo_to_user(repo_id int, user_id int, user_name string) ! {
fn (mut app App) move_repo_to_user(repo_id int, user_id_ int, user_name_ string) ! {
sql app.db {
update Repo set user_id = user_id, user_name = user_name where id == repo_id
update Repo set user_id = user_id_, user_name = user_name_ where id == repo_id
}!
}

Expand Down Expand Up @@ -749,12 +749,12 @@ fn (mut app App) fetch_file_info(r &Repo, file &File) ! {
if vals.len < 3 {
return
}
last_msg := first_line(vals[0])
last_time := vals[1].int() // last_hash
last_msg_ := first_line(vals[0])
last_time_ := vals[1].int() // last_hash

file_id := file.id
sql app.db {
update File set last_msg = last_msg, last_time = last_time where id == file_id
update File set last_msg = last_msg_, last_time = last_time_ where id == file_id
}!
}

Expand Down
10 changes: 5 additions & 5 deletions src/user.v
Original file line number Diff line number Diff line change
Expand Up @@ -359,19 +359,19 @@ pub fn (mut app App) check_user_blocked(user_id int) bool {
return user.is_blocked
}

fn (mut app App) change_username(user_id int, username string) ! {
fn (mut app App) change_username(user_id int, username_ string) ! {
sql app.db {
update User set username = username where id == user_id
update User set username = username_ where id == user_id
}!

sql app.db {
update Repo set user_name = username where user_id == user_id
update Repo set user_name = username_ where user_id == user_id
}!
}

fn (mut app App) change_full_name(user_id int, full_name string) ! {
fn (mut app App) change_full_name(user_id int, full_name_ string) ! {
sql app.db {
update User set full_name = full_name where id == user_id
update User set full_name = full_name_ where id == user_id
}!
}

Expand Down
Loading