Skip to content

Commit

Permalink
Merge pull request #84 from portabilis/portabilis-patch-2021-08-27
Browse files Browse the repository at this point in the history
Portabilis patch 27/08/2021
  • Loading branch information
edersoares authored Nov 4, 2021
2 parents d3c0769 + db41116 commit c023328
Show file tree
Hide file tree
Showing 145 changed files with 1,980 additions and 526 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ config/puma.rb
/public/422.html
/public/relatorios/*
!/public/relatorios/.keep
.idea

## Environment normalisation:
/.bundle
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12.22.1
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ gem 'pg_query', '1.2.0'
gem 'postgres-copy', '1.0.0'
gem 'prawn', '2.1.1', git: 'https://github.com/portabilis/prawn.git', branch: 'master', tag: 'v2.1.1'
gem 'prawn-table', '0.2.2'
gem 'puma', '4.3.5'
gem 'puma', '5.2.2'
gem 'pundit', '0.3.0'
gem 'rack-cors', '>= 1.0.4 ', require: 'rack/cors'
gem 'rack-protection', '1.5.5'
Expand All @@ -55,6 +55,7 @@ gem 'rubyzip', '>= 1.3.0', require: 'zip'
gem 'sidekiq', '5.0.3'
gem 'sidekiq-unique-jobs', '6.0.22'
gem 'simple_form', '4.0.0'
gem 'skylight', '4.3.2'
gem 'therubyracer', '0.12.3'
gem 'twitter-bootstrap-rails', '3.2.0'
gem 'uglifier', '4.1.20'
Expand All @@ -65,13 +66,15 @@ gem 'webpacker', '~> 4.x'
instance_eval File.read('Gemfile.plugins') if File.exist?('Gemfile.plugins')

group :development do
gem 'rack-mini-profiler'
gem 'meta_request', '0.7.2'
gem 'pry-byebug', '3.4.2'
gem 'pry-remote', '0.1.8'
gem 'quiet_assets', '1.1.0'
gem 'rubocop', '0.59.2', require: false
gem 'spring', '2.0.2'
gem 'spring-commands-rspec', '1.0.4'
gem 'letter_opener_web', '~> 1.0'
end

group :test do
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[![Latest Release](https://img.shields.io/github/release/portabilis/i-diario.svg?label=latest%20release)](https://github.com/portabilis/i-diario/releases)
[![Maintainability](https://api.codeclimate.com/v1/badges/92cee0c65548b4b4653b/maintainability)](https://codeclimate.com/github/portabilis/i-diario/maintainability)

# i-Diário

Expand Down Expand Up @@ -182,6 +181,15 @@ Para adicionar o `fog`, crie o arquivo `Gemfile.plugins`, que irá ter gems cust
Uma vez adicionada a gem `fog`, basta criar um arquivo de configuração em `config/custom_carrierwave.rb`
e fazer os ajustes para funcionar. Leia atentamente a documentação do `carrierwave` antes de fazer isso.

- Redirecionar os relatórios para outro servidor (opcional)
```yaml
REPORTS_SERVER_IP: xx.xx.xx.xx
REPORTS_SERVER_USERNAME: username
REPORTS_SERVER_DIR: /var/www/relatorios_idiario
```

_Nota: REPORTS_SERVER_DIR deve estar dentro da pasta publica do seu servidor_

* Inicie o servidor:

```bash
Expand Down
Binary file added app/assets/images/brasil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/assets/images/portabilis_logo.png
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% id = new Date().getTime() %>
<% id = Math.random().toString(36).slice(2) %>
<% objective_description = description.replace(/"/g, '&quot;') %>

<li class="list-group-item manual" style="display: flex;" id="<%= submodel_name %>_<%= id %>">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ $(function () {
} else if (daily_note_student.dependence) {
student_situation = student_situation + 'dependence-student';
student_name = '*' + daily_note_student.name
} else if (daily_note_student.in_active_search) {
student_situation = student_situation + 'in-active-search';
student_name = '*****' + daily_note_student.name
} else {
student_name = daily_note_student.name
}
Expand Down
6 changes: 3 additions & 3 deletions app/assets/javascripts/views/avaliations/form.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ $(function () {
});
}

async function initFields() {
function initFields() {
if (!!document.getElementById('avaliation_test_setting_id')) {
await updateFieldsBasedOnTestSetting();
updateFieldsBasedOnTestSetting();
}

if (!!document.getElementById('avaliation_weight')) {
await updateFieldsBaseOnTestSettingTest();
updateFieldsBaseOnTestSettingTest();
}
}

Expand Down
22 changes: 15 additions & 7 deletions app/assets/javascripts/views/avaliations/multiple_classrooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ $(function () {

var updateFieldsBasedOnTestSetting = function() {
$.getJSON('/configuracoes-de-avaliacoes-numericas/' + $('#avaliation_multiple_creator_form_test_setting_id').select2('val')).always(function(data) {
if (data.test_setting.exam_setting_type == 'general')
{
if ($.inArray(data.test_setting.exam_setting_type, ['general', 'general_by_school' ]) != -1){
$('.avaliation_multiple_creator_form_test_setting_id').hide();
}

Expand Down Expand Up @@ -99,11 +98,6 @@ $(function () {
});
}

$(document).ready(function(){
updateFieldsBasedOnTestSetting();
updateFieldsBaseOnTestSettingTest();
});

var classes_data = function(){
data = [];
for (var i = 1; i <= window.number_of_classes; i++) {
Expand Down Expand Up @@ -162,4 +156,18 @@ $(function () {
$("#select-all").on('change', function(){
$(this).closest("table").find("tbody input[type=checkbox]").prop("checked", $(this).prop("checked")).trigger("change");
});

function initFields() {
if (!!document.getElementById('avaliation_multiple_creator_form_test_setting_id')) {
updateFieldsBasedOnTestSetting();
}

if (!!document.getElementById('avaliation_multiple_creator_form_weight')) {
updateFieldsBaseOnTestSettingTest();
}
}

$(document).ready(function(){
initFields();
});
});
51 changes: 25 additions & 26 deletions app/assets/javascripts/views/conceptual_exams/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ $(function() {
var classroom_id = $classroom.select2('val');
var discipline_id = window.state.current_discipline.id;
var step_id = $step.select2('val');
var start_at = '';
var end_at = '';
var recorded_at = $('#conceptual_exam_recorded_at').val()

window.studentPreviouslySelected = $student.select2('val');
$student.select2('val', '');
Expand All @@ -76,31 +75,27 @@ $(function() {
step_id: step_id,
format: 'json'
})
).done(function(data){
start_at = data.start_at;
end_at = data.end_at;
).done(function(){
var filter = {
classroom: classroom_id,
discipline: discipline_id,
score_type: 'concept',
show_inactive: false,
date: recorded_at
};

if (!_.isEmpty(classroom_id) && !_.isEmpty(recorded_at)) {
$.ajax({
url: Routes.by_date_student_enrollments_lists_pt_br_path({
filter: filter,
format: 'json'
}),
success: handleFetchStudentsSuccess,
error: handleFetchStudentsError
});
}
})
).then(function() {
var filter = {
classroom: classroom_id,
start_at: start_at,
end_at: end_at,
discipline: discipline_id,
score_type: 'concept',
show_inactive: false
};

if (!_.isEmpty(classroom_id) && !_.isEmpty(start_at) && !_.isEmpty(end_at)) {
$.ajax({
url: Routes.by_date_range_student_enrollments_lists_pt_br_path({
filter: filter,
format: 'json'
}),
success: handleFetchStudentsSuccess,
error: handleFetchStudentsError
});
}
});
)
}
};

Expand Down Expand Up @@ -349,4 +344,8 @@ $(function() {
});

fetchExamRule();

$('#conceptual_exam_recorded_at').on('change', function(){
fetchStudents();
})
});
36 changes: 36 additions & 0 deletions app/assets/javascripts/views/daily_frequencies/edit_multiple.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
$(document).ready( function() {
$('[data-id="type_of_teaching"]').each( function (index, type_of_teaching) {
$(type_of_teaching).on('change', function () {
var inputs = $(this).closest('tr').find('[data-id="type_of_teaching_input"]')
var value = $(this).val()
inputs.each(function(index, input) {
$(input).val(value)
})
var checkbox = $(this).closest('tr').find('[data-id="checkbox-id"]')
var disabled = value != 1
if (disabled == true) {
checkbox.closest('label').addClass('state-disabled');
checkbox.prop('disabled', disabled)
checkbox.prop('checked', true)
} else {
checkbox.closest('label').removeClass('state-disabled');
checkbox.prop('disabled', disabled)
}
}).trigger('change');

var in_active_search = $(this).closest('tr').find('.in-active-search').size()
var exempted_from_discipline = $(this).closest('tr').find('.exempted-student-from-discipline').size()
var checkbox = $(this).closest('tr').find('[data-id="checkbox-id"]')

if (in_active_search || exempted_from_discipline) {
$(this).val(1)
$(this).closest('label').addClass('state-disabled');
$(this).prop('disabled', true)
checkbox.closest('label').addClass('state-disabled');
checkbox.prop('checked', true)
checkbox.prop('disabled', true)
}
})
})

$(function () {

var showConfirmation = $('#new_record').val() == 'true';

// fix to checkboxes work correctly
Expand Down
49 changes: 31 additions & 18 deletions app/assets/javascripts/views/dashboard/teacher_work_done_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ $(function(){
school_calendar_step_id: schoolCalendarStepId
}
),
success: handleUpdateTeacherWOrkDoneChartSuccess,
success: handleUpdateTeacherWorkDoneChartSuccess,
error: handleFetchTeacherWorkDoneChartError
});
}
}

function handleUpdateTeacherWOrkDoneChartSuccess(teacher_notes){
function handleUpdateTeacherWorkDoneChartSuccess(teacher_notes){
if(teacher_notes.pending_notes_count == 0 && teacher_notes.completed_notes_count == 0){
noInfoChartElement.show();
$('#teacher-work-done-chart').hide();
Expand Down Expand Up @@ -68,38 +68,50 @@ $(function(){
}
noInfoChartElement.hide();
$('#teacher-work-done-chart').show();

if (teacherWorkDoneChart) {
teacherWorkDoneChart.data.datasets[0].data[0] = teacher_notes.completed_notes_count;
teacherWorkDoneChart.data.datasets[0].data[1] = teacher_notes.pending_notes_count;
teacherWorkDoneChart.update();
}
};

function generateChart() {
noInfoChartElement.show();
$('#teacher-work-done-chart').hide();

var data = {
labels: [
"Notas lançadas",
"Notas não lançadas"
],
datasets: [
{
data: [teacher_notes.completed_notes_count, teacher_notes.pending_notes_count],
backgroundColor: [
"#36A2EB",
"#FF6384"
],
hoverBackgroundColor: [
"#36A2EB",
"#FF6384"
]
}
]
};
{
data: [0, 0],
backgroundColor: [
"#36A2EB",
"#FF6384"
],
hoverBackgroundColor: [
"#36A2EB",
"#FF6384"
]
}
]
};
teacherWorkDoneChart = new Chart(ctx,{
type: 'doughnut',
data: data,
options: {
animation:{
animateScale:true
animateScale:true
},
tooltips: {
callbacks: {
label: function(tooltipItem, data) {
var dataset = data.datasets[tooltipItem.datasetIndex];

var total = dataset.data.reduce(function(previousValue, currentValue, currentIndex, array) {
var total = dataset.data.reduce(function(previousValue, currentValue) {
return previousValue + currentValue;
});

Expand All @@ -113,11 +125,12 @@ $(function(){
}
}
});
};
}

function handleFetchTeacherWorkDoneChartError() {
flashMessages.error('Ocorreu um erro ao gerar o gráfico.');
};

generateChart();
mountWorkDoneChart();
});
4 changes: 4 additions & 0 deletions app/assets/javascripts/views/descriptive_exams/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ $(function () {
should_clear_step = true,
discipline_id = $discipline.val();

if ($opinionType.data('elements').length === 2) {
$opinionType.attr('readonly', true)
}

function setFields() {
var opinionType = $opinionType.val();
should_clear_discipline = true;
Expand Down
Loading

0 comments on commit c023328

Please sign in to comment.