EPSCoR / ERCore

ERcore content management system to assist with NSF EPSCoR reporting
4 stars 7 forks source link

Proposal date awarded end date #50

Open aturling opened 8 years ago

aturling commented 8 years ago

I just noticed that if you enter a proposal with status awarded and add the award date, the end date isn’t required even though there’s an asterisk next to “show end date.” I added a test one here without an end date: http://dev-ercore.nmepscor.net/content/test-proposal-end-date

But then you get into the same situation with collaborations where they keep carrying over from year to year because there’s no end date. For example, here you can see grants awarded in 2015 appearing for the period 6/2016-5/2017: http://dev-ercore.nmepscor.net/proposals?start_date%5Bvalue%5D%5Bdate%5D=2016-06-01&end_date%5Bvalue%5D%5Bdate%5D=2017-05-31

With collaborations, users may not know the end date until the collaboration ends, but I think all grants have an award period, so shouldn’t the end date be required?

On the admin/reporting side, how do you count the number grants rewarded for a reporting period - is it the number of grants awarded that particular year, or number of ongoing grants? Looks like the system is currently counting ongoing grants (on /proposals page and table E).

cjallen-epscor commented 8 years ago

@aturling - Re: Proposal Status Award date: Do you propose we expand this date field by default (upon user updating proposal - Awarded/Expired/Denied)

Re: Collaborations - @iserna and I had this same confusion here at NM. So, accordingly we created and implemented a "Better Proposals View" that filters between award years explicitly (I can export this view for you if needed)

screen shot 2016-04-19 at 11 23 33 am

This assisted us in figuring out what was being counted within each reporting period. However, @iserna can we confirm that the system is currently counting ongoing grants on Table E?

iserna commented 8 years ago

@aturling and @cjallen-epscor I do believe we count the proposals/grants Awarded for that particular reporting period. I will confirm this but am pretty sure that's what we count.

Collaborations are meant to flow from year to year. Though, some jurisdictions do want them to end. A jurisdiction decision.

aturling commented 8 years ago

Ideally the “required” box would be checked behind “collect an end date” on /admin/structure/types/manage/er-proposal/fields/field_er_proposal_date, but our site won’t let me change it because there’s data already in the system for that field. Also I’m not sure if that makes the entire field required (I think it doesn’t - just the end date).

I’m wondering if there’s a way to require the end date in this code snippet beginning at line 244 in includes/form_logic.inc:

        // Award Dates
        $form['field_er_proposal_date']['#states'] = array(
          'visible' => array($awarded, $expired),
          'required' => array($awarded, $expired),
        );

The better proposals view sounds great if you don’t mind exporting it. Meanwhile I’ll look into what would have to change in the table E code to make sure only proposals awarded in that year are counted.

Edit: actually, if the code in table E is changed to only count grants awarded that year, you wouldn’t need the end date - just the date awarded. I think it’s as simple as removing $label==“Awarded” from this line in pages/outputs.inc:

$this->applyDateRange($query, $date_field, $period, $label=="Awarded");//Note: Award date is a date range...
iserna commented 8 years ago

@aturling Template E actually counts Proposals / Grants / Contracts that have been Submitted, Awarded, and Pending. And it should calculate for the Current Reporting Period and the Cumulative Total for the Award.

About a year ago we deleted Pending from the Status options, from the content type, because Submitted = Pending. This is also when @cjallen-epscor created the Better Proposals view that breaks everything down by reporting year.

khuffman commented 8 years ago

@aturling I also find the proposal counting in er-core a bit confusing, as @iserna indicated Table E is showing Proposals / Grants / Contracts that have been Submitted, Awarded, and Pending. But in the Accomplishment table page, in row Grant & Proposals only proposals that have "Award dates" set are counted for a certain reporting year, see this issue https://github.com/EPSCoR/ERCore-3.1/issues/15#issue-70780151 I agree with you regarding proposal end date to be required. I can't remember exactly but I think last time I asked our PA about how to count the number grants rewarded for a reporting period: she said it is the number of ongoing grants (so how the table E counts).

aturling commented 8 years ago

Yeah this is confusing for me. What if a proposal is submitted in reporting year 1 and awarded in reporting year 2? I think that currently:

So maybe the view er_summary_er_proposal should have a group of OR filters on date submitted, date awarded, etc. Does “better proposals view” already do this?

cjallen-epscor commented 8 years ago

@aturling - no, the 'Better Proposals' view does not have a set of OR filters. For simplicity, this filter merely runs the submitted date filtering between given award years - i.e. 'Show me the proposals submitted in Year One/Two/Three"

aturling commented 8 years ago

Now that I look at it, I don’t think OR-ing is possible with the exposed filters the way the views are set up. I’m experimenting with adding attachments to the proposals page, one for submitted during this reporting period, one for awarded during this reporting period, and one for awarded and ongoing (maybe others for expired, etc.)

I imported a version here: http://dev-ercore.nmepscor.net/admin/structure/views/view/er_summary_er_proposal_v2/edit/page?destination=proposals_v2%3Fstart_date%5Bvalue%5D%5Bdate%5D%3D2016-06-01%26end_date%5Bvalue%5D%5Bdate%5D%3D2017-05-31

it needs some work but you can see the basic idea. I think "awarded & ongoing" isn’t going to work here since I changed the machine name (to not interfere with the existing er_summary_er_proposal view) but it works on our dev site. This view shows up on http://dev-ercore.nmepscor.net/proposals_v2 .

