-
Notifications
You must be signed in to change notification settings - Fork 16
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
Issue #448 #497
Open
IgorMonardez
wants to merge
78
commits into
main
Choose a base branch
from
issue_448
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Issue #448 #497
Changes from 69 commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
13be059
ISSUE#448 - Add the relation n-m with institution and professor throu…
IgorMonardez 57f60ce
ISSUE#448 - Add a link to affiliation at the professor controller, an…
IgorMonardez 5907456
ISSUE#448 - Little adjustments at affiliation controller and model
IgorMonardez 8375ed1
ISSUE#448 - Validation tests
IgorMonardez 8718755
ISSUE#448 - Validation tests
IgorMonardez e4ac55d
ISSUE #448 - Adds affiliation population logic based on old professor…
IgorMonardez 877dda7
ISSUE #448 - Adds affiliation population logic based on old professor…
IgorMonardez c7e4038
ISSUE #448 - Refactoring populate code
IgorMonardez d23f4e6
ISSUE #448 - Add repopulation logic to ProgramLevel, and adjustments …
IgorMonardez 89f1a96
ISSUE #448 - Add populate algorithm to ProgramLevel and Affiliation
IgorMonardez 1cdaa04
ISSUE #448 - Fixes tests
IgorMonardez 359f072
ISSUE #448 - Modficações nos dados do pdf
IgorMonardez cade02b
ISSUE #448 - Changes at validation
IgorMonardez ce3358f
ISSUE #448 - Changes at academic_transcript_pdf switching to data fro…
IgorMonardez eaba6cb
ISSUE #448 - Exclude active flag at affiliation and program_level
IgorMonardez 08fc416
ISSUE #448 - Create program_level factory, fix the show of defense_co…
IgorMonardez a73877b
ISSUE #448 - Fix github action
IgorMonardez 7a87d61
ISSUE #448 - Fix github action
IgorMonardez 00f94fa
Merge branch 'bugfixes' into issue_448
IgorMonardez 3607c98
ISSUE #448 - adjustments at schema
IgorMonardez 64e933f
ISSUE #448 - adjustments at gemfile
IgorMonardez dfaa001
ISSUE #448 - adjustments at gemfile
IgorMonardez cb8daa9
Merge branch 'bugfixes' into issue_448
IgorMonardez 8c7d5cd
issue #448 - Adjustment at gemfile.lock
IgorMonardez 1f7eb86
Merge branch 'main' into issue_448
IgorMonardez fc19ed6
ISSUE #448 - Fixed date format, changed names of "affiliation" and "p…
IgorMonardez 24a180a
ISSUE #448 - Changes at rails_helper
IgorMonardez fd94a6c
Issue #448 - Removing binding.pry
IgorMonardez 3aecccb
Issue #448 - Changes in validation and migration to only create affil…
IgorMonardez 45341a9
Issue #448 - Fixes at seeds and custom_variables tests
IgorMonardez b2644e4
Issue #448 - Controller and route for program_level created
IgorMonardez fdbbd5c
Issue #448 - Rename controller Program Level and route of program lev…
IgorMonardez cec3b6e
Issue #448 - Fixes at enrollments pdf and show
IgorMonardez bbbc249
Issue #448 - Change of the name of the "level program" on the configu…
IgorMonardez af1ff0f
Issue #448 - Fixing tests
IgorMonardez 3b6452c
ISSUE #448: Correção no update do conceito CAPES
IgorMonardez daf645a
ISSUE #448: Correção no update do conceito CAPES
IgorMonardez d896703
ISSUE #448: Fixing update ProgramLevel
IgorMonardez 73d1a38
Merge remote-tracking branch 'origin/issue_448' into issue_448
IgorMonardez d2ed6fe
ISSUE #448: Fixing the on_date scope logic
IgorMonardez 0c3f18f
ISSUE #448: Fixing the on_date scope logic
IgorMonardez 611259b
ISSUE #448: Changes at professor institutions show
IgorMonardez 3e5abe1
ISSUE #448: Changes at institutions, professor and tests to exclude a…
IgorMonardez ebbc3f2
ISSUE #448: Fixes at enrollments/show_defense_commitee
IgorMonardez 02798f2
ISSUE #448: Changes at ability
IgorMonardez 8b7a655
Merge branch 'refs/heads/main' into issue_448
IgorMonardez 66182d9
ISSUE #448: Rollback show_dismissal
IgorMonardez 9accb16
ISSUE #448: Flash[:info] on update of Program Level
IgorMonardez 9b67482
ISSUE #448: Adjustments at schema
IgorMonardez a6703f9
ISSUE #448: Fix CreateProgramLevel migration
IgorMonardez 07498ba
Merge branch 'refs/heads/main' into issue_448
IgorMonardez 2f1bd5d
ISSUE #448: Fix CreateProgramLevel migration
IgorMonardez 018a497
ISSUE #448: Changes at ProgramLevel to use dup
IgorMonardez 4d61ed3
ISSUE #448: Test at program_level dup
IgorMonardez 0aca886
ISSUE #448: Test at program_level dup
IgorMonardez f3bd278
ISSUE #448: Correction at enrollments pdf and table defense_committee…
IgorMonardez 87fce7f
ISSUE #448: Threshold of program level and affiliation
IgorMonardez 406717d
ISSUE #448: Correction at migration of Program level and affiliation …
IgorMonardez beb7467
ISSUE #448: Without test program_level_spec.rb
IgorMonardez 2714011
ISSUE #448: Correction at affiliation migration
IgorMonardez a581390
Merge branch 'refs/heads/main' into issue_448
IgorMonardez 12e3547
ISSUE #448: Correction at affiliation migration
IgorMonardez 7733dfb
ISSUE #448: Correction at enrollment_hold tests
IgorMonardez d8aea30
ISSUE #448: Correction at affiliation zig zag creation
IgorMonardez 912884c
ISSUE #448: Correction at affiliation migration
IgorMonardez a69b2ae
ISSUE #448: Correction at affiliation migration
IgorMonardez a84b22d
ISSUE #448: Correction at affiliation initial date error
IgorMonardez 6fa6d4d
ISSUE #448: Correction at affiliation initial date error
IgorMonardez adcec6c
ISSUE #448: Correction at affiliation initial date error
IgorMonardez 36f5d3c
Merge branch 'refs/heads/main' into issue_448
IgorMonardez 7c7addb
ISSUE #448: Correction at affiliation initial date error
IgorMonardez b4a8db2
ISSUE #448: Correction at shared pdf concern
IgorMonardez b1c2085
ISSUE #448: Correction at student_enrollment_spec.rb
IgorMonardez 6d9c8b8
ISSUE #448: Correction at student_enrollment_spec.rb
IgorMonardez d5ce275
ISSUE #448: Correction at affiliation initial date error
IgorMonardez df6880f
ISSUE #448: Clean the affiliation migration
IgorMonardez eac7402
ISSUE #448: Change variable name
IgorMonardez 099fbf9
ISSUE #448: Change details
IgorMonardez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
class AffiliationController < ApplicationController | ||
authorize_resource | ||
|
||
active_scaffold :affiliation do |config| | ||
columns = [:professor, :institution, :start_date, :end_date] | ||
|
||
config.list.columns = columns | ||
config.create.columns = columns | ||
config.update.columns = columns | ||
config.show.columns = columns | ||
|
||
config.columns[:professor].form_ui = :record_select | ||
config.columns[:institution].form_ui = :record_select | ||
config.columns[:start_date].form_ui = :date_picker | ||
config.columns[:end_date].form_ui = :date_picker | ||
end | ||
record_select( | ||
per_page: 10, | ||
search_on: [:name], | ||
order_by: "name", | ||
full_text_search: true | ||
) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
class ProgramLevelsController < ApplicationController | ||
authorize_resource | ||
|
||
active_scaffold :program_level do |config| | ||
config.create.columns = [:level, :start_date, :end_date] | ||
config.update.columns = [:level, :start_date, :end_date] | ||
config.show.columns = [:level, :start_date, :end_date] | ||
config.list.columns = [:level, :start_date, :end_date] | ||
|
||
config.actions.swap :search, :field_search | ||
config.columns.add :active | ||
config.field_search.columns = [:active] | ||
config.columns[:active].form_ui = :select | ||
|
||
config.actions.exclude :deleted_records | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,38 @@ def professor_advisements_with_points_show_column(record, options) | |
resp.html_safe | ||
end | ||
|
||
def professor_institutions_show_column(record, options) | ||
affiliations = record.affiliations | ||
return "-" if affiliations.empty? | ||
|
||
body = "" | ||
count = 0 | ||
affiliations.each do |affiliation| | ||
count += 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 2 locations. Consider refactoring. |
||
tr_class = count.even? ? "even-record" : "" | ||
body += "<tr class=\"record #{tr_class}\"> | ||
<td>#{affiliation.institution.name}</td> | ||
<td>#{affiliation.start_date}</td> | ||
<td>#{affiliation.end_date}</td> | ||
</tr>" | ||
end | ||
|
||
resp = | ||
"<table class=\"showtable listed-records-table\"> | ||
<thead> | ||
<tr> | ||
<th>#{I18n.t("activerecord.attributes.institution.name")}</th> | ||
<th>#{I18n.t("activerecord.attributes.affiliation.start_date")}</th> | ||
<th>#{I18n.t("activerecord.attributes.affiliation.end_date")}</th> | ||
</tr> | ||
</thead> | ||
<tboby class=\"records\"> | ||
#{body} | ||
</tbody> | ||
</table>" | ||
resp.html_safe | ||
end | ||
|
||
def permit_rs_browse_params | ||
[:page, :update, :utf8] | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
class Affiliation < ApplicationRecord | ||
has_paper_trail | ||
|
||
belongs_to :institution | ||
belongs_to :professor | ||
|
||
validates :start_date, presence: true | ||
validates :end_date, presence: false | ||
validates_uniqueness_of :start_date, scope: [:professor_id], | ||
allow_nil: true, allow_blank: true, | ||
message: "A afiliação só pode ser iniciada em uma data por professor" | ||
validate :uniqueness_end_date | ||
|
||
scope :on_date, ->(date) { where("DATE(start_date) <= ? AND (DATE(end_date) > ? OR end_date IS null)", date, date) } | ||
scope :of_professor, ->(professor) { where(professor_id: professor.id) } | ||
scope :professor_date, ->(professor, date) { of_professor(professor).on_date(date) } | ||
scope :active, -> { where(end_date: nil) } | ||
|
||
private | ||
def uniqueness_end_date | ||
exists = Affiliation.where(professor_id: professor_id, end_date: end_date).where.not(id: id).exists? | ||
if exists | ||
errors.add(:end_date,"Apenas uma afiliação pode estar ativa por professor e só pode ter uma data de fim por professor") | ||
end | ||
exists | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
class ProgramLevel < ApplicationRecord | ||
has_paper_trail | ||
|
||
validates :level, presence: true, on: [:create, :update] | ||
validates :start_date, presence: true, on: [:create, :update] | ||
validates :end_date, presence: false | ||
|
||
scope :active, -> { where(end_date: nil) } | ||
scope :on_date, -> (date) { where("program_levels.start_date <= ? AND (program_levels.end_date > ? OR program_levels.end_date is null)", date, date)} | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) Universidade Federal Fluminense (UFF). | ||
# This file is part of SAPOS. Please, consult the license terms in the LICENSE file. | ||
|
||
pt-BR: | ||
activerecord: | ||
attributes: | ||
affiliation: | ||
institution: "Instituição" | ||
professor: "Professor" | ||
start_date: "Data de início" | ||
end_date: "Data de fim" | ||
active: "Ativo" | ||
|
||
models: | ||
affiliation: | ||
one: "Afiliação" | ||
other: "Afiliações" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ pt-BR: | |
code: "Sigla" | ||
majors: "Cursos" | ||
name: "Nome" | ||
affiliations: "Afiliações" | ||
|
||
models: | ||
institution: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method
professor_institutions_show_column
has 26 lines of code (exceeds 25 allowed). Consider refactoring.