Merge pull request #266 from finnlabs/fix/24211/costs-by-type

[24211] Costs by type were not loaded when opening from table
pull/6827/head
Oliver Günther 8 years ago committed by GitHub
commit 1d430d23b0
  1. 37
      .travis.yml
  2. 23
      frontend/app/components/wp-display/field-types/wp-display-costs-by-type-field.module.ts
  3. 2
      lib/open_project/costs/deleted_user_fallback.rb

@ -33,17 +33,18 @@
language: ruby language: ruby
rvm: rvm:
- 2.3.1 - 2.2.5
sudo: false sudo: false
cache: cache:
- bundler: true bundler: true
- directories: directories:
- frontend/node_modules - frontend/node_modules
- frontend/bower_components - frontend/bower_components
bundler_args: --without development production
bundler_args: --without development production docker
branches: branches:
only: only:
@ -63,17 +64,15 @@ env:
- "TEST_SUITE=npm" - "TEST_SUITE=npm"
- "TEST_SUITE=spec_legacy DB=mysql GROUP_SIZE=2 GROUP=1" - "TEST_SUITE=spec_legacy DB=mysql"
- "TEST_SUITE=spec_legacy DB=mysql GROUP_SIZE=2 GROUP=2" - "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=2 GROUP=1"
- "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=3 GROUP=1" - "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=2 GROUP=2"
- "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=3 GROUP=2" - "TEST_SUITE=specs DB=mysql GROUP_SIZE=3 GROUP=1"
- "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=3 GROUP=3" - "TEST_SUITE=specs DB=mysql GROUP_SIZE=3 GROUP=2"
- "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=1" - "TEST_SUITE=specs DB=mysql GROUP_SIZE=3 GROUP=3"
- "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=2" - "TEST_SUITE=features DB=mysql GROUP_SIZE=3 GROUP=1"
- "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=3" - "TEST_SUITE=features DB=mysql GROUP_SIZE=3 GROUP=2"
- "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=4" - "TEST_SUITE=features DB=mysql GROUP_SIZE=3 GROUP=3"
- "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=5"
- "TEST_SUITE=rspec DB=mysql GROUP_SIZE=6 GROUP=6"
before_install: before_install:
# Custom plugin instructions follow. # Custom plugin instructions follow.
@ -91,7 +90,6 @@ before_install:
- git checkout openproject/$TRAVIS_BRANCH - git checkout openproject/$TRAVIS_BRANCH
# End of custom plugin instructions. # End of custom plugin instructions.
- "rvm @default,@global do gem uninstall bundler -a -x" - "rvm @default,@global do gem uninstall bundler -a -x"
- gem install bundler -v 1.12.5 - gem install bundler -v 1.12.5
- echo `bundle -v` - echo `bundle -v`
@ -99,6 +97,11 @@ before_install:
- "export DISPLAY=:99.0" - "export DISPLAY=:99.0"
- "/sbin/start-stop-daemon --start -v --pidfile ./tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1920x1080x16" - "/sbin/start-stop-daemon --start -v --pidfile ./tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1920x1080x16"
- "echo `xdpyinfo -display :99 | grep 'dimensions' | awk '{ print $2 }'`" - "echo `xdpyinfo -display :99 | grep 'dimensions' | awk '{ print $2 }'`"
# Install Node LTS Boron (6.9.1)
- nvm install 6.9.1
# We need npm 4.0 for a bugfix in cross-platform shrinkwrap
# https://github.com/npm/npm/issues/14042
- npm install npm@4.0
- travis_retry npm install - travis_retry npm install
# We need phantomjs 2.0 to get tests passing # We need phantomjs 2.0 to get tests passing
@ -111,7 +114,7 @@ before_script:
- sh script/ci_setup.sh $DB - sh script/ci_setup.sh $DB
script: script:
- sh script/ci_runner.sh $TEST_SUITE $GROUP_SIZE $GROUP - sh script/ci_runner.sh
addons: addons:
firefox: "45.0esr" firefox: "45.0esr"

@ -27,6 +27,7 @@
//++ //++
import {DisplayField} from 'app/components/wp-display/wp-display-field/wp-display-field.module'; import {DisplayField} from 'app/components/wp-display/wp-display-field/wp-display-field.module';
import {WorkPackageCacheService} from 'app/components/work-packages/work-package-cache.service';
interface ICostsByType { interface ICostsByType {
$source: { $source: {
@ -43,6 +44,28 @@ export class CostsByTypeDisplayField extends DisplayField {
isManualRenderer = true; isManualRenderer = true;
private wpCacheService:WorkPackageCacheService;
constructor(public resource:HalResource,
public name:string,
public schema) {
super(resource, name, schema);
this.wpCacheService = <WorkPackageCacheService> this.$injector.get('wpCacheService');
this.loadIfNecessary();
}
protected loadIfNecessary() {
if (this.value && this.value.$loaded === false) {
this.value.$load().then(() => {
if (this.resource._type === 'WorkPackage') {
this.wpCacheService.updateWorkPackage(this.resource);
}
});
}
}
public get valueString() { public get valueString() {
return _.map(this.value.elements, (val: ICostsByType) => { return _.map(this.value.elements, (val: ICostsByType) => {
return val.spentUnits + ' ' + val.$source._links.costType.title; return val.spentUnits + ' ' + val.$source._links.costType.title;

@ -31,7 +31,7 @@ module OpenProject::Costs
def user_with_deleted_user_fallback(force_reload = true) def user_with_deleted_user_fallback(force_reload = true)
associated_user = user_without_deleted_user_fallback associated_user = user_without_deleted_user_fallback
associated_user.reload if force_reload associated_user.reload if force_reload && !associated_user.nil?
if associated_user.nil? && read_attribute(:user_id).present? if associated_user.nil? && read_attribute(:user_id).present?
associated_user = DeletedUser.first associated_user = DeletedUser.first

Loading…
Cancel
Save