aturling commented 8 years ago

Ok, second attempt at this here:

http://dev-ercore.nmepscor.net/proposals_v3

Same as above, “awarded and ongoing” isn’t going to work without editing ER Core code because I used a different machine name for the view. Also all of the CSS is missing so the top part looks weird. The summary table idea is from @tschet when he shared his screen a while back during one of the ER Core Dev meetings.

cjallen-epscor commented 8 years ago

@aturling - I like this update to the proposals view. Very clear and explanatory of proposals in the system. I propose we bundle and add/update this ER View in version 7.x-3.2-dev - possibly a new drop down?

khuffman commented 8 years ago

@cjallen-epscor @aturling I really like your "Better Proposal view" it is awesome and makes the proposal counting mess a lot easier! I would like to use it on our live site, but we have an issue with the hard coded reporting years in the view. We run our Track1 and Track2 site within the same Drupal instance (Drupal multi-site). So as you can guess on our Track2 site it would incorrectly show the Track1 dates (one not a good solution is: that I hard code Track2 dates in a section under Track1 dates ...but I don't like this at all!). In ERCore there is a system variable called: er_start_date , do you think it is possible to modify the Better Proposal view code to use the "er_start_date" to calculate the reporting years? Using "er_start_date" variable instead of the hard coded reporting year dates, also makes this view usable for other jurisdictions without them having to remember to change the hard coded dates to match their jurisdiction dates.

aturling commented 8 years ago

I can look into coding it better so that it'll work with any date range. I was in a hurry at the time so I hard-coded in our date ranges to get it up and running as quickly as possible.

Also this view is meant to replace the existing proposals view because it interacts with this bit of code here: https://github.com/EPSCoR/ERCore/blob/7.x-3.2/includes/views.inc#L2-L35 that treats content with no end date as "ongoing" in order to work with the above code, the view name must be er_summary_er_proposal.

khuffman commented 8 years ago

@aturling I managed to get our correct reporting year ranges in proposals_v3 view using variables (and code) taken from ERCore. I don't know if this is proper way to do this, but it works! Here is how I did it: in the "Page" display of proposals_v3 view I added a new Header of type Global: PHP , then I arranged this new header above the existing one "Global: Unfiltered text (Reporting Periods)", I didn't delete it since I wanted to be able to compare the results later. Then in the Configure Header: Global: PHP overlay, I selected "This page (override)" and under the box labelled "Output code" I added this code:

<h4>Kia's reporting ranges using the 'er_start_date' method :</h4>
<?php
//this is from er/module.inc function er_get_reporting_ranges()
$ranges = array();
$start_date = variable_get('er_start_date');
$reporting_month = intval(variable_get('er_reporting_month'));
$cur_month = date('n');
$adjusted_date = mktime(0, 0, 0, $cur_month-$reporting_month+7);//+half a year into the future (6) +1 offset
$cur_year = date('Y', $adjusted_date);
$start_year = $start_date['year'];
    for ($y = $cur_year; $y>=$start_year;$y--){
     $ranges[] = _generate_reporting_range($y);
    }
//this is from er/include/accomplishments.inc 
foreach ($ranges as $k=>$v){
//print date('Y-m-d', $v[0]) . ' to ' . date('Y-m-d', $v[1]);
print '<a href="?start_date%5Bvalue%5D%5Bdate%5D=' . date('Y-m-d', $v[0]) . '&end_date%5Bvalue%5D%5Bdate%5D=' . date('Y-m-d', $v[1]) .' "> '. date('Y-m-d', $v[0]) . ' to ' . date('Y-m-d', $v[1]) .'</a><br>';
}
?>
<h4>------End of Kia's reporting ranges---------</h4>
khuffman commented 8 years ago

Actually this shorter version seems to be working too, first time I did it it wasn't working but now it works fine, I think I must have had some error somewhere:

<h4>Reporting ranges using the 'er_start_date' method :</h4>
<?php
//this is from er/module.inc function er_get_reporting_ranges()
$ranges = er_get_reporting_ranges(); 
//this is from er/include/accomplishments.inc 
foreach ($ranges as $k=>$v){
//print date('Y-m-d', $v[0]) . ' to ' . date('Y-m-d', $v[1]);
print '<a href="?start_date%5Bvalue%5D%5Bdate%5D=' . date('Y-m-d', $v[0]) . '&end_date%5Bvalue%5D%5Bdate%5D=' . date('Y-m-d', $v[1]) .' "> '. date('Y-m-d', $v[0]) . ' to ' . date('Y-m-d', $v[1]) .'</a><br>';
}
?>
aturling commented 8 years ago

I forgot about the er_get_reporting_ranges() function. Yours is a lot more streamlined than what I came up with. I added the two versions here: http://dev-ercore.nmepscor.net/admin/epscor/views/check (Different view but same "reporting periods" view header)

khuffman commented 8 years ago

Actually this is the view that I applied the automatic date ranges to (described above) http://dev-ercore.nmepscor.net/proposals_v3

We are not currently using this view: http://dev-ercore.nmepscor.net/admin/epscor/views/check but yes, this one needs the automatic date ranges as well.

cjallen-epscor commented 7 years ago

@khuffman @aturling Awesome you two. I modified the code slightly to populate "Years (1-4)" instead of the er_get_reporting_ranges() and also hid the filters for our NM site.

screen shot 2016-10-06 at 8 42 41 am